#!/bin/sh
export DATE="18.11.2006";SCRIPT=${0#/rom}
export TITLE="Admin: Restart"
. ${SCRIPT%/*}/cgi-bin-pre.sh
cat<Admin: Restart
EOF
if [ "$REQUEST_METHOD" = "POST" ]; then
read QUERY_STRING
fi
if [ -z "$QUERY_STRING" ]; then
ff_firmware=
if ! grep -q ff_reset /rom/etc/preinit /etc/preinit>/dev/null 2>&1; then
ff_firmware='" DISABLED="DISABLED'
fi
cat<
EOF
if [ "$(nvram get boot_wait)" != "on" ]; then
cat<Please note: The boot_wait
config setting has an actual value of "$(nvram get boot_wait)".
To open up the possibility to upload a new firmware via TFTP, the restart
will change this setting to "on".
EOF
fi
if [ -n "$ff_firmware" ]; then
cat<Attention:
The extended restart options are active with the Freifunk firmware only.
EOF
fi
else
IFS=\&;set ${QUERY_STRING%%[^%&=+-:@-_a-z~]*};unset IFS;eval $*
DIRTY=
if [ -n "$post_reset" ]; then
if [ "$ff_reset" = "killnvram" ]; then
if [ '"nvram"' = "$(grep mtd3: /proc/mtd|if read line; then set $line;echo $4;fi)" ]; then
mtd erase /dev/mtd/3
fi
else
for V in ff_reset boot_wait; do
eval "C=\$$V"
C=$(unescape $C)
if [ "$C" != "$(nvram get $V)" ]; then
DIRTY=1
nvram set $V="$C"
fi
done
test -n "$DIRTY" && nvram commit>/dev/null 2>&1
fi
cat<
| The device restarts
now. Please wait... |
EOF
if [ "$ff_reset" = "failsafe" ]; then
cat<
Tip:
In failsafe mode, the IP address of the device is always 192.168.1.1.
While you wait for the device to come up again, the network card can be
configured to the appropriate IP address, for example to 192.168.1.2.
EOF
elif [ "$ff_reset" = "format" ] || [ "$ff_reset" = "killnvram" ]; then
cat<
EOF
else
cat<
EOF
fi
sh -c "sleep 2;reboot">/dev/null 2>&1 &
fi
fi
. ${SCRIPT%/*}/cgi-bin-post.sh