wok-current view nomad/stuff/nomadbox @ rev 21762
Up busybox (1.31.0)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Jun 27 13:32:09 2019 +0200 (2019-06-27) |
parents | |
children |
line source
1 #! /bin/sh
2 # nomad: configure wifi and change acces point easily -- gtkdialog version.
4 # Copyright (C) <2008> <Pierre-Jean Fichet> <sygnes@ombres.eu>
5 #
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 . /etc/nomad.conf
21 for line in `grep "() {" /etc/nomad.conf | sed "/#.*/d" | sed -e "s/() {//g"`
22 do
23 ITEM="<item>$line</item>"
24 ITEMS="$ITEMS$ITEM"
25 done
27 for linessid in `iwlist $WIFI_INTERFACE scanning | grep "ESSID" | grep -v "<hidden>" | sed -n 's/ESSID:"//p' | sed -n 's/"//p'`
28 do
29 ESSID="<item>$linessid</item>"
30 ESSIDS="$ESSIDS$ESSID"
31 done
33 export IWCONFIG='
34 <window title="Wireless status" icon-name="network-wireless">
35 <vbox>
36 <text use-markup="true">
37 <label>"<b>Wireless status</b>"</label>
38 </text>
39 <frame Iwconfig>
40 <text wrap="false" width-chars="58">
41 <input>iwconfig 2>&1</input>
42 </text>
43 </frame>
44 <hbox>
45 <button>
46 <input file icon="exit"></input>
47 <action type="closewindow">IWCONFIG</action>
48 </button>
49 </hbox>
50 </vbox>
51 </window>
52 '
54 export SCAN="
55 <window title=\"Wireless Scan\" icon-name=\"network-wireless\">
56 <vbox>
57 <text use-markup=\"true\">
58 <label>\"<b>Scan for wifi access points</b>\"</label>
59 </text>
60 <frame iwlist scan>
61 <text use-markup=\"false\">
62 <input>iwlist $WIFI_INTERFACE scanning | grep \"ESSID\|Encryption\|Quality\" | sed -e \"s/^ *ESSID/ESSID/g\" 2>&1</input>
63 </text>
64 </frame>
65 <hbox>
66 <button>
67 <input file icon=\"exit\"></input>
68 <action type=\"closewindow\">SCAN</action>
69 </button>
70 </hbox>
71 </vbox>
72 </window>
73 "
79 export NOMADBOX="
80 <window title=\"NomadBox\" icon-name=\"network-wireless\">
81 <vbox>
82 <text use-markup=\"true\">
83 <label>\"<b>Slitaz NomadBox</b>\"</label>
84 </text>
85 <text wrap=\"true\" width-chars=\"52\" use-markup=\"true\">
86 <label>\"Connect to a wireless station.\"</label>
87 </text>
89 <notebook labels=\"Connection|Configuration\">
90 <frame Choose where to connect>
91 <vbox>
92 <hbox>
93 <text use-markup=\"true\">
94 <label>\"<b>Interface:</b>\"</label>
95 </text>
96 <combobox>
97 <variable>INTERFACE</variable>
98 $ITEMS
99 </combobox>
100 <button>
101 <label>Start</label>
102 <input file icon=\"forward\"></input>
103 <action>nomad \$INTERFACE</action>
104 </button>
105 </hbox>
106 <hbox>
107 <button>
108 <label>Wifi On</label>
109 <input file icon=\"forward\"></input>
110 <action>iwconfig \$WIFI_INTERFACE txpower auto</action>
111 </button>
112 <button>
113 <label>Wifi Stop</label>
114 <input file icon=\"stop\"></input>
115 <action>nomad stop</action>
116 </button>
117 </hbox>
118 </vbox>
119 </frame>
120 <frame Configure a new wifi connection>
121 <vbox>
123 <hbox>
124 <text><label>\"Interface :\"</label></text>
125 <combobox>
126 <variable>NEWINTERFACE</variable>
127 <item>wlan0</item>
128 <item>eth1</item>
129 <item>eth0</item>
130 <item></item>
131 </combobox>
132 </hbox>
133 <hbox>
134 <text><label>\"ESSID :\"</label></text>
135 <combobox>
136 <variable>NEWESSID</variable>
137 <item></item>
138 $ESSIDS
139 </combobox>
140 </hbox>
142 <hbox>
143 <text>
144 <label>\"Key type :\"</label>
145 </text>
146 <combobox>
147 <variable>NEWKEYTYPE</variable>
148 <item>Without Key</item>
149 <item>wep</item>
150 <item>wpa</item>
151 </combobox>
152 </hbox>
153 <hbox>
154 <text>
155 <label>\"wpa-Driver :\"</label>
156 </text>
157 <combobox>
158 <variable>DRIVER</variable>
159 <item>wext</item>
160 <item></item>
161 </combobox>
162 </hbox>
163 <hbox>
164 <text><label>\"Key :\"</label></text>
165 <entry>
166 <variable>NEWKEY</variable>
167 </entry>
168 </hbox>
169 <hbox>
170 <button>
171 <label>Iwconfig</label>
172 <input file icon=\"computer\"></input>
173 <action type=\"launch\">IWCONFIG</action>
174 </button>
175 <button>
176 <label>Scan</label>
177 <input file icon=\"network-wireless\"></input>
178 <action type=\"launch\">SCAN</action>
179 </button>
180 <button>
181 <label>Start</label>
182 <input file icon=\"forward\"></input>
183 <action>nomad new \$NEWINTERFACE \$NEWESSID \$NEWKEYTYPE \$NEWKEY \$DRIVER</action>
184 </button>
185 </hbox>
186 </vbox>
187 </frame>
188 </notebook>
189 </vbox>
190 </window>
191 "
193 gtkdialog --program=NOMADBOX
195 exit 0