# Process the incoming configuration files

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

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

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

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

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

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