diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-01-15 14:21:46 -0500 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-01-15 14:21:46 -0500 |
commit | c8f16796c6c72251814626ccf911d8f025cc60f3 (patch) | |
tree | 17c99c0cc0570d2167ceb3cf888d60df304a757a /etckeeper | |
parent | 45fa1c5a4d911503b545df62c4e276807063dc4e (diff) |
* Convert the directory parameter of etckeeper into "-d directory".
* Pass other patameters on from etckeeper to the .d scripts.
* Stop using run-parts for various reasons.
* Split out a commit.d that contains committing code that's used by
both the pre-install.d and post-install.d scripts.
* Split out an unclean.d that tests if the WC contains uncommitted
changes.
* Add preinst code to remove old post-install.d scripts.
Diffstat (limited to 'etckeeper')
-rwxr-xr-x | etckeeper | 30 |
1 files changed, 25 insertions, 5 deletions
@@ -2,6 +2,11 @@ set -e conf=/etc/etckeeper/etckeeper.conf +usage() { + echo "usage: etckeeper command [-d directory]" >&2 + exit 1 +} + if [ -e $conf ]; then . $conf fi @@ -27,8 +32,7 @@ if [ ! -z "$LOWLEVEL_PACKAGE_MANAGER" ]; then fi if [ -z "$1" ]; then - echo "usage: etckeeper command [directory]" >&2 - exit 1 + usage fi command="$1" shift 1 @@ -45,10 +49,26 @@ if [ ! -d "/etc/etckeeper/$command.d" ]; then exit 1 fi -if [ -n "$1" ]; then - cd "$1" +if [ "x$1" = "x-d" ]; then + if [ -n "$2" ]; then + cd "$2" + shift 2 + else + usage + fi else cd /etc fi -run-parts --exit-on-error "/etc/etckeeper/$command.d" +lsscripts() { + perl -e ' + $dir=shift; + print join "\n", grep { ! -d $_ && -x $_ } + grep /^\Q$dir\/\E[-a-zA-Z0-9]+$/, + glob "$dir/*"; + ' "$1" +} + +for script in $(lsscripts "/etc/etckeeper/$command.d"); do + "$script" "$@" +done |