( cd bin ; rm -rf dnsdomainname )
( cd bin ; ln -sf hostname dnsdomainname )
( cd bin ; rm -rf nisdomainname )
( cd bin ; ln -sf hostname nisdomainname )
( cd bin ; rm -rf ypdomainname )
( cd bin ; ln -sf hostname ypdomainname )
( cd sbin ; rm -rf netconfig )
( cd sbin ; ln -sf netconfig.color netconfig )
( cd usr/bin ; rm -rf inews )
( cd usr/bin ; ln -sf inews-nntp inews )
( cd usr/bin ; rm -rf ntalk )
( cd usr/bin ; ln -sf talk ntalk )
( cd usr/man/man8 ; rm -rf rpc.mountd.8.gz )
( cd usr/man/man8 ; ln -sf mountd.8.gz rpc.mountd.8.gz )
( cd usr/man/man8 ; rm -rf rpc.nfsd.8.gz )
( cd usr/man/man8 ; ln -sf nfsd.8.gz rpc.nfsd.8.gz )
( cd usr/man/man8 ; rm -rf rpc.rquotad.8.gz )
( cd usr/man/man8 ; ln -sf rquotad.8.gz rpc.rquotad.8.gz )
( cd usr/man/man8 ; rm -rf rpc.lockd.8.gz )
( cd usr/man/man8 ; ln -sf lockd.8.gz rpc.lockd.8.gz )
( cd usr/man/man8 ; rm -rf rpc.statd.8.gz )
( cd usr/man/man8 ; ln -sf statd.8.gz rpc.statd.8.gz )
( cd usr/sbin ; rm -rf in.ntalkd )
( cd usr/sbin ; ln -sf in.talkd in.ntalkd )
if [ ! -r var/lib/nfs/rmtab ]; then
   touch var/lib/nfs/rmtab
   chmod 644 var/lib/nfs/rmtab
fi
if [ ! -r var/lib/nfs/xtab ]; then
   touch var/lib/nfs/xtab
   chmod 644 var/lib/nfs/xtab
fi
if [ ! -r var/lib/nfs/etab ]; then
   touch var/lib/nfs/etab
   chmod 644 var/lib/nfs/etab
fi
# Process the incoming configuration files

if [ ! -f etc/HOSTNAME ]
then
   mv install/conf/etc/HOSTNAME etc/HOSTNAME
