slitaz-tools rev 545

netbox: Feature #454
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Feb 07 10:19:33 2011 +0100 (2011-02-07)
parents 3ae563bafeab
children 7fdb586cf6bf
files tinyutils/netbox
line diff
     1.1 --- a/tinyutils/netbox	Sun Jan 30 23:38:50 2011 +0000
     1.2 +++ b/tinyutils/netbox	Mon Feb 07 10:19:33 2011 +0100
     1.3 @@ -335,9 +335,9 @@
     1.4  		<button>
     1.5  			<label>Start</label>
     1.6  			<input file icon="forward"></input>
     1.7 -			<action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE="\$INTERFACE"/ /etc/network.conf</action>
     1.8 -			<action>sed -i s/DHCP="no"/DHCP="yes"/ /etc/network.conf</action>
     1.9 -			<action>sed -i s/STATIC="yes"/STATIC="no"/ /etc/network.conf</action>
    1.10 +			<action>sed -i s/^INTERFACE=.*/INTERFACE=\"\$INTERFACE\"/ /etc/network.conf</action>
    1.11 +			<action>sed -i s/^DHCP=.*/DHCP=\"yes\"/ /etc/network.conf</action>
    1.12 +			<action>sed -i s/^STATIC=.*/STATIC=\"no\"/ /etc/network.conf</action>
    1.13  			<action>udhcpc \$UDHCPC_OPTS -i \$INTERFACE -p /var/run/udhcpc.\$INTERFACE.pid</action>
    1.14  			<action>refresh:INTERFACE_LIST</action>
    1.15  		</button>
    1.16 @@ -412,14 +412,14 @@
    1.17  			<input file icon="forward"></input>
    1.18  			<action>ifconfig lo down</action>
    1.19  			<action>ifconfig \$INTERFACE down</action>
    1.20 -			<action>sed -i s/`cat /etc/network.conf | grep ^INTERFACE=`/INTERFACE="\$INTERFACE"/ /etc/network.conf</action>
    1.21 -			<action>sed -i s/DHCP="yes"/DHCP="no"/ /etc/network.conf</action>
    1.22 -			<action>sed -i s/WIFI="yes"/WIFI="no"/ /etc/network.conf</action>
    1.23 -			<action>sed -i s/STATIC="no"/STATIC="yes"/ /etc/network.conf</action>
    1.24 -			<action>sed -i s/`cat /etc/network.conf | grep ^IP=`/IP="\$IP"/ /etc/network.conf</action>
    1.25 -			<action>sed -i s/`cat /etc/network.conf | grep ^NETMASK=`/NETMASK="\$NETMASK"/ /etc/network.conf</action>
    1.26 -			<action>sed -i s/`cat /etc/network.conf | grep ^GATEWAY=`/GATEWAY="\$GATEWAY"/ /etc/network.conf</action>
    1.27 -			<action>sed -i s/`cat /etc/network.conf | grep ^DNS_SERVER=`/DNS_SERVER="\$DNS_SERVER"/ /etc/network.conf</action>
    1.28 +			<action>sed -i s/^INTERFACE=.*/INTERFACE=\"\$INTERFACE\"/ /etc/network.conf</action>
    1.29 +			<action>sed -i s/^DHCP=.*/DHCP=\"no\"/ /etc/network.conf</action>
    1.30 +			<action>sed -i s/^WIFI=.*/WIFI=\"no\"/ /etc/network.conf</action>
    1.31 +			<action>sed -i s/^STATIC=.*/STATIC=\"yes\"/ /etc/network.conf</action>
    1.32 +			<action>sed -i s/^IP=.*/IP=\"\$IP\"/ /etc/network.conf</action>
    1.33 +			<action>sed -i s/^NETMASK=.*/NETMASK=\"\$NETMASK\"/ /etc/network.conf</action>
    1.34 +			<action>sed -i s/^GATEWAY=.*/GATEWAY=\"\$GATEWAY\"/ /etc/network.conf</action>
    1.35 +			<action>sed -i s/^DNS_SERVER=.*/DNS_SERVER=\"\$DNS_SERVER\"/ /etc/network.conf</action>
    1.36  			<action>/etc/init.d/network.sh</action>
    1.37  			<action>refresh:INTERFACE_LIST</action>
    1.38  		</button>
    1.39 @@ -473,7 +473,7 @@
    1.40  		<button>
    1.41  			<input file icon="accessories-text-editor"></input>
    1.42  			<label>Tune</label>
    1.43 -			<action>[ -n "\$NAME" ] && sed -i "s/^name .*/name \$NAME/" /etc/ppp/options</action>
    1.44 +			<action>[ -n "\$NAME" ] && sed -i \"s/^name .*/name \$NAME/\" /etc/ppp/options</action>
    1.45  			<action type="lauch">leafpad /etc/ppp/options</action>
    1.46  		</button>
    1.47  		<button>
    1.48 @@ -483,16 +483,16 @@
    1.49  			&& echo "\"\$USER\"	*	\"\$PASS\"" >> /etc/ppp/pap-secrets</action>
    1.50  			<action>[ -n "\$USER" ] && grep -qs "^\"\$USER\"" /etc/ppp/chap-secrets
    1.51  			&& echo "\"\$USER\"	*	\"\$PASS\"" >> /etc/ppp/chap-secrets</action>
    1.52 -			<action>[ -n "\$NAME" ] && sed -i "s/^name .*/name \$NAME/" /etc/ppp/options</action>
    1.53 +			<action>[ -n "\$NAME" ] && sed -i \"s/^name .*/name \$NAME/\" /etc/ppp/options</action>
    1.54  			<action>killall udhcpc</action>
    1.55 -			<action>sed -i "s/DHCP=\"yes\"/DHCP=\"no\"/" /etc/network.conf</action>
    1.56 -			<action>sed -i "s/PPPOE=\"no\"/PPPOE=\"yes\"/" /etc/network.conf</action>
    1.57 +			<action>sed -i s/DHCP=.*/DHCP=\"no\"/ /etc/network.conf</action>
    1.58 +			<action>sed -i s/PPPOE=.*/PPPOE=\"yes\"/ /etc/network.conf</action>
    1.59  			<action>pppd \$INTERFACE &</action>
    1.60  		</button>
    1.61  		<button>
    1.62  			<label>Stop</label>
    1.63  			<input file icon="stop"></input>
    1.64 -			<action>sed -i "s/PPPOE=\"yes\"/PPPOE=\"no\"/" /etc/network.conf</action>
    1.65 +			<action>sed -i s/PPPOE=.*/PPPOE=\"no\"/ /etc/network.conf</action>
    1.66  			<action>killall pppd</action>
    1.67  		</button>
    1.68  	</hbox>
    1.69 @@ -541,9 +541,9 @@
    1.70  		<button>
    1.71  			<input file icon="accessories-text-editor"></input>
    1.72  			<label>Tune</label>
    1.73 -			<action>[ -n "\$NAME" ] && sed -i "s/^ACCOUNT=.*/ACCOUNT=\$NAME/" /etc/ppp/scripts/ppp-on</action>
    1.74 -			<action>[ -n "\$PASS" ] && sed -i "s/^PASSWORD=.*/PASSWORD=\$PASS/" /etc/ppp/scripts/ppp-on</action>
    1.75 -			<action>[ -n "\$PHONE" ] && sed -i "s/^TELEPHONE=.*/TELEPHONE=\$PHONE/" /etc/ppp/scripts/ppp-on</action>
    1.76 +			<action>[ -n "\$NAME" ] && sed -i \"s/^ACCOUNT=.*/ACCOUNT=\$NAME/\" /etc/ppp/scripts/ppp-on</action>
    1.77 +			<action>[ -n "\$PASS" ] && sed -i \"s/^PASSWORD=.*/PASSWORD=\$PASS/\" /etc/ppp/scripts/ppp-on</action>
    1.78 +			<action>[ -n "\$PHONE" ] && sed -i \"s/^TELEPHONE=.*/TELEPHONE=\$PHONE/\" /etc/ppp/scripts/ppp-on</action>
    1.79  			<action type="lauch">leafpad /etc/ppp/scripts/ppp-on</action>
    1.80  		</button>
    1.81  		<button>
    1.82 @@ -553,7 +553,7 @@
    1.83  			&& echo "\"\$USER\"	*	\"\$PASS\"" >> /etc/ppp/pap-secrets</action>
    1.84  			<action>[ -n "\$USER" ] && grep -qs "^\"\$USER\"" /etc/ppp/chap-secrets
    1.85  			&& echo "\"\$USER\"	*	\"\$PASS\"" >> /etc/ppp/chap-secrets</action>
    1.86 -			<action>[ -n "\$NAME" ] && sed -i "s/^name .*/name \$NAME/" /etc/ppp/options</action>
    1.87 +			<action>[ -n "\$NAME" ] && sed -i \"s/^name .*/name \$NAME/\" /etc/ppp/options</action>
    1.88  			<action>/etc/ppp/scripts/ppp-off</action>
    1.89  			<action>/etc/ppp/scripts/ppp-on &</action>
    1.90  		</button>