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