else
   if [ "`md5sum install/conf/etc/HOSTNAME | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/HOSTNAME | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/HOSTNAME etc/HOSTNAME
   else
      rm install/conf/etc/HOSTNAME
   fi
fi

if [ ! -f etc/NETWORKING ]
then
   mv install/conf/etc/NETWORKING etc/NETWORKING
else
   if [ "`md5sum install/conf/etc/NETWORKING | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/NETWORKING | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/NETWORKING etc/NETWORKING
   else
      rm install/conf/etc/NETWORKING
   fi
fi

if [ ! -f etc/exports ]
then
   mv install/conf/etc/exports etc/exports
else
   if [ "`md5sum install/conf/etc/exports | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/exports | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/exports etc/exports
   else
      rm install/conf/etc/exports
   fi
fi

if [ ! -f etc/gateways ]
then
   mv install/conf/etc/gateways etc/gateways
else
   if [ "`md5sum install/conf/etc/gateways | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/gateways | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/gateways etc/gateways
   else
      rm install/conf/etc/gateways
   fi
fi

if [ ! -f etc/host.conf ]
then
   mv install/conf/etc/host.conf etc/host.conf
else
   if [ "`md5sum install/conf/etc/host.conf | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/host.conf | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/host.conf etc/host.conf
   else
      rm install/conf/etc/host.conf
   fi
fi

if [ ! -f etc/hosts ]
then
   mv install/conf/etc/hosts etc/hosts
else
   if [ "`md5sum install/conf/etc/hosts | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/hosts | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/hosts etc/hosts
   else
      rm install/conf/etc/hosts
   fi
fi

if [ ! -f etc/hosts.allow ]
then
   mv install/conf/etc/hosts.allow etc/hosts.allow
else
   if [ "`md5sum install/conf/etc/hosts.allow | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/hosts.allow | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/hosts.allow etc/hosts.allow
   else
      rm install/conf/etc/hosts.allow
   fi
fi

if [ ! -f etc/hosts.deny ]
then
   mv install/conf/etc/hosts.deny etc/hosts.deny
else
   if [ "`md5sum install/conf/etc/hosts.deny | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/hosts.deny | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/hosts.deny etc/hosts.deny
   else
      rm install/conf/etc/hosts.deny
   fi
fi

if [ ! -f etc/hosts.equiv ]
then
   mv install/conf/etc/hosts.equiv etc/hosts.equiv
else
   if [ "`md5sum install/conf/etc/hosts.equiv | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/hosts.equiv | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/hosts.equiv etc/hosts.equiv
   else
      rm install/conf/etc/hosts.equiv
   fi
fi

if [ ! -f etc/identd.conf ]
then
   mv install/conf/etc/identd.conf etc/identd.conf
else
   if [ "`md5sum install/conf/etc/identd.conf | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/identd.conf | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/identd.conf etc/identd.conf
   else
      rm install/conf/etc/identd.conf
   fi
fi

if [ ! -f etc/inetd.conf ]
then
   mv install/conf/etc/inetd.conf etc/inetd.conf
else
   if [ "`md5sum install/conf/etc/inetd.conf | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/inetd.conf | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/inetd.conf etc/inetd.conf
   else
      rm install/conf/etc/inetd.conf
   fi
fi

if [ ! -f etc/networks ]
then
   mv install/conf/etc/networks etc/networks
else
   if [ "`md5sum install/conf/etc/networks | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/networks | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/networks etc/networks
   else
      rm install/conf/etc/networks
   fi
fi

if [ ! -f etc/nntpserver ]
then
   mv install/conf/etc/nntpserver etc/nntpserver
else
   if [ "`md5sum install/conf/etc/nntpserver | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/nntpserver | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/nntpserver etc/nntpserver
   else
      rm install/conf/etc/nntpserver
   fi
fi

if [ ! -f etc/protocols ]
then
   mv install/conf/etc/protocols etc/protocols
else
   if [ "`md5sum install/conf/etc/protocols | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/protocols | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/protocols etc/protocols
   else
      rm install/conf/etc/protocols
   fi
fi

if [ ! -f etc/resolv.conf ]
then
   mv install/conf/etc/resolv.conf etc/resolv.conf
else
   if [ "`md5sum install/conf/etc/resolv.conf | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/resolv.conf | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/resolv.conf etc/resolv.conf
   else
      rm install/conf/etc/resolv.conf
   fi
fi

if [ ! -f etc/rpc ]
then
   mv install/conf/etc/rpc etc/rpc
else
   if [ "`md5sum install/conf/etc/rpc | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/rpc | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/rpc etc/rpc
   else
      rm install/conf/etc/rpc
   fi
fi

if [ ! -f etc/services ]
then
   mv install/conf/etc/services etc/services
else
   if [ "`md5sum install/conf/etc/services | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/services | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/services etc/services
   else
      rm install/conf/etc/services
   fi
fi

if [ ! -f etc/rc.d/rc.inet1 ]
then
   mv install/conf/etc/rc.d/rc.inet1 etc/rc.d/rc.inet1
else
   if [ "`md5sum install/conf/etc/rc.d/rc.inet1 | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/rc.d/rc.inet1 | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/rc.d/rc.inet1 etc/rc.d/rc.inet1
   else
      rm install/conf/etc/rc.d/rc.inet1
   fi
fi

if [ ! -f etc/rc.d/rc.inet2 ]
then
   mv install/conf/etc/rc.d/rc.inet2 etc/rc.d/rc.inet2
else
   if [ "`md5sum install/conf/etc/rc.d/rc.inet2 | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/rc.d/rc.inet2 | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/rc.d/rc.inet2 etc/rc.d/rc.inet2
   else
      rm install/conf/etc/rc.d/rc.inet2
   fi
fi

if [ ! -f etc/rc.d/rc.nfsd ]
then
   mv install/conf/etc/rc.d/rc.nfsd etc/rc.d/rc.nfsd
else
   if [ "`md5sum install/conf/etc/rc.d/rc.nfsd | cut -d ' ' -f 1 2>/dev/null`" = "`md5sum etc/rc.d/rc.nfsd | cut -d ' ' -f 1 2>/dev/null`" ]
   then
      mv install/conf/etc/rc.d/rc.nfsd etc/rc.d/rc.nfsd
   else
      rm install/conf/etc/rc.d/rc.nfsd
   fi
fi

# Make sure the incoming conf directory is gone
rm -rf install/conf
