# HG changeset patch # User Christophe Lincoln # Date 1302850290 -7200 # Node ID cab93136cc8759856ec5b599faac87e15d08a047 # Parent 306b0bf62bb88e8c335db136011519bfc4764a1a network.cgi: randow fixes (start-stop wifi) and improvment diff -r 306b0bf62bb8 -r cab93136cc87 network.cgi --- a/network.cgi Fri Apr 15 07:45:43 2011 +0200 +++ b/network.cgi Fri Apr 15 08:51:30 2011 +0200 @@ -5,7 +5,6 @@ # Common functions from libtazpanel . lib/libtazpanel -. /etc/network.conf get_config header @@ -53,15 +52,15 @@ fi # Connected or not connected... if ifconfig | grep -A 1 $WIFI_INTERFACE | \ - grep -q inet && iwconfig $WIFI_INTERFACE | \ - grep ESSID | grep -q -w "$ESSID"; then - STATUS=$(gettext "Connected") + fgrep -q inet && iwconfig $WIFI_INTERFACE | \ + grep ESSID | fgrep -q -w "$ESSID"; then + status=$(gettext "Connected") else - STATUS="-" + status="---" fi echo '' echo "$ESSID" - echo "$QUALITY$ENCRYPTION$STATUS" + echo "$QUALITY$ENCRYPTION$status $ip" echo '' done fi @@ -77,10 +76,20 @@ sleep 2 ;; *\ stop\ *) /etc/init.d/network.sh stop | log ;; - *) - continue ;; + *\ start-wifi\ *) + sed -i \ + -e s'/^DHCP=.*/DHCP="yes"/' \ + -e s'/^WIFI=.*/WIFI="yes"/' \ + -e s'/^STATIC=.*/STATIC="no"/'/etc/network.conf + /etc/init.d/network.sh start | log + sleep 2 ;; + *\ hostname\ *) + echo $(gettext "Changed hostname:") $(GET hostname) | log + echo "$(GET hostname)" > /etc/hostname ;; esac +. /etc/network.conf + # # Main Commands for pages # @@ -163,6 +172,10 @@ cat << EOT

`gettext "Wireless connection`

+ + $(gettext "Start") + + $(gettext "Stop") $(gettext "Scan")
@@ -189,6 +202,7 @@ *) # Main Network page starting with a summary xhtml_header + hostname=$(cat /etc/hostname) cat << EOT

`gettext "Networking`

@@ -197,17 +211,35 @@

- `gettext "Configuration file:"` + `gettext "Configuration:"` network.conf + Ethernet + Wireless
$(list_network_interfaces) +

$(gettext "Hosts")

+
+$(cat /etc/hosts)
+
+ + $(gettext "Edit hosts") + +

$(gettext "Hostname")

+
+ + +

$(gettext "Output of ") ifconfig

 $(ifconfig)