summaryrefslogtreecommitdiff
path: root/init.d/20restore-etckeeper
diff options
context:
space:
mode:
Diffstat (limited to 'init.d/20restore-etckeeper')
-rwxr-xr-xinit.d/20restore-etckeeper11
1 files changed, 11 insertions, 0 deletions
diff --git a/init.d/20restore-etckeeper b/init.d/20restore-etckeeper
index 984d521..69cbc3d 100755
--- a/init.d/20restore-etckeeper
+++ b/init.d/20restore-etckeeper
@@ -1,6 +1,17 @@
#!/bin/sh
set -e
+# Used by .etckeeper to run a command if the file it acts on
+# (the last parameter) exists.
+maybe () {
+ command="$1"
+ shift 1
+
+ if [ -e "$(eval echo \$$#)" ]; then
+ "$command" "$@"
+ fi
+}
+
# Yes, this runs code from the repository. As documented, etckeeper-init
# should only be run on repositories you trust.
if [ -e .etckeeper ]; then