slackbuilds

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

doinst.sh (983B)


      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 # toss the redundant copy
      8     rm $NEW
      9   fi
     10   # Otherwise, we leave the .new copy for the admin to consider...
     11 }
     12 
     13 preserve_perms() {
     14   NEW="$1"
     15   OLD="$(dirname $NEW)/$(basename $NEW .new)"
     16   if [ -e $OLD ]; then
     17     cp -a $OLD ${NEW}.incoming
     18     cat $NEW > ${NEW}.incoming
     19     mv ${NEW}.incoming $NEW
     20   fi
     21   config $NEW
     22 }
     23 
     24 preserve_perms etc/rc.d/rc.postgresql.new
     25 config etc/logrotate.d/postgresql.new
     26 
     27 # Create default program symlinks in /usr/bin
     28 (
     29   cd usr/bin
     30   for pg_binary in ../lib@LIBDIRSUFFIX@/@PRGNAM@/@PG_VERSION@/bin/*; do
     31     pg_prog=$(basename $pg_binary)
     32     if [ -L $pg_prog ]; then
     33       ln -sf $pg_binary
     34     elif [ ! -e $pg_prog ]; then
     35       # make sure we don't overwrite actual binaries
     36       ln -s $pg_binary
     37     fi
     38   done
     39 )
     40