Skip to content

Commit 03f0865

Browse files
committed
Merge branch 'timesave_fix' into development
2 parents fbb9205 + 0475efc commit 03f0865

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

piratebox_origin/piratebox/piratebox/bin/install_piratebox.sh

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,23 +153,14 @@ fi
153153

154154
set_Hostname() {
155155
local name=$1 ; shift;
156-
echo "
157-
<html>
158-
<head><title>Redirect...</title>
159-
<meta http-equiv='refresh' content='0;url=http://$1/' />
160-
<meta http-equiv='cache-control' content='no-cache'>
161-
</head>
162-
<body>
163-
Redirect
164-
</body>
165-
</html>" > $WWW_FOLDER/redirect.html
166156

157+
sed "s|#####HOST#####|$name|g" $PIRATEBOX_FOLDER/src/redirect.html.schema > $WWW_FOLDER/redirect.html
167158
sed "s|HOST=\"$HOST\"|HOST=\"$name\"|" -i $PIRATEBOX_CONFIG
168159
}
169160

170161
if [ $2 = "hostname" ] ; then
171162
echo "Switching hostname to $3"
172163
set_hostname "$3"
173164
echo "..done"
174-
fi
165+
fi
175166

piratebox_origin/piratebox/piratebox/bin/timesave.sh

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ fi
2727

2828
. $1
2929

30-
TIMESAVE="$PIRATEBOX_FOLDER/timesave_file"
3130

3231
if [ "$2" = "install" ] ; then
3332
crontab -l > $PIRATEBOX_FOLDER/tmp/crontab 2> /dev/null
@@ -38,19 +37,10 @@ if [ "$2" = "install" ] ; then
3837
touch $TIMESAVE
3938
chmod a+rw $TIMESAVE
4039

41-
if [ "$OPENWRT" = "yes" ] ; then
42-
echo "Placing Timerecover on Startup"
43-
echo " $0 $1 recover " >> /etc/rc.local
44-
sed 's:exit:#exit:g' -i /etc/rc.local
45-
echo "Activating cron-service.."
46-
/etc/init.d/cron enable
47-
/etc/init.d/cron start
48-
echo "done"
49-
else
50-
echo "Remember to have cron active..."
51-
echo " on OpenWrt run: /etc/init.d/cron enable"
52-
echo " /etc/init.d/cron start"
53-
fi
40+
echo "Remember to have cron active..."
41+
echo " on OpenWrt run: /etc/init.d/cron enable"
42+
echo " /etc/init.d/cron start"
43+
5444
#Save the current time
5545
$0 $1 "save"
5646
exit 0
@@ -70,9 +60,14 @@ if [ "$2" = "save" ] ; then
7060
fi
7161

7262
if [ "$2" = "recover" ] ; then
73-
date `cat $TIMESAVE `
74-
[ "$?" != "0" ] && echo "error in recovering time" && exit 255
75-
echo "Time recovered"
76-
exit 0
63+
if [ `date +%C%g%m%d%H%M` -lt `cat $TIMESAVE` ] ;
64+
date `cat $TIMESAVE `
65+
[ "$?" != "0" ] && echo "error in recovering time" && exit 255
66+
echo "Time recovered"
67+
exit 0
68+
else
69+
echo "Sorry, changing timebackward via timesave is not possible"
70+
exit 1
71+
fi
7772
fi
7873

piratebox_origin/piratebox/piratebox/conf/piratebox.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
## 2012-06-08 Changed IP Stuff to generating dnsmasq.conf stuff
88
## ADDed SubConfig for IPV6 config
99
## Changed Order of config
10+
## 2013-08-14 Added timesave url
1011
##
1112
########
1213

@@ -110,6 +111,8 @@ IP=$NET.$IP_SHORT
110111
#----------------- Configuration for the pure piratebox -------------------#
111112
## droopy, webserver, shoutbox- and forum-server
112113

114+
## Timesave file for non RTC devices
115+
TIMESAVE="$PIRATEBOX_FOLDER/share/timesave_file"
113116

114117
#Start droopy? - Enable upload?
115118
DROOPY_ENABLED="yes"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<html>
2+
<head><title>Redirect...</title>
3+
<meta http-equiv='refresh' content='0;url=http://#####HOST#####/' />
4+
<meta http-equiv='cache-control' content='no-cache'>
5+
</head>
6+
<body>
7+
Redirect
8+
</body>
9+
</html>
10+
11+

0 commit comments

Comments
 (0)