config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
    # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}

preserve_perms() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  if [ -e $OLD ]; then
    cp -a $OLD ${NEW}.incoming
    cat $NEW > ${NEW}.incoming
    mv ${NEW}.incoming $NEW
  fi
  config $NEW
}

preserve_perms etc/rc.d/rc.multipathd.new
preserve_perms etc/multipath.conf.new
( cd lib64 ; rm -rf libdmmp.so )
( cd lib64 ; ln -sf libdmmp.so.0.2.0 libdmmp.so )
( cd lib64 ; rm -rf libmpathcmd.so )
( cd lib64 ; ln -sf libmpathcmd.so.0 libmpathcmd.so )
( cd lib64 ; rm -rf libmpathpersist.so )
( cd lib64 ; ln -sf libmpathpersist.so.0 libmpathpersist.so )
( cd lib64 ; rm -rf libmpathvalid.so )
( cd lib64 ; ln -sf libmpathvalid.so.0 libmpathvalid.so )
( cd lib64 ; rm -rf libmultipath.so )
( cd lib64 ; ln -sf libmultipath.so.0 libmultipath.so )
( cd usr/doc/multipath-tools-0.8.7 ; rm -rf COPYING )
( cd usr/doc/multipath-tools-0.8.7 ; ln -sf LICENSES/LGPL-2.0 COPYING )
