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-* --- README | 41 ++++++++++++++++++++-------------------- etc-init.d/10restore-metadata | 5 ----- etc-init.d/20git-init | 5 ----- etc-init.d/30git-perm | 3 --- etc-init.d/40git-ignore | 15 --------------- etc-init.d/40git-pre-commit-hook | 16 ---------------- etc-init.d/README | 12 ------------ etc-post-apt.d/README | 2 -- etc-pre-apt.d/README | 2 -- etc-pre-commit.d/README | 2 -- etckeeper | 4 ++-- 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 +++++++++++++ post-apt.d/README | 2 ++ pre-apt.d/README | 2 ++ pre-commit.d/README | 2 ++ 20 files changed, 85 insertions(+), 85 deletions(-) delete mode 100755 etc-init.d/10restore-metadata delete mode 100755 etc-init.d/20git-init delete mode 100755 etc-init.d/30git-perm delete mode 100755 etc-init.d/40git-ignore delete mode 100755 etc-init.d/40git-pre-commit-hook delete mode 100644 etc-init.d/README delete mode 100644 etc-post-apt.d/README delete mode 100644 etc-pre-apt.d/README delete mode 100644 etc-pre-commit.d/README 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 create mode 100644 post-apt.d/README create mode 100644 pre-apt.d/README create mode 100644 pre-commit.d/README diff --git a/README b/README index c453465..f9a6115 100644 --- a/README +++ b/README @@ -28,10 +28,10 @@ repository. etckeeper has special support to handle changes to /etc caused by installing and upgrading packages. Before apt installs packages, -`etc-pre-apt` will check that /etc is clean, and if it's not, prompt you -about whether or not to continue. (This check can be disabled.) After apt -installs packages, `etc-post-apt` will add any new interesting files to the -repository, and commit the changes. +`etckeeper-pre-apt` will check that /etc is clean, and if it's not, prompt +you about whether or not to continue. (This check can be disabled.) After +apt installs packages, `etckeeper-post-apt` will add any new interesting +files to the repository, and commit the changes. git is designed as a way to manage source code, not as a way to manage arbitrary directories like /etc. This means it has a few limitations that @@ -40,17 +40,17 @@ empty directories, and special files. git has only limited tracking of file metadata, being able to track the executable bit, but not other permissions or owner info. So file metadata -storage is handled by `metastore`. Amoung other chores, `etc-init` sets up -a git hook that use `metastore` to store metadata about file owners, -permissions, modification times, and even extended attributes. This +storage is handled by `metastore`. Amoung other chores, `etckeeper-init` +sets up a git hook that use `metastore` to store metadata about file +owners, permissions, modification times, and even extended attributes. This metadata is stored in git along with everything else, and can be applied if the repo should need to be checked back out. -git cannot track empty directories. So `etc-init` also sets up a git hook -to run `etc-pre-commit`, which checks for empty directories before -committing, and warn about them. You can then either ignore the empty -directory, if it's not significant, or put a file (such as `.gitignore`) in -the directory to enable git to track it. +git cannot track empty directories. So `etckeeper-init` also sets up a git +hook to run `etckeeper-pre-commit`, which checks for empty directories +before committing, and warn about them. You can then either ignore the +empty directory, if it's not significant, or put a file (such as +`.gitignore`) in the directory to enable git to track it. git doesn't support several special files that you _probably_ won't have in /etc, such as unix sockets, named pipes, hardlinked files (but softlinks @@ -63,11 +63,10 @@ contains such untrackable special files. A quick walkthrough of using etckeeper. cd /etc - etc-init + etckeeper-init -This `etc-init` command, which is actually run for you when the Debian -package of etckeeper is installed, initialises an /etc/.git/ repository. -This command is careful to never overwrite existing file or directories in +This `etckeeper-init` command initialises an /etc/.git/ repository. This +command is careful to never overwrite existing files or directories in /etc. It will create a `.gitignore` if one doesn't already exist, sets up git hooks if they don't already exist, and so on. It does *not* commit any files into to git, but does `git-add` all interesting files for an initial @@ -88,7 +87,7 @@ Rinse, lather, repeat. etckeeper hooks into apt so changed or new files caused by installing or upgrading packages will automatically be added and committed. -(`etc-post-apt` uses `git-add .`, so any new files in /etc that arn't +(`etckeeper-post-apt` uses `git-add .`, so any new files in /etc that arn't gitignored will be added.) If a package *removes* a file from /etc, etckeeper does not automatically @@ -104,13 +103,13 @@ on your system's /etc. Often it's better to clone /etc to elsewhere and do potentially dangerous stuff in a staging directory. You can clone the repository using git-clone, but be careful that the directory it's cloned into starts out mode 700, to prevent anyone else from seeing files like -shadow, before `etc-init` fixes their permissions: +shadow, before `etckeeper-init` fixes their permissions: mkdir /my/clone cd /my/clone chmod 700 . git clone /etc - etc-init + etckeeper-init chmod 755 . Another common reason to clone the repository is to make a backup to a @@ -129,12 +128,12 @@ sky's the limit.. ## configuration -Each etc-foo command uses `run-parts` to run the executable files in +Each etckeeper-foo command uses `run-parts` to run the executable files in /etc/etckeeper/foo.d/. By default these directories contain a bunch of symlinks to the actual files; you can remove or reorder the symlinks, or add your own custom files. -Note that the etc-foo commands are careful to not hardcode anything about +Note that the etckeeper-foo commands are careful to not hardcode anything about git. If you want to use some other revision control system, that's theoretically possible to accomplish by just changing the files in /etc/etckeeper/. If you do this, please let me know. diff --git a/etc-init.d/10restore-metadata b/etc-init.d/10restore-metadata deleted file mode 100755 index 4ce97ed..0000000 --- a/etc-init.d/10restore-metadata +++ /dev/null @@ -1,5 +0,0 @@ -#!/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 deleted file mode 100755 index 7bf1c89..0000000 --- a/etc-init.d/20git-init +++ /dev/null @@ -1,5 +0,0 @@ -#!/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 deleted file mode 100755 index 564e489..0000000 --- a/etc-init.d/30git-perm +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -set -e -chmod 700 .git diff --git a/etc-init.d/40git-ignore b/etc-init.d/40git-ignore deleted file mode 100755 index 846c32d..0000000 --- a/etc-init.d/40git-ignore +++ /dev/null @@ -1,15 +0,0 @@ -#!/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/etc-init.d/40git-pre-commit-hook b/etc-init.d/40git-pre-commit-hook deleted file mode 100755 index e7b58e0..0000000 --- a/etc-init.d/40git-pre-commit-hook +++ /dev/null @@ -1,16 +0,0 @@ -#!/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 <>.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 deleted file mode 100644 index 8fe4cd1..0000000 --- a/etc-init.d/README +++ /dev/null @@ -1,12 +0,0 @@ -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. diff --git a/etc-post-apt.d/README b/etc-post-apt.d/README deleted file mode 100644 index 34b65ac..0000000 --- a/etc-post-apt.d/README +++ /dev/null @@ -1,2 +0,0 @@ -Files in this directory are run after apt has run. They should commit -changed and new files in the working directory to to repository. diff --git a/etc-pre-apt.d/README b/etc-pre-apt.d/README deleted file mode 100644 index aadbd4f..0000000 --- a/etc-pre-apt.d/README +++ /dev/null @@ -1,2 +0,0 @@ -Files in this directory are run before apt is run. This is mostly used for -sanity checks, ie, does the working directory have any uncommitted changes? diff --git a/etc-pre-commit.d/README b/etc-pre-commit.d/README deleted file mode 100644 index 051d094..0000000 --- a/etc-pre-commit.d/README +++ /dev/null @@ -1,2 +0,0 @@ -This is run by a git pre-commit hook before committing changes to the -repository. This can be used for storing metadata, and for sanity checks. diff --git a/etckeeper b/etckeeper index 294e0ce..539e880 100755 --- a/etckeeper +++ b/etckeeper @@ -2,9 +2,9 @@ set -e if [ "$0" != etckeeper ]; then - command="$(basename $0)" + command="$(basename $0 | sed -e s/etckeeper-//)" else - command="etc-$1" + command="$1" shift 1 fi 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. diff --git a/post-apt.d/README b/post-apt.d/README new file mode 100644 index 0000000..34b65ac --- /dev/null +++ b/post-apt.d/README @@ -0,0 +1,2 @@ +Files in this directory are run after apt has run. They should commit +changed and new files in the working directory to to repository. diff --git a/pre-apt.d/README b/pre-apt.d/README new file mode 100644 index 0000000..aadbd4f --- /dev/null +++ b/pre-apt.d/README @@ -0,0 +1,2 @@ +Files in this directory are run before apt is run. This is mostly used for +sanity checks, ie, does the working directory have any uncommitted changes? diff --git a/pre-commit.d/README b/pre-commit.d/README new file mode 100644 index 0000000..051d094 --- /dev/null +++ b/pre-commit.d/README @@ -0,0 +1,2 @@ +This is run by a git pre-commit hook before committing changes to the +repository. This can be used for storing metadata, and for sanity checks. -- cgit v1.2.3