summaryrefslogtreecommitdiff
path: root/vcs.d
diff options
context:
space:
mode:
authorStefan Tomanek <stefan@pico.ruhr.de>2010-07-15 22:34:10 +0200
committerStefan Tomanek <stefan@pico.ruhr.de>2010-07-15 22:34:10 +0200
commit65eda73020e0aa6bf15e64106dae955bf17a41dd (patch)
tree6ae53f5c9cdbe9dbb0490db54400855c974dc817 /vcs.d
parent005248d3f7b0dd763bcf0d16881cd5cc1b95c3fc (diff)
add "vcs" to pass commands to the vcs program
This new command allows the user to execute arbitrary commands inside the environment etckeeper runs in. This ensures that variables like $HOME match the values present during the commit process. Using the command "etckeeper vcs config user.email" will use the same git configuration as "etckeeper commit", while the value used by "git config" might vary due to the use of "sudo" and its handling of $HOME.
Diffstat (limited to 'vcs.d')
-rwxr-xr-xvcs.d/30vcs-cmd11
1 files changed, 11 insertions, 0 deletions
diff --git a/vcs.d/30vcs-cmd b/vcs.d/30vcs-cmd
new file mode 100755
index 0000000..074523d
--- /dev/null
+++ b/vcs.d/30vcs-cmd
@@ -0,0 +1,11 @@
+#!/bin/sh
+set -e
+
+IFS='
+'
+
+# check whether we can locate the vcs binary
+if [ -n "$VCS" ] && which "$VCS" > /dev/null; then
+ # pass commands to the VCS application
+ $VCS $@
+fi