#! /bin/sh
echo "*******************shutdown********************"
#copy new .startup file if an update has happened
if [ -f /root/.sync ]; then
  echo "Copy .startup and rc.local"
  mount -o remount,rw /
  cp /USER/space/cp/home/gps/bin/startup /root/.startup
  cp /USER/space/cp/home/gps/bin/rc.local /etc/rc.d/rc.local
  cp /USER/space/cp/home/gps/bin/images.txt /home/gps/bin
  chmod 755 /etc/rc.d/rc.local
  mount -o remount,ro /
fi

#copy rs232output.txt to the sd card
mkdir -p /USER/log
echo "Copy log file"
cp /dev/shm/.rs232output.txt /USER/log/.lastrs232.txt
sync