summaryrefslogtreecommitdiff
path: root/uninit.d
diff options
context:
space:
mode:
Diffstat (limited to 'uninit.d')
-rwxr-xr-xuninit.d/01prompt18
-rwxr-xr-xuninit.d/50remove-metadata6
-rwxr-xr-xuninit.d/50vcs-uninit12
-rw-r--r--uninit.d/README2
4 files changed, 38 insertions, 0 deletions
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`.