#!/usr/bin/haserl <% # write if [ "$REQUEST_METHOD" = "POST" ] ; then #check for valid hostname as specified in rfc 1123 #see http://stackoverflow.com/a/3824105 regex='^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])' regex=$regex'(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$' if [ "${#POST_hostname}" -ge "255" ] ; then MSG='Knotenname ist länger als 255 Zeichen!' elif ! echo -n "$POST_hostname" | egrep -q "$regex"; then MSG='Knotenname enthält ungültige Zeichen!' else # Allgemeine Einstellungen uci -q set "fff.system.hostname=${POST_hostname}" echo "$(uci -q get "fff.system.hostname")" > /proc/sys/kernel/hostname uci -q set "system.@system[0].hostname=${POST_hostname}" uci -q set "fff.system.description=${POST_description}" uci -q set "fff.system.latitude=${POST_latitude}" uci -q set "fff.system.longitude=${POST_longitude}" uci -q set "fff.system.position_comment=${POST_position_comment}" uci -q set "fff.system.contact=${POST_contact}" # Bitratenbegrenzung uci -q get "fff.trafficcontrol" > /dev/null || uci -q set fff.trafficcontrol=fff if [ "$POST_traffic_limit" = "on" ] ; then uci -q set "fff.trafficcontrol.enabled=1" uci -q set "simple-tc.example.enabled=1" else uci -q set "fff.trafficcontrol.enabled=0" uci -q set "simple-tc.example.enabled=0" fi uci -q set "fff.trafficcontrol.limit_in=${POST_limit_ingress}" uci -q set "fff.trafficcontrol.limit_out=${POST_limit_egress}" uci -q set "simple-tc.example.ifname=wan" uci -q set "simple-tc.example.limit_ingress=${POST_limit_ingress}" uci -q set "simple-tc.example.limit_egress=${POST_limit_egress}" # Restliche Einstellungen uci -q set "fff.notifyupdate=webui" if [ "$POST_upgrade_notification" = "on" ] ; then uci -q set "fff.notifyupdate.value=1" else uci -q set "fff.notifyupdate.value=0" rm -f /tmp/fwcheck rm -f /tmp/isupdate fi if uci -q get system.poe_passthrough > /dev/null ; then uci -q set "fff.poe_passthrough=fff" if [ "$POST_poe_passthrough" = "on" ] ; then uci -q set "fff.poe_passthrough.active=1" uci -q set "system.poe_passthrough.value=1" else uci -q set "fff.poe_passthrough.active=0" uci -q set "system.poe_passthrough.value=0" fi fi uci -q commit MSG='Daten gespeichert!' fi fi %> <%in /www/include/header %> <%in /www/include/helpers %> <% # read chkd='checked="checked" ' if [ "$(uci -q get 'fff.trafficcontrol.enabled')" = "1" ] ; then # not set=0 traffic_checked="$chkd" else traffic_checked="" fi if [ "$(uci -q get 'fff.notifyupdate.value')" = "0" ] ; then # not set=1 upgrade_checked="" else upgrade_checked="$chkd" fi %> <% show_msg %>
<%in /www/include/footer %>