summaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2007-11-05 16:00:32 -0500
committerJoey Hess <joey@kodama.kitenet.net>2007-11-05 16:00:32 -0500
commit34320131ce680fe03febc9f4d6b438f05e548cbc (patch)
tree41c91d7ad68331e1fa2525c43d43e6c04899b09b /init.d
parent3e6cf464cff47d22f4ac4b4313fda68f32ae1ea8 (diff)
rename etc-* to etckeeper-*
Diffstat (limited to 'init.d')
-rwxr-xr-xinit.d/10restore-metadata5
-rwxr-xr-xinit.d/20git-init5
-rwxr-xr-xinit.d/30git-perm3
-rwxr-xr-xinit.d/40git-ignore15
-rwxr-xr-xinit.d/40git-pre-commit-hook16
-rw-r--r--init.d/README13
6 files changed, 57 insertions, 0 deletions
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 <<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/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 <<EOF >>.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.