exec 2>/tmp/www.log."$(basename $SCRIPT_NAME)" set -x fail() { code=${1:-420} reason=${2:-'Unknown reason'} echo -e "Status: $code\r \r $reason" exit 1 } read_uci() { local val read val if [ "$val" == "uci: Entry not found" ]; then val='' fi read $1 </dev/null 2>/tmp/www.lazy."$(basename $SCRIPT_NAME)" & } ## some tests have_internet() { if [ -z "$have_internet_cached_result" ]; then local mode=$(cat /tmp/fsm/inetable || echo boot) if [ "$mode" == drone -o "$mode" == queen -o "$mode" == ghost ]; then have_internet_cached_result=true else have_internet_cached_result=false fi fi $have_internet_cached_result } is_wired() { if [ -z "$is_wired_cached_result" ]; then [ -n "$REMOTE_HOST" ] local iface=$(grep ^$REMOTE_HOST