doinst.sh 604 B

12345678910111213141516171819202122232425262728
  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. perms(){
  14. # Keep same perms on $1.new:
  15. if [ -e "$1" ]; then
  16. cp -a "$1" "$1".new.incoming
  17. cat "$1".new > "$1".new.incoming
  18. mv "$1".new.incoming "$1".new
  19. fi
  20. config "$1".new
  21. }
  22. perms etc/rc.d/rc.g15daemon
  23. perms etc/rc.d/rc.g15daemon.conf