# HG changeset patch
# User Christophe Lincoln
# Date 1302846343 -7200
# Node ID 306b0bf62bb88e8c335db136011519bfc4764a1a
# Parent 21a86f36336d4c79097cb1aaddafff38a32ca8fc
network.cgi: Add static IP config
diff -r 21a86f36336d -r 306b0bf62bb8 network.cgi
--- a/network.cgi Fri Apr 15 06:37:45 2011 +0200
+++ b/network.cgi Fri Apr 15 07:45:43 2011 +0200
@@ -89,12 +89,70 @@
*\ eth\ *)
# Wired connections settings
xhtml_header
-
+ if [ "$(GET ip)" ]; then
+ LOADING_MSG=$(gettext "Setting up static IP...")
+ loading_msg
+ sed -i \
+ -e s"/^INTERFACE=.*/INTERFACE=\"$(GET iface)\""/ \
+ -e s'/^DHCP=.*/DHCP="no"/' \
+ -e s'/^WIFI=.*/WIFI="no"/' \
+ -e s'/^STATIC=.*/STATIC="yes"/' \
+ -e s"/^NETMASK=.*/NETMASK=\"$(GET netmask)\"/" \
+ -e s"/^GATEWAY=.*/GATEWAY=\"$(GET gateway)\"/" \
+ -e s"/^DNS_SERVER=.*/DNS_SERVER=\"$(GET dns)\"/" \
+ -e s"/^IP=.*/IP=\"$(GET ip)\"/" /etc/network.conf
+ /etc/init.d/network stop | log
+ sleep 2
+ /etc/init.d/network start | log
+ fi
+ . /etc/network.conf
cat << EOT
`gettext "Ethernet connection`
+
+$(gettext "Setup a static IP")
+
+
+$(gettext "Configuration file")
+
+$(gettext "These values are the ethernet settings in the main
+/etc/network.conf configuration file")
+
-`grep ^[A-V] /etc/network.conf`
+$(grep ^[A-V] /etc/network.conf | syntax_highlighter conf)
+
+ $(gettext "Manual Edit")
EOT
;;
*\ wifi\ *)
@@ -117,7 +175,7 @@
/etc/network.conf configuration file")
-$(grep ^WIFI_ /etc/network.conf | syntax_highlighter conf)
+$(grep ^WIFI /etc/network.conf | syntax_highlighter conf)
$(gettext "Manual Edit")