slitaz-tools rev 717

netbox: fix PPP modem dialup
author Dominique Corbex <domcox@slitaz.org>
date Fri Mar 23 23:16:17 2012 +0100 (2012-03-23)
parents ed15185975c2
children cf1463ea7005
files tinyutils/netbox
line diff
     1.1 --- a/tinyutils/netbox	Tue Mar 20 23:36:16 2012 +0200
     1.2 +++ b/tinyutils/netbox	Fri Mar 23 23:16:17 2012 +0100
     1.3 @@ -511,8 +511,8 @@
     1.4  			<label>"<b>Username: </b>"</label>
     1.5  		</text>
     1.6  		<entry>
     1.7 -			<input>USER=\$(grep -s ^ACCOUNT= /etc/ppp/scripts/ppp-on | cut -f1); echo "\${USER#*=}"</input>
     1.8 -			<variable>USER</variable>
     1.9 +			<input>NAME=\$(grep -s ^ACCOUNT= /etc/ppp/scripts/ppp-on | cut -f1); echo "\${NAME#*=}"</input>
    1.10 +			<variable>NAME</variable>
    1.11  		</entry>
    1.12  	</hbox>
    1.13  	<hbox>
    1.14 @@ -540,19 +540,19 @@
    1.15  		<button>
    1.16  			<input file icon="accessories-text-editor"></input>
    1.17  			<label>Tune</label>
    1.18 -			<action>[ -n "\$NAME" ] && sed -i \"s/^ACCOUNT=.*/ACCOUNT=\$NAME/\" /etc/ppp/scripts/ppp-on</action>
    1.19 -			<action>[ -n "\$PASS" ] && sed -i \"s/^PASSWORD=.*/PASSWORD=\$PASS/\" /etc/ppp/scripts/ppp-on</action>
    1.20 -			<action>[ -n "\$PHONE" ] && sed -i \"s/^TELEPHONE=.*/TELEPHONE=\$PHONE/\" /etc/ppp/scripts/ppp-on</action>
    1.21 +			<action>[ -n "\$NAME" ] && sed -i "s/^ACCOUNT=.*/ACCOUNT=\$NAME/" /etc/ppp/scripts/ppp-on</action>
    1.22 +			<action>[ -n "\$PASS" ] && sed -i "s/^PASSWORD=.*/PASSWORD=\$PASS/" /etc/ppp/scripts/ppp-on</action>
    1.23 +			<action>[ -n "\$PHONE" ] && sed -i "s/^TELEPHONE=.*/TELEPHONE=\$PHONE/" /etc/ppp/scripts/ppp-on</action>
    1.24  			<action type="lauch">leafpad /etc/ppp/scripts/ppp-on</action>
    1.25  		</button>
    1.26  		<button>
    1.27  			<label>Start</label>
    1.28  			<input file icon="forward"></input>
    1.29 -			<action>[ -n "\$USER" ] && grep -qs "^\"\$USER\"" /etc/ppp/pap-secrets
    1.30 -			&& echo "\"\$USER\"	*	\"\$PASS\"" >> /etc/ppp/pap-secrets</action>
    1.31 -			<action>[ -n "\$USER" ] && grep -qs "^\"\$USER\"" /etc/ppp/chap-secrets
    1.32 -			&& echo "\"\$USER\"	*	\"\$PASS\"" >> /etc/ppp/chap-secrets</action>
    1.33 -			<action>[ -n "\$NAME" ] && sed -i \"s/^name .*/name \$NAME/\" /etc/ppp/options</action>
    1.34 +			<action>[ -n "\$NAME" ] && grep -qs "^\$NAME" /etc/ppp/pap-secrets \
    1.35 +				|| echo "\$NAME	*	\$PASS" >> /etc/ppp/pap-secrets</action>
    1.36 +			<action>[ -n "\$NAME" ] && grep -qs "^\$NAME" /etc/ppp/chap-secrets \
    1.37 +				|| echo "\$NAME	*	\$PASS" >> /etc/ppp/chap-secrets</action>
    1.38 +			<action>[ -n "\$NAME" ] && sed -i "s/^name .*/name \$NAME/" /etc/ppp/options</action>
    1.39  			<action>/etc/ppp/scripts/ppp-off</action>
    1.40  			<action>/etc/ppp/scripts/ppp-on &</action>
    1.41  		</button>