doinst.sh 824 B

12345678910111213141516171819202122232425
  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. if [ -L usr/bin/weather ]; then
  14. break # Assume that this package is already installed and do nothing
  15. elif [ ! -e usr/bin/weather.expect -a -e usr/bin/weather ]; then
  16. # otherwise if /usr/bin/weather is present (and not a symlink) and
  17. # /usr/bin/weather.expect is not present, then we need to back up
  18. # the existing /usr/bin/weather, which is assumed to come from the
  19. # stock expect package
  20. cp -a usr/bin/weather usr/bin/weather.expect
  21. fi
  22. config etc/weatherrc.new