doinst.sh 821 B

123456789101112131415161718192021222324252627
  1. config() {
  2. NEW="$1"
  3. OLD="$(dirname $NEW)/$(basename $NEW .new)"
  4. # If there's no config file by that name, mv it over:
  5. if [ ! -r $OLD ]; then
  6. mv $NEW $OLD
  7. elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
  8. # toss the redundant copy
  9. rm $NEW
  10. fi
  11. # Otherwise, we leave the .new copy for the admin to consider...
  12. }
  13. # Keep same perms on rc.policyd.new:
  14. if [ -e etc/rc.d/rc.policyd2 ]; then
  15. cp -a etc/rc.d/rc.policyd2 etc/rc.d/rc.policyd2.new.incoming
  16. cat etc/rc.d/rc.policyd2.new > etc/rc.d/rc.policyd2.new.incoming
  17. mv etc/rc.d/rc.policyd2.new.incoming etc/rc.d/rc.policyd2.new
  18. fi
  19. config etc/rc.d/rc.policyd2.new
  20. config etc/policyd2.conf.new
  21. config @DOCROOT@/policyd2-webui/includes/config.php.new
  22. config etc/httpd/extra/httpd-policyd2.conf.new
  23. config etc/logrotate.d/policyd2.new