forked from freifunk-franken/firmware
37 lines
638 B
Plaintext
37 lines
638 B
Plaintext
|
#!/usr/bin/haserl --upload-dir=/tmp --upload-limit=12000
|
||
|
<%
|
||
|
echo -en "content-type: text/plain\r\n\r\n"
|
||
|
|
||
|
case "${GET_func:-$POST_func}" in
|
||
|
apply_firmware)
|
||
|
path="$POST_firmware"
|
||
|
keep="$POST_keep_config"
|
||
|
|
||
|
if [ ! -f "$path" ]; then
|
||
|
echo "(E) Datei nicht gefunden."
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [ "$keep" = "yes" ]; then
|
||
|
args=""
|
||
|
else
|
||
|
args="-n"
|
||
|
fi
|
||
|
|
||
|
echo "(I) Starte sysupgrade..."
|
||
|
|
||
|
#apply openwrt or vendor image
|
||
|
sysupgrade $args $path
|
||
|
;;
|
||
|
restore_firmware)
|
||
|
echo "(I) Undo all changes ..."
|
||
|
echo y | firstboot
|
||
|
echo "(I) Rebooting now ..."
|
||
|
reboot
|
||
|
;;
|
||
|
*)
|
||
|
echo "(E) upgrade: Invalid command: '$GET_func'"
|
||
|
;;
|
||
|
esac
|
||
|
%>
|