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
}

config etc/rdnssd/merge-hook.new
preserve_perms etc/rc.d/rc.rdnssd.new

( cd usr/man/man1 ; rm -rf tcpspray6.1.gz )
( cd usr/man/man1 ; ln -sf tcpspray.1.gz tcpspray6.1.gz )
( cd usr/man/man1 ; rm -rf name2addr.1.gz )
( cd usr/man/man1 ; ln -sf addr2name.1.gz name2addr.1.gz )
( cd usr/man/man8 ; rm -rf tcptraceroute6.8.gz )
( cd usr/man/man8 ; ln -sf rltraceroute6.8.gz tcptraceroute6.8.gz )
( cd usr/man/man8 ; rm -rf tracert6.8.gz )
( cd usr/man/man8 ; ln -sf rltraceroute6.8.gz tracert6.8.gz )
