X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=bin%2Fsave-config;fp=bin%2Fsave-config;h=a7dce5dde05677b46fa05bea3316619dfae3b098;hp=276515af0f2d9bc75e2525d1b4ab08bae0317f06;hb=cb13eeaef2764149935a47e5b9f0b7fd9e5fbf77;hpb=4c1c69d7eda2957c4ea85597eecff7228cbd1434 diff --git a/bin/save-config b/bin/save-config index 276515a..a7dce5d 100755 --- a/bin/save-config +++ b/bin/save-config @@ -24,7 +24,7 @@ LC_ALL=C [[ $(id -u) != 0 ]] && runas='sudo' # important for /etc - check4progs findchanged tar || { echo "Sorry, can't continue. Exiting.">&2 ; exit 1 } + check4progs tar || { echo "Sorry, can't continue. Exiting.">&2 ; exit 1 } CONFIG=/etc/grml/saveconfig [ -r "$CONFIG" ] && . $CONFIG @@ -50,6 +50,18 @@ debug(){ # set -x } +findchanged() { + [ -n "$1" ] || return 1 + + if [ -d "$1" ]; then + for i in $(cd "$1"; find . -type f 2>/dev/null | sed 's,^\./,,g' | grep -v ' '); do + cmp -s "$1/$i" "$2/$i" || echo "$1/$i" + done + elif [ -e "$1" ]; then + cmp -s "$1" "$2" || echo "$1" + fi +} + bailout(){ rm -f "$FILELIST" rm -f "$MAILFILE"