doinst.sh 421 B

123456789101112131415161718
  1. #!/bin/sh
  2. # Handle the incoming configuration files:
  3. config() {
  4. NEW="$1"
  5. OLD="$(dirname $NEW)/$(basename $NEW .new)"
  6. # If there's no config file by that name, mv it over:
  7. if [ ! -r $OLD ]; then
  8. mv $NEW $OLD
  9. elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
  10. rm $NEW
  11. fi
  12. # Otherwise, we leave the .new copy for the admin to consider...
  13. }
  14. config etc/todorc.new