slitaz-tools rev 217

netbox: add ppp
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jun 23 20:29:13 2008 +0000 (2008-06-23)
parents 939d1e5cfa3d
children 8d3e82b76796
files tinyutils/netbox
line diff
     1.1 --- a/tinyutils/netbox	Mon Jun 23 16:54:39 2008 +0000
     1.2 +++ b/tinyutils/netbox	Mon Jun 23 20:29:13 2008 +0000
     1.3 @@ -203,7 +203,7 @@
     1.4        </hbox>
     1.5      </frame>
     1.6  
     1.7 -    <notebook labels="DHCP|PPPoE|Static IP'
     1.8 +    <notebook labels="DHCP|PPPoE|PPP|Static IP'
     1.9  [ -x /usr/sbin/iwconfig ] && NET_BOX="$NET_BOX|Wifi"
    1.10  NET_BOX="$NET_BOX|System wide|VPN|Servers"
    1.11  [ -x /sbin/iptables ] && NET_BOX="$NET_BOX|Firewall"
    1.12 @@ -265,7 +265,7 @@
    1.13            <label>"<b>Password :</b>"</label>
    1.14          </text>
    1.15          <entry>
    1.16 -          <variable>USER</variable>
    1.17 +          <variable>PASS</variable>
    1.18          </entry>
    1.19        </hbox>
    1.20        <hbox>
    1.21 @@ -297,6 +297,62 @@
    1.22        </hbox>
    1.23      </frame>
    1.24  
    1.25 +    <frame PPP>
    1.26 +      <hbox>
    1.27 +        <text use-markup="true">
    1.28 +          <label>"<b>Username :</b>"</label>
    1.29 +        </text>
    1.30 +        <entry>
    1.31 +	  <input>USER=$(grep -s ^ACCOUNT= /etc/ppp/scripts/ppp-on | cut -f1); echo "${USER#*=}"</input>
    1.32 +          <variable>USER</variable>
    1.33 +        </entry>
    1.34 +      </hbox>
    1.35 +      <hbox>
    1.36 +        <text use-markup="true">
    1.37 +          <label>"<b>Password :</b>"</label>
    1.38 +        </text>
    1.39 +        <entry>
    1.40 +	  <input>PASS=$(grep -s ^PASSWORD= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PASS#*=}"</input>
    1.41 +          <variable>PASS</variable>
    1.42 +        </entry>
    1.43 +      </hbox>
    1.44 +      <hbox>
    1.45 +        <text use-markup="true">
    1.46 +          <label>"<b>Telephone:</b>"</label>
    1.47 +        </text>
    1.48 +        <entry>
    1.49 +	  <input>PHONE=$(grep -s ^TELEPHONE= /etc/ppp/scripts/ppp-on | cut -f1); echo "${PHONE#*=}"</input>
    1.50 +          <variable>PHONE</variable>
    1.51 +        </entry>
    1.52 +      </hbox>
    1.53 +      <hbox>
    1.54 +        <button>
    1.55 +          <input file icon="accessories-text-editor"></input>
    1.56 +          <label>Tune</label>
    1.57 +	  <action>[ -n "$NAME" ] && sed -i "s/^ACCOUNT=.* /ACCOUNT=$NAME /" /etc/ppp/scripts/ppp-on</action>
    1.58 +	  <action>[ -n "$PASS" ] && sed -i "s/^PASSWORD=.* /PASSWORD=$PASS /" /etc/ppp/scripts/ppp-on</action>
    1.59 +	  <action>[ -n "$PHONE" ] && sed -i "s/^TELEPHONE=.* /TELEPHONE=$PHONE /" /etc/ppp/scripts/ppp-on</action>
    1.60 +          <action type="lauch">leafpad /etc/ppp/scripts/ppp-on</action>
    1.61 +        </button>
    1.62 +        <button>
    1.63 +          <label>Start</label>
    1.64 +          <input file icon="forward"></input>
    1.65 +	  <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/pap-secrets
    1.66 +	  && echo "\"$USER\"	*	\"$PASS\"" >> /etc/ppp/pap-secrets</action>
    1.67 +	  <action>[ -n "$USER" ] && grep -qs "^\"$USER\"" /etc/ppp/chap-secrets
    1.68 +	  && echo "\"$USER\"	*	\"$PASS\"" >> /etc/ppp/chap-secrets</action>
    1.69 +	  <action>[ -n "$NAME" ] && sed -i "s/^name .*/name $NAME/" /etc/ppp/options</action>
    1.70 +          <action>/etc/ppp/scripts/ppp-off</action>
    1.71 +          <action>/etc/ppp/scripts/ppp-on &</action>
    1.72 +        </button>
    1.73 +        <button>
    1.74 +          <label>Stop</label>
    1.75 +          <input file icon="stop"></input>
    1.76 +          <action>/etc/ppp/scripts/ppp-off</action>
    1.77 +        </button>
    1.78 +      </hbox>
    1.79 +    </frame>
    1.80 +
    1.81      <frame Configuration>
    1.82        <hbox>
    1.83          <text use-markup="true">