diff --git a/BuildScripts/timesave.service b/BuildScripts/timesave.service new file mode 100644 index 0000000..26a4c13 --- /dev/null +++ b/BuildScripts/timesave.service @@ -0,0 +1,10 @@ +[Unit] +Description=PirateBox timesave service + +[Service] +Type=oneshot +ExecStart=/opt/piratebox/bin/timesave.sh /opt/piratebox/conf/piratebox.conf recover +TimeoutSec=20 + +[Install] +WantedBy=multi-user.target diff --git a/CHANGELOG b/CHANGELOG index 7bcb56d..9b3db3b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,11 @@ CHANGELOG +=== 1.0.5 === +* [New] Improved styling for droopy iframe. +* [New] Timesave script service file to run set the time during startup. +* [Fix] Droopy call in init.d/piratebox failed to use the correct port. +* [Fix] Timesave script behaviour fixed on full Linux systems. +* OpenWrt's date format is now customized during build & piratebox.conf . === 1.1.0 === * [New] Enable / Disable file provisioning for custom lighttpd directory listing diff --git a/Makefile b/Makefile index 868272d..e5ed931 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,8 @@ $(OPENWRT_CONFIG_FOLDER): sed 's:192.168.77:192.168.1:g' -i $@/piratebox.conf sed 's:DROOPY_USE_USER="yes":DROOPY_USE_USER="no":' -i $@/piratebox.conf sed 's:LEASE_FILE_LOCATION=$$PIRATEBOX_FOLDER/tmp/lease.file:LEASE_FILE_LOCATION=/tmp/lease.file:' -i $@/piratebox.conf + sed 's:TIMESAVE_FORMAT="":TIMESAVE_FORMAT="+%C%g%m%d%H%M":' -i $@/piratebox.conf + $(OPENWRT_BIN_FOLDER): mkdir -p $@ diff --git a/README.md b/README.md index e3c36f5..d6041f8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ # PirateBoxScripts with Modifications for running in a Webserver + +[![Join the chat at https://gitter.im/PirateBox-Dev/PirateBoxScripts_Webserver](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/PirateBox-Dev/PirateBoxScripts_Webserver?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) © 2012-2014 [Matthias Strubel](mailto:matthias.strubel@aod-rpg.de) licenced under GPL-3 ## Maintainers diff --git a/piratebox/piratebox/bin/timesave.sh b/piratebox/piratebox/bin/timesave.sh index 943319b..bc13509 100755 --- a/piratebox/piratebox/bin/timesave.sh +++ b/piratebox/piratebox/bin/timesave.sh @@ -8,12 +8,13 @@ # gives a sort of stability to complete standalone # systems. # -# Licenced under GPL-3 @ 2012-2014 +# Licenced under GPL-3 @ 2012,2015 # Matthias Strubel matthias.strubel@aod-rgp.de ##function for similar saving & getting time get_datetime() { - date +%C%g%m%d%H%M + # Get format from piratebox.conf + date $TIMESAVE_FORMAT } @@ -66,7 +67,7 @@ fi if [ "$2" = "recover" ] ; then if [ `get_datetime` -lt `cat $TIMESAVE` ] ; then - date `cat $TIMESAVE ` + date -s `cat $TIMESAVE ` [ "$?" != "0" ] && echo "error in recovering time" && exit 255 echo "Time recovered" exit 0 diff --git a/piratebox/piratebox/conf/piratebox.conf b/piratebox/piratebox/conf/piratebox.conf index 7e15f7d..b550ebf 100644 --- a/piratebox/piratebox/conf/piratebox.conf +++ b/piratebox/piratebox/conf/piratebox.conf @@ -115,6 +115,11 @@ NODE_CONFIG="$PIRATEBOX_FOLDER/conf/node.conf" ## Timesave file for non-RTC devices TIMESAVE="$PIRATEBOX_FOLDER/share/timesave_file" +#On non OpenWRT you can use the default output format +# as an input format. For OpenWrt you need to specify +%C%g%m%d%H%M +# The content is exchanged during makefile processing and image build +TIMESAVE_FORMAT="" + #Start droopy? - Enable upload? DROOPY_ENABLED="no" #Image-SRC diff --git a/piratebox/piratebox/init.d/piratebox b/piratebox/piratebox/init.d/piratebox index 4573221..f9634b9 100755 --- a/piratebox/piratebox/init.d/piratebox +++ b/piratebox/piratebox/init.d/piratebox @@ -162,8 +162,7 @@ case "$1" in DROOPY_USER=" -c $LIGHTTPD_USER:$LIGHTTPD_GROUP " fi log_daemon_msg "Starting droopy..." - start-stop-daemon $DROOPY_USER -m --start --background --pidfile $PIDFILE_DROOPY --exec $PIRATEBOX/bin/droopy -- -d "$UPLOADFOLDER" -m "$DROOPY_TXT" --chmod $DROOPY_CHMOD $DROOPY_USERDIR -$DROOPY_PORT + start-stop-daemon $DROOPY_USER -m --start --background --pidfile $PIDFILE_DROOPY --exec $PIRATEBOX/bin/droopy -- -d "$UPLOADFOLDER" -m "$DROOPY_TXT" --chmod $DROOPY_CHMOD $DROOPY_USERDIR $DROOPY_PORT log_end_msg $? fi