diff --git a/piratebox/piratebox/bin/timesave.sh b/piratebox/piratebox/bin/timesave.sh index 324c2ca..3d69d0b 100755 --- a/piratebox/piratebox/bin/timesave.sh +++ b/piratebox/piratebox/bin/timesave.sh @@ -27,7 +27,6 @@ fi . $1 -TIMESAVE="$PIRATEBOX_FOLDER/timesave_file" if [ "$2" = "install" ] ; then crontab -l > $PIRATEBOX_FOLDER/tmp/crontab 2> /dev/null @@ -38,19 +37,10 @@ if [ "$2" = "install" ] ; then touch $TIMESAVE chmod a+rw $TIMESAVE - if [ "$OPENWRT" = "yes" ] ; then - echo "Placing Timerecover on Startup" - echo " $0 $1 recover " >> /etc/rc.local - sed 's:exit:#exit:g' -i /etc/rc.local - echo "Activating cron-service.." - /etc/init.d/cron enable - /etc/init.d/cron start - echo "done" - else - echo "Remember to have cron active..." - echo " on OpenWrt run: /etc/init.d/cron enable" - echo " /etc/init.d/cron start" - fi + echo "Remember to have cron active..." + echo " on OpenWrt run: /etc/init.d/cron enable" + echo " /etc/init.d/cron start" + #Save the current time $0 $1 "save" exit 0 @@ -70,9 +60,14 @@ if [ "$2" = "save" ] ; then fi if [ "$2" = "recover" ] ; then - date `cat $TIMESAVE ` - [ "$?" != "0" ] && echo "error in recovering time" && exit 255 - echo "Time recovered" - exit 0 + if [ `date +%C%g%m%d%H%M` -lt `cat $TIMESAVE` ] ; + date `cat $TIMESAVE ` + [ "$?" != "0" ] && echo "error in recovering time" && exit 255 + echo "Time recovered" + exit 0 + else + echo "Sorry, changing timebackward via timesave is not possible" + exit 1 + fi fi diff --git a/piratebox/piratebox/conf/piratebox.conf b/piratebox/piratebox/conf/piratebox.conf index 97d6bf5..ea9b2df 100644 --- a/piratebox/piratebox/conf/piratebox.conf +++ b/piratebox/piratebox/conf/piratebox.conf @@ -7,6 +7,7 @@ ## 2012-06-08 Changed IP Stuff to generating dnsmasq.conf stuff ## ADDed SubConfig for IPV6 config ## Changed Order of config +## 2013-08-14 Added timesave url ## ######## @@ -110,6 +111,8 @@ IP=$NET.$IP_SHORT #----------------- Configuration for the pure piratebox -------------------# ## droopy, webserver, shoutbox- and forum-server +## Timesave file for non RTC devices +TIMESAVE="$PIRATEBOX_FOLDER/share/timesave_file" #Start droopy? - Enable upload? DROOPY_ENABLED="yes"