( cd etc/rc.d ; rm -rf rc.news )
( cd etc/rc.d ; ln -sf /usr/lib/news/bin/rc.news rc.news )
( cd usr/bin ; rm -rf inews )
( cd usr/bin ; ln -sf /usr/lib/news/bin/inews inews )
( cd usr/lib/news/bin ; rm -rf ovdb_upgrade )
( cd usr/lib/news/bin ; ln -sf ovdb_recover ovdb_upgrade )
# Process the incoming configuration files

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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