Warn if the configured VCS is different from the detected VCS. detect-vcs
authorJelmer Vernooij <jelmer@samba.org>
Thu, 27 Dec 2012 16:23:18 +0000 (17:23 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 27 Dec 2012 16:23:18 +0000 (17:23 +0100)
etckeeper

index bbdecffc77d9c1b29bd8f23c2be025db5e805a61..f45bfb9e17504e3bcbb5817341d43e8e2b7264a5 100755 (executable)
--- a/etckeeper
+++ b/etckeeper
@@ -17,18 +17,27 @@ if [ -e $conf ]; then
 fi
 
 if [ -d ".git" ]; then
-       VCS=git
+       PROBED_VCS=git
 elif [ -d ".hg" ]; then
-       VCS=hg
+       PROBED_VCS=hg
 elif [ -d "_darcs" ]; then
-       VCS=darcs
+       PROBED_VCS=darcs
 elif [ -d ".bzr" ]; then
-       VCS=bzr
+       PROBED_VCS=bzr
+else
+       PROBED_VCS=
 fi
 
 if [ -z "$VCS" ]; then
-       echo "Please configure a VCS in $conf" >&2
-       exit 1
+       if [ -z "$PROBED_VCS" ]; then
+               echo "Please configure a VCS in $conf" >&2
+               exit 1
+       else
+               VCS="$PROBED_VCS"
+       fi
+elif [ ! -z "$PROBED_VCS" ] && [ "$VCS" != "$PROBED_VCS" ]; then
+       echo -n "etckeeper warning: VCS configured in etckeeper.conf " >&2
+       echo "($VCS) different from detected VCS ($PROBED_VCS) in /etc." >&2
 fi
 export VCS