wok-current diff nomad/stuff/nomadbox @ rev 19856

Up: tazweb 1.11
author Christophe Lincoln <pankso@slitaz.org>
date Thu Mar 16 23:07:56 2017 +0100 (2017-03-16)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/nomad/stuff/nomadbox	Thu Mar 16 23:07:56 2017 +0100
     1.3 @@ -0,0 +1,195 @@
     1.4 +#! /bin/sh
     1.5 +# nomad: configure wifi and change acces point easily -- gtkdialog version.
     1.6 +
     1.7 +# Copyright (C) <2008>  <Pierre-Jean Fichet> <sygnes@ombres.eu>
     1.8 +#
     1.9 +# This program is free software: you can redistribute it and/or modify
    1.10 +# it under the terms of the GNU General Public License as published by
    1.11 +# the Free Software Foundation, either version 3 of the License, or
    1.12 +# (at your option) any later version.
    1.13 +#
    1.14 +# This program is distributed in the hope that it will be useful,
    1.15 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.16 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.17 +# GNU General Public License for more details.
    1.18 +#
    1.19 +# You should have received a copy of the GNU General Public License
    1.20 +# along with this program.  If not, see <http://www.gnu.org/licenses/>.
    1.21 +
    1.22 +. /etc/nomad.conf
    1.23 +
    1.24 +for line in `grep "() {" /etc/nomad.conf | sed "/#.*/d" | sed -e "s/() {//g"`
    1.25 +	do
    1.26 +	ITEM="<item>$line</item>"
    1.27 +	ITEMS="$ITEMS$ITEM"
    1.28 +	done
    1.29 +
    1.30 +for linessid in `iwlist $WIFI_INTERFACE scanning | grep "ESSID" | grep -v "<hidden>" | sed -n 's/ESSID:"//p' | sed -n 's/"//p'`
    1.31 +	do
    1.32 +	ESSID="<item>$linessid</item>"
    1.33 +	ESSIDS="$ESSIDS$ESSID"
    1.34 +	done
    1.35 +
    1.36 +export IWCONFIG='
    1.37 +<window title="Wireless status" icon-name="network-wireless">
    1.38 +  <vbox>
    1.39 +    <text use-markup="true">
    1.40 +      <label>"<b>Wireless status</b>"</label>
    1.41 +    </text>
    1.42 +    <frame Iwconfig>
    1.43 +      <text wrap="false" width-chars="58">
    1.44 +        <input>iwconfig 2>&1</input>
    1.45 +      </text>
    1.46 +    </frame>
    1.47 +    <hbox>
    1.48 +      <button>
    1.49 +        <input file icon="exit"></input>
    1.50 +        <action type="closewindow">IWCONFIG</action>
    1.51 +      </button>
    1.52 +    </hbox>
    1.53 +  </vbox>
    1.54 +</window>
    1.55 +'
    1.56 +
    1.57 +export SCAN="
    1.58 +<window title=\"Wireless Scan\" icon-name=\"network-wireless\">
    1.59 +  <vbox>
    1.60 +    <text use-markup=\"true\">
    1.61 +      <label>\"<b>Scan for wifi access points</b>\"</label>
    1.62 +    </text>
    1.63 +    <frame iwlist scan>
    1.64 +      <text use-markup=\"false\">
    1.65 +      <input>iwlist $WIFI_INTERFACE scanning | grep \"ESSID\|Encryption\|Quality\" | sed -e \"s/^ *ESSID/ESSID/g\" 2>&1</input>
    1.66 +      </text>
    1.67 +    </frame>
    1.68 +    <hbox>
    1.69 +      <button>
    1.70 +        <input file icon=\"exit\"></input>
    1.71 +        <action type=\"closewindow\">SCAN</action>
    1.72 +      </button>
    1.73 +    </hbox>
    1.74 +  </vbox>
    1.75 +</window>
    1.76 +"
    1.77 +
    1.78 +
    1.79 +
    1.80 +
    1.81 +
    1.82 +export NOMADBOX="
    1.83 +<window title=\"NomadBox\" icon-name=\"network-wireless\">
    1.84 + 	<vbox>
    1.85 +		<text use-markup=\"true\">
    1.86 +			<label>\"<b>Slitaz NomadBox</b>\"</label>
    1.87 +		</text>
    1.88 +	    <text wrap=\"true\" width-chars=\"52\" use-markup=\"true\">
    1.89 +			<label>\"Connect to a wireless station.\"</label>
    1.90 +    	</text>
    1.91 +
    1.92 +	<notebook labels=\"Connection|Configuration\">    
    1.93 +		<frame Choose where to connect>
    1.94 +			<vbox>
    1.95 +			<hbox>
    1.96 +				<text use-markup=\"true\">
    1.97 +					<label>\"<b>Interface:</b>\"</label>
    1.98 +				</text>
    1.99 +				<combobox>
   1.100 +					<variable>INTERFACE</variable>
   1.101 +					$ITEMS
   1.102 +				</combobox>
   1.103 +				<button>
   1.104 +					<label>Start</label>
   1.105 +					<input file icon=\"forward\"></input>
   1.106 +					<action>nomad \$INTERFACE</action>
   1.107 +				</button>
   1.108 +			</hbox>
   1.109 +				<hbox>
   1.110 +					<button>
   1.111 +						<label>Wifi On</label>
   1.112 +						<input file icon=\"forward\"></input>
   1.113 +						<action>iwconfig \$WIFI_INTERFACE txpower auto</action>
   1.114 +					</button>
   1.115 +					<button>
   1.116 +						<label>Wifi Stop</label>
   1.117 +						<input file icon=\"stop\"></input>
   1.118 +						<action>nomad stop</action>
   1.119 +					</button>
   1.120 +				</hbox>
   1.121 +			</vbox>
   1.122 +		</frame>
   1.123 +		<frame Configure a new wifi connection>
   1.124 +		<vbox>
   1.125 +			
   1.126 +			<hbox>
   1.127 +				<text><label>\"Interface	:\"</label></text>
   1.128 +				<combobox>
   1.129 +					<variable>NEWINTERFACE</variable>
   1.130 +					<item>wlan0</item>
   1.131 +					<item>eth1</item>
   1.132 +					<item>eth0</item>
   1.133 +					<item></item>
   1.134 +				</combobox>
   1.135 +			</hbox>
   1.136 +			<hbox>
   1.137 +				<text><label>\"ESSID :\"</label></text>
   1.138 +				<combobox>
   1.139 +					<variable>NEWESSID</variable>
   1.140 +					<item></item>
   1.141 +					$ESSIDS
   1.142 +				</combobox>
   1.143 +			</hbox>
   1.144 +
   1.145 +			<hbox>
   1.146 +				<text>
   1.147 +				<label>\"Key type :\"</label>
   1.148 +				</text>
   1.149 +				<combobox>
   1.150 +					<variable>NEWKEYTYPE</variable>
   1.151 +					<item>Without Key</item>
   1.152 +					<item>wep</item>
   1.153 +					<item>wpa</item>
   1.154 +				</combobox>
   1.155 +			</hbox>
   1.156 +			<hbox>
   1.157 +				<text>
   1.158 +				<label>\"wpa-Driver :\"</label>
   1.159 +				</text>
   1.160 +				<combobox>
   1.161 +					<variable>DRIVER</variable>
   1.162 +					<item>wext</item>
   1.163 +					<item></item>
   1.164 +				</combobox>
   1.165 +			</hbox>
   1.166 +			<hbox>
   1.167 +				<text><label>\"Key    :\"</label></text>
   1.168 +				<entry>	
   1.169 +					<variable>NEWKEY</variable>
   1.170 +				</entry>
   1.171 +			</hbox>
   1.172 +			<hbox>
   1.173 +				<button>
   1.174 +					<label>Iwconfig</label>
   1.175 +					<input file icon=\"computer\"></input>
   1.176 +					<action type=\"launch\">IWCONFIG</action>
   1.177 +				</button>
   1.178 +				<button>
   1.179 +					<label>Scan</label>
   1.180 +					<input file icon=\"network-wireless\"></input>
   1.181 +					<action type=\"launch\">SCAN</action>
   1.182 +				</button>
   1.183 +				<button>
   1.184 +					<label>Start</label>
   1.185 +					<input file icon=\"forward\"></input>
   1.186 +					<action>nomad new \$NEWINTERFACE \$NEWESSID \$NEWKEYTYPE \$NEWKEY \$DRIVER</action>
   1.187 +				</button>
   1.188 +			</hbox>
   1.189 +			</vbox>
   1.190 +			</frame>
   1.191 +	</notebook>
   1.192 +	</vbox>
   1.193 +</window>
   1.194 +"
   1.195 + 
   1.196 +gtkdialog --program=NOMADBOX
   1.197 +
   1.198 +exit 0