diff options
Diffstat (limited to 'network/murmur/doinst.sh')
-rw-r--r-- | network/murmur/doinst.sh | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/network/murmur/doinst.sh b/network/murmur/doinst.sh index 4632adfb54..116fd0b4fa 100644 --- a/network/murmur/doinst.sh +++ b/network/murmur/doinst.sh @@ -3,24 +3,26 @@ 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 + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then rm $NEW fi - # Otherwise, we leave the .new copy for the admin to consider... } -# Keep same perms on rc.murmur.new: -if [ -e etc/rc.d/rc.murmur ]; then - cp -a etc/rc.d/rc.murmur etc/rc.d/rc.murmur.new.incoming - cat etc/rc.d/rc.murmur.new > etc/rc.d/rc.murmur.new.incoming - mv etc/rc.d/rc.murmur.new.incoming etc/rc.d/rc.murmur.new -else - # Install executable otherwise - irrelevant unless user starts in rc.local - chmod 0755 etc/rc.d/rc.murmur.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 +} -config etc/rc.d/rc.murmur.new +config etc/logrotate.d/murmur.new config etc/murmur.ini.new + +preserve_perms etc/rc.d/rc.murmur.new |