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 cop
y
    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}
}

config etc/ha.d/authkeys.new
config etc/ha.d/ha.cf.new
config etc/ha.d/haresources.new
preserve_perms etc/rc.d/init.d/heartbeat.new
( cd usr/lib ; rm -rf libapphb.so )
( cd usr/lib ; ln -sf libapphb.so.2.0.0 libapphb.so )
( cd usr/lib ; rm -rf libapphb.so.2 )
( cd usr/lib ; ln -sf libapphb.so.2.0.0 libapphb.so.2 )
( cd usr/lib ; rm -rf libccmclient.so )
( cd usr/lib ; ln -sf libccmclient.so.1.0.0 libccmclient.so )
( cd usr/lib ; rm -rf libccmclient.so.1 )
( cd usr/lib ; ln -sf libccmclient.so.1.0.0 libccmclient.so.1 )
( cd usr/lib ; rm -rf libclm.so )
( cd usr/lib ; ln -sf libclm.so.1.0.0 libclm.so )
( cd usr/lib ; rm -rf libclm.so.1 )
( cd usr/lib ; ln -sf libclm.so.1.0.0 libclm.so.1 )
( cd usr/lib ; rm -rf libhbclient.so )
( cd usr/lib ; ln -sf libhbclient.so.1.0.0 libhbclient.so )
( cd usr/lib ; rm -rf libhbclient.so.1 )
( cd usr/lib ; ln -sf libhbclient.so.1.0.0 libhbclient.so.1 )
