summaryrefslogtreecommitdiff
path: root/uninit.d
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-09-07 14:07:33 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-09-07 14:07:33 -0400
commitdd45df9d9209f2f47042e76c32476a21884b7c52 (patch)
treeaecc44db2c4b6a8266f2948d2ed56654080fac5c /uninit.d
parente382059c7e50ff417fe74c4d64a632f2f6f518e8 (diff)
Change etckeeper uninit to not remove .gitignore (etc) file if it lacks the "managed by etckeeper" comment. Closes: #545137
Diffstat (limited to 'uninit.d')
-rwxr-xr-xuninit.d/50vcs-uninit20
1 files changed, 16 insertions, 4 deletions
diff --git a/uninit.d/50vcs-uninit b/uninit.d/50vcs-uninit
index c9896ed..eb9f13a 100755
--- a/uninit.d/50vcs-uninit
+++ b/uninit.d/50vcs-uninit
@@ -2,11 +2,23 @@
set -e
if [ "$VCS" = git ]; then
- rm -rf .git .gitignore
+ rm -rf .git
+ file=.gitignore
elif [ "$VCS" = hg ]; then
- rm -rf .hg .hgignore
+ rm -rf .hg
+ file=.hgignore
elif [ "$VCS" = bzr ]; then
- rm -rf .bzr .bzrignore
+ rm -rf .bzr
+ file=.bzrignore
elif [ "$VCS" = darcs ]; then
- rm -rf _darcs .darcsignore
+ rm -rf _darcs
+ file=.darcsignore
+fi
+
+managed_by_etckeeper="managed by etckeeper"
+
+if ! grep -q "$managed_by_etckeeper" "$file"; then
+ echo "etckeeper: "$file" does not contain \"$managed_by_etckeeper\" comment; not removing"
+else
+ rm -f $file
fi