#!/bin/sh # This serves a rudimentary webpage based on wz_mini.conf . /opt/wz_mini/www/cgi-bin/shared.cgi title="$camver on $camfirmware running wz_mini $hackver as $HOSTNAME" updated=false echo "HTTP/1.1 200" echo -e "Content-type: text/html\n\n" echo "" die_no_config() { if [ -f ${hack_ini} ] then if [ -s ${hack_ini} ] then echo "$hack_ini exists and not empty" else echo "$hack_ini exists but empty" echo "if you reboot then the hack will fail " exit fi else echo "$hack_ini file does not exist" echo "if you reboot then the hack will fail. Please insure you have a wz_hack.conf file.." exit fi } reboot_camera() { die_no_config reboot_wait=90 echo "rebooting camera (refreshing screen in $reboot_wait seconds)" echo '' handle_css config.css version_info "display_BAR" reboot exit } shft() { # SE loop did not work -- thanks ash! suff=8 while [ "$suff" -gt 0 ] ; do if [[ -f "$1.$suff" ]] ; then nxt=$((suff + 1)) mv -f "$1.$suff" "$1.$nxt" fi suff=$((suff-1)) done mv -f "$1" "$1.1" } function revert_config { mv "$hack_ini" "$hack_ini.old" mv "$hack_ini.$1" "$hack_ini" } function revert_menu { echo '
'
cat "$web_dir$1.md"
printf '