From 34320131ce680fe03febc9f4d6b438f05e548cbc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 5 Nov 2007 16:00:32 -0500 Subject: rename etc-* to etckeeper-* --- init.d/10restore-metadata | 5 +++++ init.d/20git-init | 5 +++++ init.d/30git-perm | 3 +++ init.d/40git-ignore | 15 +++++++++++++++ init.d/40git-pre-commit-hook | 16 ++++++++++++++++ init.d/README | 13 +++++++++++++ 6 files changed, 57 insertions(+) create mode 100755 init.d/10restore-metadata create mode 100755 init.d/20git-init create mode 100755 init.d/30git-perm create mode 100755 init.d/40git-ignore create mode 100755 init.d/40git-pre-commit-hook create mode 100644 init.d/README (limited to 'init.d') diff --git a/init.d/10restore-metadata b/init.d/10restore-metadata new file mode 100755 index 0000000..4ce97ed --- /dev/null +++ b/init.d/10restore-metadata @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if [ -e .metadata ]; then + metastore --apply --mtime +fi diff --git a/init.d/20git-init b/init.d/20git-init new file mode 100755 index 0000000..7bf1c89 --- /dev/null +++ b/init.d/20git-init @@ -0,0 +1,5 @@ +#!/bin/sh +set -e +if [ ! -e .git ]; then + git-init +fi diff --git a/init.d/30git-perm b/init.d/30git-perm new file mode 100755 index 0000000..564e489 --- /dev/null +++ b/init.d/30git-perm @@ -0,0 +1,3 @@ +#!/bin/sh +set -e +chmod 700 .git diff --git a/init.d/40git-ignore b/init.d/40git-ignore new file mode 100755 index 0000000..846c32d --- /dev/null +++ b/init.d/40git-ignore @@ -0,0 +1,15 @@ +#!/bin/sh +set -e +if [ ! -e .gitignore ]; then + cat <.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/init.d/40git-pre-commit-hook b/init.d/40git-pre-commit-hook new file mode 100755 index 0000000..360be8c --- /dev/null +++ b/init.d/40git-pre-commit-hook @@ -0,0 +1,16 @@ +#!/bin/sh +set -e +if [ -x .git/hooks/pre-commit ]; then + if ! grep -q etckeeper-pre-commit .git/hooks/pre-commit; then + echo "warning: .git/hooks/pre-commit needs to be manually modifed to run etckeeper-pre-commit" >&2 + fi +else + echo <>.git/hooks/pre-commit +#!/bin/sh +# pre-commit hook for etckeeper. Calls etckeeper-pre-commit to store metadata +# and do sanity checks. +set -e +etckeeper-pre-commit +EOF + chmod +x .git/hooks/pre-commit +fi diff --git a/init.d/README b/init.d/README new file mode 100644 index 0000000..90aec67 --- /dev/null +++ b/init.d/README @@ -0,0 +1,13 @@ +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 (or use absolute care when doing so). 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. -- cgit v1.2.3