slitaz-tools rev 726
netbox: PPPoE fixes
author | Dominique Corbex <domcox@slitaz.org> |
---|---|
date | Wed Mar 28 08:00:59 2012 +0200 (2012-03-28) |
parents | 29fe613b2eb6 |
children | 6e8c38a0aee3 |
files | tinyutils/netbox |
line diff
1.1 --- a/tinyutils/netbox Sat Mar 24 17:18:26 2012 +0000 1.2 +++ b/tinyutils/netbox Wed Mar 28 08:00:59 2012 +0200 1.3 @@ -434,7 +434,7 @@ 1.4 } 1.5 1.6 # 1.7 -# PPPoe settings. 1.8 +# PPPoE settings. 1.9 # 1.10 tab_pppoe() 1.11 { 1.12 @@ -442,19 +442,11 @@ 1.13 <frame PPPoE> 1.14 <hbox> 1.15 <text use-markup="true"> 1.16 - <label>"<b>Name: </b>"</label> 1.17 - </text> 1.18 - <entry> 1.19 - <input>NAME=\$(grep -s ^name /etc/ppp/options); echo "\${NAME#* }"</input> 1.20 - <variable>NAME</variable> 1.21 - </entry> 1.22 - </hbox> 1.23 - <hbox> 1.24 - <text use-markup="true"> 1.25 <label>"<b>Username:</b>"</label> 1.26 </text> 1.27 <entry> 1.28 - <variable>USER</variable> 1.29 + <input>PPoE_ID=\$(grep -s ^name /etc/ppp/options); echo "\${PPoE_ID#* }"</input> 1.30 + <variable>PPoE_ID</variable> 1.31 </entry> 1.32 </hbox> 1.33 <hbox> 1.34 @@ -462,7 +454,10 @@ 1.35 <label>"<b>Password:</b>"</label> 1.36 </text> 1.37 <entry> 1.38 - <variable>PASS</variable> 1.39 + <input>PPoE_PASS=\$(ID=\$(awk '/^name/{print \$2}' /etc/ppp/options) ; \ 1.40 + awk -v KEY="\$ID" '\$1==KEY{print \$3}' /etc/ppp/pap-secrets); \ 1.41 + echo "\$PPoE_PASS"</input> 1.42 + <variable>PPoE_PASS</variable> 1.43 </entry> 1.44 </hbox> 1.45 <hbox> 1.46 @@ -472,26 +467,26 @@ 1.47 <button> 1.48 <input file icon="accessories-text-editor"></input> 1.49 <label>Tune</label> 1.50 - <action>[ -n "\$NAME" ] && sed -i \"s/^name .*/name \$NAME/\" /etc/ppp/options</action> 1.51 + <action>[ -n "\$PPoE_ID" ] && sed -i 's/^name .*/name \$PPoE_ID/' /etc/ppp/options</action> 1.52 <action type="lauch">leafpad /etc/ppp/options</action> 1.53 </button> 1.54 <button> 1.55 <label>Start</label> 1.56 <input file icon="forward"></input> 1.57 - <action>[ -n "\$USER" ] && grep -qs "^\"\$USER\"" /etc/ppp/pap-secrets 1.58 - && echo "\"\$USER\" * \"\$PASS\"" >> /etc/ppp/pap-secrets</action> 1.59 - <action>[ -n "\$USER" ] && grep -qs "^\"\$USER\"" /etc/ppp/chap-secrets 1.60 - && echo "\"\$USER\" * \"\$PASS\"" >> /etc/ppp/chap-secrets</action> 1.61 - <action>[ -n "\$NAME" ] && sed -i \"s/^name .*/name \$NAME/\" /etc/ppp/options</action> 1.62 + <action>[ -n "\$PPoE_ID" ] && grep -qs "^\$PPoE_ID" /etc/ppp/pap-secrets \ 1.63 + || echo "\$PPoE_ID * \$PPoE_PASS" >> /etc/ppp/pap-secrets</action> 1.64 + <action>[ -n "\$PPoE_ID" ] && grep -qs "^\$PPoE_ID" /etc/ppp/chap-secrets \ 1.65 + || echo "\$PPoE_ID * \$PPoE_PASS" >> /etc/ppp/chap-secrets</action> 1.66 + <action>[ -n "\$PPoE_ID" ] && sed -i "s/^name .*/name \$PPoE_ID/" /etc/ppp/options</action> 1.67 <action>killall udhcpc</action> 1.68 - <action>sed -i s/DHCP=.*/DHCP=\"no\"/ /etc/network.conf</action> 1.69 - <action>sed -i s/PPPOE=.*/PPPOE=\"yes\"/ /etc/network.conf</action> 1.70 - <action>pppd \$INTERFACE &</action> 1.71 + <action>sed -i 's/DHCP=.*/DHCP="no"/' /etc/network.conf</action> 1.72 + <action>sed -i 's/PPPOE=.*/PPPOE="yes"/' /etc/network.conf</action> 1.73 + <action>. /etc/network.conf ; pppd \$INTERFACE &</action> 1.74 </button> 1.75 <button> 1.76 <label>Stop</label> 1.77 <input file icon="stop"></input> 1.78 - <action>sed -i s/PPPOE=.*/PPPOE=\"no\"/ /etc/network.conf</action> 1.79 + <action>sed -i 's/PPPOE=.*/PPPOE="no"/' /etc/network.conf</action> 1.80 <action>killall pppd</action> 1.81 </button> 1.82 </hbox>