slackbuilds

My Slackbuilds
git clone git://git.server.ky/slackcoder/slackbuilds
Log | Files | Refs | README

doinst.sh (634B)


      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 
     14 preserve_perms() {
     15   NEW="$1"
     16   OLD="$(dirname $NEW)/$(basename $NEW .new)"
     17   if [ -e $OLD ]; then
     18     cp -a $OLD ${NEW}.incoming
     19     cat $NEW > ${NEW}.incoming
     20     mv ${NEW}.incoming $NEW
     21   fi
     22   config $NEW
     23 }
     24 
     25 preserve_perms etc/galileo.conf.new
     26 preserve_perms etc/rc.d/rc.galileo.new