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