diff options
Diffstat (limited to 'etc-init.d')
-rwxr-xr-x | etc-init.d/10restore-metadata | 5 | ||||
-rwxr-xr-x | etc-init.d/20git-init | 5 | ||||
-rwxr-xr-x | etc-init.d/30git-perm | 3 | ||||
-rwxr-xr-x | etc-init.d/40git-ignore | 15 | ||||
-rwxr-xr-x | etc-init.d/40git-pre-commit-hook | 16 | ||||
-rw-r--r-- | etc-init.d/README | 12 |
6 files changed, 56 insertions, 0 deletions
diff --git a/etc-init.d/10restore-metadata b/etc-init.d/10restore-metadata new file mode 100755 index 0000000..4ce97ed --- /dev/null +++ b/etc-init.d/10restore-metadata @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if [ -e .metadata ]; then + metastore --apply --mtime +fi diff --git a/etc-init.d/20git-init b/etc-init.d/20git-init new file mode 100755 index 0000000..7bf1c89 --- /dev/null +++ b/etc-init.d/20git-init @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if [ ! -e .git ]; then + git-init +fi diff --git a/etc-init.d/30git-perm b/etc-init.d/30git-perm new file mode 100755 index 0000000..564e489 --- /dev/null +++ b/etc-init.d/30git-perm @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +chmod 700 .git diff --git a/etc-init.d/40git-ignore b/etc-init.d/40git-ignore new file mode 100755 index 0000000..846c32d --- /dev/null +++ b/etc-init.d/40git-ignore @@ -0,0 +1,15 @@ +#!/bin/sh +set -e +if [ ! -e .gitignore ]; then + cat <<EOF >.gitignore +*~ + +# new and old versions of conffiles, stored by dpkg +*.dpkg-new +*.dpkg-old + +# mount(8) records system state here, no need to keep these in git +blkid.tab(|.old) +mtab +EOF +fi diff --git a/etc-init.d/40git-pre-commit-hook b/etc-init.d/40git-pre-commit-hook new file mode 100755 index 0000000..e7b58e0 --- /dev/null +++ b/etc-init.d/40git-pre-commit-hook @@ -0,0 +1,16 @@ +#!/bin/sh +set -e +if [ -x .git/hooks/pre-commit ]; then + if ! grep -q etc-pre-commit .git/hooks/pre-commit; then + echo "warning: .git/hooks/pre-commit needs to be manually modifed to run etc-pre-commit" >&2 + fi +else + echo <<EOF >>.git/hooks/pre-commit +#!/bin/sh +# pre-commit hook for etckeeper. Calls etc-pre-commit to store metadata +# and do sanity checks. +set -e +etc-pre-commit +EOF + chmod +x .git/hooks/pre-commit +fi diff --git a/etc-init.d/README b/etc-init.d/README new file mode 100644 index 0000000..8fe4cd1 --- /dev/null +++ b/etc-init.d/README @@ -0,0 +1,12 @@ +Executable files in this directory are run to initialise the working directory +for use by etckeeper. If the working directory is not already in version +control, that includes setting up the version control, but not actually +committing anything. If the working directory is in version control, +it includes applying stored metadata to the checked out files in the +working directory. + +Please be careful to *never* overwrite existing files/directories +in the working directory. If a file you need to write already exists, check +if its contents are sane, and if not, emit a warning on stderr. + +If initialisation fails, exit nonzero and no later files will be run. |