#!/bin/sh PATH=/bin:/usr/bin:/sbin:/usr/sbin . /usr/lib/libmodcgi.sh eval "$(modcgi branding:pkg:cmd mod_cgi)" case "$MOD_CGI_CMD" in start|stop|restart) if [ ! -x "/mod/etc/init.d/rc.$MOD_CGI_PKG" ]; then cgi_begin '$(lang de:"Fehler" en:"Error")' echo "
$(lang de:"Fehler" en:"Error"): $(lang de:"Kein Skript für" en:"no script for") '$MOD_CGI_PKG'
" cgi_end exit 1 fi ;; esac case "$MOD_CGI_CMD" in branding) cgi_begin '$(lang de:"Branding ändern" en:"Change branding")...' echo '$(lang de:"Um die Änderungen wirksam zu machen, ist ein Neustart erforderlich." en:"You must reboot the device for the changes to take effect.")
' echo -n 'set branding to '"'$MOD_CGI_BRANDING'"'...' success=0 for i in $(ls /usr/www/); do case "$i" in all|cgi-bin|html) ;; *) if [ "$i" = "$MOD_CGI_BRANDING" ]; then echo "firmware_version $i" > /proc/avalanche/env success=1 fi ;; esac done if [ "$success" -eq 1 ]; then echo 'done.' else echo 'failed.' fi echo '' cgi_end ;; cleanup) cgi_begin '$(lang de:"Defragmentiere" en:"Cleanup tffs")...' echo -n '
tffs cleanup...' echo 'cleanup' > /proc/tffs echo 'done.' echo '' cgi_end ;; downgrade) cgi_begin 'Downgrade mod...' echo '
$(lang de:"Downgrade mod von supamicha" en:"Downgrade mod by supamicha"):
$(lang de:"Ändert die Firmware Version bis zum nächsten Neustart auf xx.01.01" en:"Changes the firmware version to xx.01.01 until next reboot")
Downgrading...' if [ -e "/var/tmp/version" ]; then echo 'already done.' else sed 's/{CONFIG_VERSION_MAJOR}.*/{CONFIG_VERSION_MAJOR}.01.01/1' /etc/version > /var/tmp/version chmod +x /var/tmp/version mount -o bind /var/tmp/version /etc/version echo 'done.' fi echo '' cgi_end ;; reboot) cgi_begin '$(lang de:"Neustart" en:"Reboot")...' echo '
$(lang de:"Starte neu" en:"Rebooting")...
' echo '$(lang de:"Nach dem Neustart hier wieder einloggen." en:"Login here after reboot.")
' cgi_end reboot ;; start) cgi_begin "$(lang de:"Starte" en:"Starting") $MOD_CGI_PKG..." echo "$(lang de:"Starte" en:"Starting") $MOD_CGI_PKG:
" echo -n '' /mod/etc/init.d/rc.$MOD_CGI_PKG start echo '' echo '' cgi_end ;; stop) cgi_begin "$(lang de:"Stoppe" en:"Stopping") $MOD_CGI_PKG..." echo "
$(lang de:"Stoppe" en:"Stopping") $MOD_CGI_PKG:
" echo -n '' /mod/etc/init.d/rc.$MOD_CGI_PKG stop echo '' echo '' cgi_end ;; restart) cgi_begin "$(lang de:"Starte $MOD_CGI_PKG neu" en:"Restarting $MOD_CGI_PKG")..." echo "
$(lang de:"Starte $MOD_CGI_PKG neu" en:"Restarting $MOD_CGI_PKG"):
" echo -n '' /mod/etc/init.d/rc.$MOD_CGI_PKG restart echo '' echo '' cgi_end ;; *) cgi_begin '$(lang de:"Fehler" en:"Error")' echo "
$(lang de:"Fehler" en:"Error"): $(lang de:"Unbekannter Befehl" en:"unknown command") '$MOD_CGI_CMD'
" cgi_end ;; esac