diff options
Diffstat (limited to 'network/dansguardian/doinst.sh')
-rw-r--r-- | network/dansguardian/doinst.sh | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/network/dansguardian/doinst.sh b/network/dansguardian/doinst.sh index 70cb2a098c..9f153fd0d5 100644 --- a/network/dansguardian/doinst.sh +++ b/network/dansguardian/doinst.sh @@ -1,17 +1,31 @@ config() { NEW="$1" OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: if [ ! -r $OLD ]; then mv $NEW $OLD elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy rm $NEW fi + # Otherwise, we leave the .new copy for the admin to consider... } -# Keep same perms on rc.dansguardian.new: -if [ -e etc/rc.d/rc.dansguardian ]; then - cp -a etc/rc.d/rc.dansguardian etc/rc.d/rc.dansguardian.new.incoming - cat etc/rc.d/rc.dansguardian.new > etc/rc.d/rc.dansguardian.new.incoming - mv etc/rc.d/rc.dansguardian.new.incoming etc/rc.d/rc.dansguardian.new -fi +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.dansguardian.new +preserve_perms etc/logrotate.d/dansguardian.new + +for FILE in $(find etc/dansguardian -name '*.new'); do + preserve_perms $FILE +done |