summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README46
-rw-r--r--debian/changelog10
-rw-r--r--debian/postinst6
-rw-r--r--etckeeper.814
-rwxr-xr-xuninit.d/01prompt18
-rwxr-xr-xuninit.d/50remove-metadata6
-rwxr-xr-xuninit.d/50vcs-uninit12
-rw-r--r--uninit.d/README2
8 files changed, 97 insertions, 17 deletions
diff --git a/README b/README
index 6893f33..934dd84 100644
--- a/README
+++ b/README
@@ -76,19 +76,19 @@ Darcs doesn't support symlinks, so they are also stored in
A quick walkthrough of using etckeeper.
-First, edit `/etc/etckeeper/etckeeper.conf` to select which version control
-system to use. The default is git, and this tutorial assumes you're using
+Note that the default VCS is git, and this tutorial assumes you're using
it. Using other VCSes should be broadly similar.
-The `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
-(or update content inside a "managed by etckeeper" comment block), sets up
-pre-commit hooks if they don't already exist, and so on. It does *not*
-commit any files, but does `git add` all interesting files for an initial
-commit later.
+The `etckeeper init` command initialises an /etc/.git/ repository.
+If you installed etckeeper from a package, this was probably automatically
+performed during the package installation.
- etckeeper init
+The `etckeeper init` command is careful to never overwrite existing files
+or directories in /etc. It will create a `.gitignore` if one doesn't
+already exist (or update content inside a "managed by etckeeper" comment
+block), sets up pre-commit hooks if they don't already exist, and so on. It
+does *not* commit any files, but does `git add` all interesting files for
+an initial commit later.
Now you might want to run `git status` to check that it includes all
the right files, and none of the wrong files. And you can edit the
@@ -113,9 +113,10 @@ daemons and shouldn't be tracked by git. These can be removed from git:
echo printcap >> .gitignore
git commit -a -m "don't track printcap"
-etckeeper hooks into apt so changes to interesting files in /etc caused by
-installing or upgrading packages will automatically be committed. Here
-"interesting" means files that are not ignored by `.gitignore`.
+etckeeper hooks into apt (and similar systems) so changes to interesting
+files in /etc caused by installing or upgrading packages will automatically
+be committed. Here "interesting" means files that are not ignored by
+`.gitignore`.
You can use any git commands you like, but do keep in mind that, if you
check out a different branch or an old version, git is operating directly
@@ -200,6 +201,25 @@ letting it git add new files and git rm removed ones:
chmod -x /etc/etckeeper/commit.d/50vcs-commit
+## changing VCS
+
+By default, etckeeper uses git. If you would like to use some other VCS,
+and `etckeeper init` has already been run to set up a git repository, you
+have a decision to make: Is the history recorded in that repository
+something you need to preserve, or can you afford to just blow it away
+and check the current /etc into the new VCS?
+
+In the former case, you just need to follow three steps:
+
+ etckeeper uninit # deletes /etc/.git!
+ vim /etc/etckeeper/etckeeper.conf
+ etckeeper init
+
+In the latter case, you will need to convert the git repository to the
+other VCS using whatever tools are available to do that. Then you can
+run `etckeeper uninit`, move files your new VCS will use into place,
+edit `etckeeper.conf` to change the VCS setting, and finally
+`etckeeper init`. This procedure is clearly only for the brave.
## inspiration
diff --git a/debian/changelog b/debian/changelog
index 90a7ab1..a6efb76 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,16 @@ etckeeper (0.32) UNRELEASED; urgency=low
* Implement list-installed for rpm.
* Added a spec file contributed by Jimmy Tang.
+ * Add uninit subcommand, which cleans up all etckeeper and VCS droppings
+ in /etc. This is useful if you want to switch to a different VCS and
+ don't have any history to preserve. (Preserving history and converting
+ is of course possible, but significantly harder.)
+ * Run etckeeper init on initial install. Closes: #505772
+ (The idea being that if someone doesn't want to use git, they can
+ immediatly uninit to easily reverse this.)
+ * Document how to change the VCS used by etckeeper, without preserving
+ any history. Preserving history left as an exersise for the reader.
+ Closes: #515237
-- Joey Hess <joeyh@debian.org> Tue, 17 Feb 2009 21:49:29 -0500
diff --git a/debian/postinst b/debian/postinst
index 834b069..870d67b 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -73,6 +73,12 @@ configure)
done
fi
+ if [ "$2" = "" ]; then
+ # Fresh install.
+ # Might fail if, eg, git is not installed.
+ etckeeper init || echo "etckeeper init failed; run it by hand" >&2
+ fi
+
# prints error and exits nonzero if the ignore file cannot be updated
etckeeper update-ignore || true
esac
diff --git a/etckeeper.8 b/etckeeper.8
index cfb6828..c76be55 100644
--- a/etckeeper.8
+++ b/etckeeper.8
@@ -12,16 +12,15 @@ repository located elsewhere.
.SH COMMANDS
.TP
.B init
-This is the only command you typically need to run by hand. It
-initialises and sets up a git, mercurial, or bazaar repository
+This initialises and sets up a git, mercurial, or bazaar repository
(depending on the VCS setting in
/etc/etckeeper/etckeeper.conf). Typically this is run in /etc once
when starting to use etckeeper on a machine. It can also be used to
initialise a clone of the /etc repository located elsewhere.
.TP
.B commit [message]
-Commits changes in /etc to the repository. A commit message can be
-specified.
+Commits all changes in /etc to the repository. A commit message can be
+specified. You may also use the underlying VCS to commit manually.
.TP
.B pre-commit
This is called as a pre-commit hook. It stores metadata and does sanity
@@ -44,6 +43,13 @@ This returns true if the directory contains uncommitted changes.
This updates the VCS ignore file. Content outside a "managed by etckeeper"
block is not touched. This is generally run when upgrading to a new version
of etckeeper.
+.TP
+.B uninit
+This command DESTROYS DATA! It is the inverse of the init command, removing
+VCS information and etckeeper's own bookkeeping information from the
+directory. Use with caution. A typical use case would be to run etckeeper
+uninit, then modify etckeeper.conf to use a different VCS, and then run
+etckeeper init.
.SH FILES
/etc/etckeeper/etckeeper.conf is the configuration file.
diff --git a/uninit.d/01prompt b/uninit.d/01prompt
new file mode 100755
index 0000000..e642a82
--- /dev/null
+++ b/uninit.d/01prompt
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -e
+
+echo "** Warning: etckeeper uninit will DESTROY all recorded history for $ETCKEEPER_DIR"
+echo "** This includes deleting the $VCS repository and ignore file."
+echo ""
+printf "Are you sure you want to do this? [yN] "
+read answer
+case "$answer" in
+ Y|y|yes|YES)
+ echo "Proceeding.."
+ exit 0
+ ;;
+ *)
+ echo "Aborting etckeeper uninit."
+ exit 1
+ ;;
+esac
diff --git a/uninit.d/50remove-metadata b/uninit.d/50remove-metadata
new file mode 100755
index 0000000..0be8d36
--- /dev/null
+++ b/uninit.d/50remove-metadata
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+
+# Files generated by etckeeper to store metadata the VCS cannot preserve.
+rm -f .etckeeper
+rm -f .metadata # only generated by old versions
diff --git a/uninit.d/50vcs-uninit b/uninit.d/50vcs-uninit
new file mode 100755
index 0000000..c9896ed
--- /dev/null
+++ b/uninit.d/50vcs-uninit
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+if [ "$VCS" = git ]; then
+ rm -rf .git .gitignore
+elif [ "$VCS" = hg ]; then
+ rm -rf .hg .hgignore
+elif [ "$VCS" = bzr ]; then
+ rm -rf .bzr .bzrignore
+elif [ "$VCS" = darcs ]; then
+ rm -rf _darcs .darcsignore
+fi
diff --git a/uninit.d/README b/uninit.d/README
new file mode 100644
index 0000000..d1a4eaa
--- /dev/null
+++ b/uninit.d/README
@@ -0,0 +1,2 @@
+Executable files in this directory are run to uninitialise the working
+directory, removing files added by `etckeeper init`.