tazpanel rev 107

network.cgi: Add static IP config
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 15 07:45:43 2011 +0200 (2011-04-15)
parents 21a86f36336d
children cab93136cc87
files network.cgi
line diff
     1.1 --- a/network.cgi	Fri Apr 15 06:37:45 2011 +0200
     1.2 +++ b/network.cgi	Fri Apr 15 07:45:43 2011 +0200
     1.3 @@ -89,12 +89,70 @@
     1.4  	*\ eth\ *)
     1.5  		# Wired connections settings
     1.6  		xhtml_header
     1.7 -		
     1.8 +		if [ "$(GET ip)" ]; then
     1.9 +			LOADING_MSG=$(gettext "Setting up static IP...")
    1.10 +			loading_msg
    1.11 +			sed -i \
    1.12 +				-e s"/^INTERFACE=.*/INTERFACE=\"$(GET iface)\""/ \
    1.13 +				-e s'/^DHCP=.*/DHCP="no"/' \
    1.14 +				-e s'/^WIFI=.*/WIFI="no"/' \
    1.15 +				-e s'/^STATIC=.*/STATIC="yes"/' \
    1.16 +				-e s"/^NETMASK=.*/NETMASK=\"$(GET netmask)\"/" \
    1.17 +				-e s"/^GATEWAY=.*/GATEWAY=\"$(GET gateway)\"/" \
    1.18 +				-e s"/^DNS_SERVER=.*/DNS_SERVER=\"$(GET dns)\"/" \
    1.19 +				-e s"/^IP=.*/IP=\"$(GET ip)\"/" /etc/network.conf
    1.20 +			/etc/init.d/network stop | log
    1.21 +			sleep 2
    1.22 +			/etc/init.d/network start | log
    1.23 +		fi
    1.24 +		. /etc/network.conf
    1.25  		cat << EOT
    1.26  <h2>`gettext "Ethernet connection`</h2>
    1.27 +
    1.28 +<h3>$(gettext "Setup a static IP")</h3>
    1.29 +<form method="get" action="$SCRIPT_NAME">
    1.30 +	<input type="hidden" name="eth" />
    1.31 +	$(table_start)
    1.32 +	<thead>
    1.33 +		<tr>
    1.34 +			<td>$(gettext "Name")</td>
    1.35 +			<td>$(gettext "Value")</td>
    1.36 +		</tr>
    1.37 +	</thead>
    1.38 +	<tr>
    1.39 +		<td>$(gettext "Interface")</td>
    1.40 +		<td><input type="text" name="iface" size="20" value="$INTERFACE" /></td>
    1.41 +	</tr>
    1.42 +	<tr>
    1.43 +		<td>$(gettext "IP address")</td>
    1.44 +		<td><input type="text" name="ip" size="20" value="$IP" /></td>
    1.45 +	</tr>
    1.46 +	<tr>
    1.47 +		<td>$(gettext "Netmask")</td>
    1.48 +		<td><input type="text" name="netmask" size="20" value="$NETMASK" /></td>
    1.49 +	</tr>
    1.50 +	<tr>
    1.51 +		<td>$(gettext "Gateway")</td>
    1.52 +		<td><input type="text" name="gateway" size="20" value="$GATEWAY" /></td>
    1.53 +	</tr>
    1.54 +	<tr>
    1.55 +		<td>$(gettext "DNS server")</td>
    1.56 +		<td><input type="text" name="dns" size="20" value="$DNS_SERVER" /></td>
    1.57 +	</tr>
    1.58 +	$(table_end)
    1.59 +		<input type="submit" value="`gettext "Activate"`">
    1.60 +</form>
    1.61 +
    1.62 +<h3>$(gettext "Configuration file")</h3>
    1.63 +<p>
    1.64 +$(gettext "These values are the ethernet settings in the main
    1.65 +/etc/network.conf configuration file")
    1.66 +</p>
    1.67  <pre>
    1.68 -`grep ^[A-V] /etc/network.conf`
    1.69 +$(grep ^[A-V] /etc/network.conf | syntax_highlighter conf)
    1.70  </pre>
    1.71 +<a class="button" href="index.cgi?file=/etc/network.conf&action=edit">
    1.72 +	<img src="$IMAGES/edit.png" />$(gettext "Manual Edit")</a>
    1.73  EOT
    1.74  		;;
    1.75  	*\ wifi\ *)
    1.76 @@ -117,7 +175,7 @@
    1.77  /etc/network.conf configuration file")
    1.78  </p>
    1.79  <pre>
    1.80 -$(grep ^WIFI_ /etc/network.conf | syntax_highlighter conf)
    1.81 +$(grep ^WIFI /etc/network.conf | syntax_highlighter conf)
    1.82  </pre>
    1.83  <a class="button" href="index.cgi?file=/etc/network.conf&action=edit">
    1.84  	<img src="$IMAGES/edit.png" />$(gettext "Manual Edit")</a>