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... } config etc/logrotate.d/squid.new config etc/rc.d/rc.squid.new # If the proxy user/group don't exist, add them: if grep "^proxy:x:" etc/passwd 1> /dev/null 2> /dev/null ; then true else echo "proxy:x:23:23:proxy:/:" >> etc/passwd fi if grep "^proxy::" etc/group 1> /dev/null 2> /dev/null ; then true else echo "proxy::23:proxy" >> etc/group fi if grep "^proxy:" etc/shadow 1> /dev/null 2> /dev/null ; then true else echo "proxy:*:12460:0:::::" >> etc/shadow fi # Now copy the Squid config files into place if there are not existing copies: for cfgfile in cachemgr.conf mime.conf msntauth.conf squid.conf ; do if [ ! -f etc/squid/${cfgfile} ]; then cp -p etc/squid/${cfgfile}.default etc/squid/${cfgfile} fi done