# HG changeset patch # User Christophe Lincoln # Date 1335733639 -7200 # Node ID cc27e2f275567ac9105cf066e0649dba11e93195 # Parent 4a32682281e3fb7313605b96829b63591b2e293e Rename wifibox to wifi-box (we may have a tools-gtkdialog packages with old boxes, so avoid name conflicts) diff -r 4a32682281e3 -r cc27e2f27556 Makefile --- a/Makefile Sat Apr 28 22:37:13 2012 +0200 +++ b/Makefile Sun Apr 29 23:07:19 2012 +0200 @@ -29,8 +29,9 @@ @echo -n "Generating SliTaz Boxes pot file... " @xgettext -o po/slitaz-boxes/slitaz-boxes.pot -L Shell \ --package-name="SliTaz Boxes" \ - ./boxes/wifibox + ./boxes/wifi-box @echo "done" + #./boxes/burn-box tazbox-pot: @echo -n "Generating tazbox pot file... " diff -r 4a32682281e3 -r cc27e2f27556 applications/wifi-box.desktop --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/applications/wifi-box.desktop Sun Apr 29 23:07:19 2012 +0200 @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Wifi configuration +Name[fr]=Configuration Wifi +Name[pt]=Configuração de Wifi +Name[pt_BR]=Configuração de Wifi +Exec=tazbox su wifi-box +Icon=network-wireless +Type=Application +Categories=System;Application; diff -r 4a32682281e3 -r cc27e2f27556 applications/wifibox.desktop --- a/applications/wifibox.desktop Sat Apr 28 22:37:13 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=Wifi configuration -Name[fr]=Configuration Wifi -Name[pt]=Configuração de Wifi -Name[pt_BR]=Configuração de Wifi -Exec=tazbox su wifibox -Icon=network-wireless -Type=Application -Categories=System;Application; diff -r 4a32682281e3 -r cc27e2f27556 boxes/wifi-box --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/boxes/wifi-box Sun Apr 29 23:07:19 2012 +0200 @@ -0,0 +1,154 @@ +#!/bin/sh +# +# Small Wifi utility to quickly connect to a network. Easy network connection is +# most important, this tool provides a quick way to connect or change wifi +# settings while full network configuration is done in TazPanel. +# +# Copyright (C) 2012 SliTaz GNU/Linux - GNU gpl v2 +# +# Authors : Christophe Lincoln +# + +# Only for root. +if [ $(id -u) != 0 ]; then + exec tazbox su $(basename $0) $@ + exit 0 +fi + +# Internationalization +. /usr/bin/gettext.sh +TEXTDOMAIN='slitaz-boxes' +export TEXTDOMAIN + +# Start a wifi connection +start_wifi() { + sed -i \ + -e s'/^DHCP=.*/DHCP="yes"/' \ + -e s'/^STATIC=.*/STATIC="no"/' \ + -e s'/^WIFI=.*/WIFI="yes"/' \ + /etc/network.conf + ifconfig $WIFI_INTERFACE up + iwconfig $WIFI_INTERFACE txpower auto + /etc/init.d/network.sh start +} + +# Catch essids and format output for GTK tree. We get the list of +# networks by Cell and without spaces. +detect_wifi() { + if [ -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then + ifconfig $WIFI_INTERFACE up + echo -e "any\nN/A\nnone\n-" + for i in $(iwlist $WIFI_INTERFACE scan | sed s/"Cell "/Cell-/ | grep "Cell-" | awk '{print $1}') + do + scan=$(iwlist $WIFI_INTERFACE scan last | \ + awk '/(Cell|ESS|Qual|Encry|IE: WPA|WPA2)/ {print}' | \ + sed s/"Cell "/Cell-/ | grep -A 5 "$i") + essid=$(echo $scan | cut -d '"' -f 2) + if echo "$scan" | grep -q Quality; then + quality=$(echo $scan | sed 's/.*Quality=\([^ ]*\).*/\1/' | sed 's/.*Quality:\([^ ]*\).*/\1/') + else + quality="-" + fi + cryto=$(echo $scan | sed 's/.*key:\([^ ]*\).*/\1/') + # Check encryption type + if echo "$scan" | grep -q WPA*; then + cryto="WPA" + fi + # Connected or not connected... + if ifconfig | grep -A 1 $WIFI_INTERFACE | \ + grep -q inet && iwconfig $WIFI_INTERFACE | \ + grep ESSID | grep -q -w "$essid"; then + status=connected + else + status="-" + fi + + echo -e "$essid\n$quality\n$cryto\n$status" + done + fi +} + +# Prompt for password or connect +connect_main() { + case $keytype in + WPA|WEP) + title=$(gettext "Wifi connection") + text=$(gettext "Connection to:") + yad --form --width=520 --height=140 \ + --center --on-top --window-icon="network-wireless" \ + --image="network-wireless" --image-on-top \ + --title="$title" --text="$text $essid" \ + --field="$keytype $(gettext "Password:"):H" ;; + none) continue ;; + *) exit 0 ;; + esac +} + +connect() { + main=$(connect_main) + ret=$? + # Deal with --button values + case $ret in + 1) exit 0 ;; + *) continue ;; + esac + /etc/init.d/network.sh stop + sleep 1 + key=$(echo "$main" | cut -d '|' -f 1) + sed -i \ + -e s"/^WIFI_ESSID=.*/WIFI_ESSID=\"$essid\""/ \ + -e s"/^WIFI_KEY=.*/WIFI_KEY=\"$key\"/" \ + -e s"/^WIFI_KEY_TYPE=.*/WIFI_KEY_TYPE=\"$keytype\"/" \ + /etc/network.conf + start_wifi +} + +# Main GUI box function with pure Yad spec +wifi_main() { + title=$(gettext "Wifi network") + text=$(gettext "Connect to a wifi network \(Double click to connect\)") + detect_wifi | yad --list --width=520 --height=300 \ + --center --on-top --window-icon="network-wireless" \ + --image="network-wireless" --image-on-top \ + --title="$title" --text="$text" \ + --column "$(gettext "ESSID Name")" --column "$(gettext "Quality")" \ + --column "$(gettext "Encryption")" --column "$(gettext "Status")" \ + --button="Start wifi:4" --button="Stop wifi:3" \ + --button="Configuration:2" --button="gtk-close:1" +} + +# Main function +wifi() { + # Store box results + main=$(wifi_main) + ret=$? + # Deal with --button values + case $ret in + 1) exit 0 ;; + 2) tazweb http://tazpanel:82/network.cgi?wifi && exit 0 ;; + 3) /etc/init.d/network.sh stop && exit 0 ;; + 3) start_wifi && exit 0 ;; + *) continue ;; + esac + if [ -n "$main" ]; then + essid=$(echo "$main" | cut -d "|" -f 1) + keytype=$(echo "$main" | cut -d "|" -f 3) + connect + fi +} + +# +# Script commands +# + +case "$1" in + usage|help|-*) + echo "$(gettext "Usage:") $(basename $0) [interface]" ;; + *) + . /etc/network.conf + [ -n "$1" ] && WIFI_INTERFACE="$1" + wifi ;; +esac + +exit 0 + diff -r 4a32682281e3 -r cc27e2f27556 boxes/wifibox --- a/boxes/wifibox Sat Apr 28 22:37:13 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,154 +0,0 @@ -#!/bin/sh -# -# Small Wifi utility to quickly connect to a network. Easy network connection is -# most important, this tool provides a quick way to connect or change wifi -# settings while full network configuration is done in TazPanel. -# -# Copyright (C) 2012 SliTaz GNU/Linux - GNU gpl v2 -# -# Authors : Christophe Lincoln -# - -# Only for root. -if [ $(id -u) != 0 ]; then - exec tazbox su $(basename $0) $@ - exit 0 -fi - -# Internationalization -. /usr/bin/gettext.sh -TEXTDOMAIN='slitaz-boxes' -export TEXTDOMAIN - -# Start a wifi connection -start_wifi() { - sed -i \ - -e s'/^DHCP=.*/DHCP="yes"/' \ - -e s'/^STATIC=.*/STATIC="no"/' \ - -e s'/^WIFI=.*/WIFI="yes"/' \ - /etc/network.conf - ifconfig $WIFI_INTERFACE up - iwconfig $WIFI_INTERFACE txpower auto - /etc/init.d/network.sh start -} - -# Catch essids and format output for GTK tree. We get the list of -# networks by Cell and without spaces. -detect_wifi() { - if [ -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then - ifconfig $WIFI_INTERFACE up - echo -e "any\nN/A\nnone\n-" - for i in $(iwlist $WIFI_INTERFACE scan | sed s/"Cell "/Cell-/ | grep "Cell-" | awk '{print $1}') - do - scan=$(iwlist $WIFI_INTERFACE scan last | \ - awk '/(Cell|ESS|Qual|Encry|IE: WPA|WPA2)/ {print}' | \ - sed s/"Cell "/Cell-/ | grep -A 5 "$i") - essid=$(echo $scan | cut -d '"' -f 2) - if echo "$scan" | grep -q Quality; then - quality=$(echo $scan | sed 's/.*Quality=\([^ ]*\).*/\1/' | sed 's/.*Quality:\([^ ]*\).*/\1/') - else - quality="-" - fi - cryto=$(echo $scan | sed 's/.*key:\([^ ]*\).*/\1/') - # Check encryption type - if echo "$scan" | grep -q WPA*; then - cryto="WPA" - fi - # Connected or not connected... - if ifconfig | grep -A 1 $WIFI_INTERFACE | \ - grep -q inet && iwconfig $WIFI_INTERFACE | \ - grep ESSID | grep -q -w "$essid"; then - status=connected - else - status="-" - fi - - echo -e "$essid\n$quality\n$cryto\n$status" - done - fi -} - -# Prompt for password or connect -connect_main() { - case $keytype in - WPA|WEP) - title=$(gettext "Wifi connection") - text=$(gettext "Connection to:") - yad --form --width=520 --height=140 \ - --center --on-top --window-icon="network-wireless" \ - --image="network-wireless" --image-on-top \ - --title="$title" --text="$text $essid" \ - --field="$keytype $(gettext "Password:"):H" ;; - none) continue ;; - *) exit 0 ;; - esac -} - -connect() { - main=$(connect_main) - ret=$? - # Deal with --button values - case $ret in - 1) exit 0 ;; - *) continue ;; - esac - /etc/init.d/network.sh stop - sleep 1 - key=$(echo "$main" | cut -d '|' -f 1) - sed -i \ - -e s"/^WIFI_ESSID=.*/WIFI_ESSID=\"$essid\""/ \ - -e s"/^WIFI_KEY=.*/WIFI_KEY=\"$key\"/" \ - -e s"/^WIFI_KEY_TYPE=.*/WIFI_KEY_TYPE=\"$keytype\"/" \ - /etc/network.conf - start_wifi -} - -# Main GUI box function with pure Yad spec -wifi_main() { - title=$(gettext "Wifi network") - text=$(gettext "Connect to a wifi network \(Double click to connect\)") - detect_wifi | yad --list --width=520 --height=300 \ - --center --on-top --window-icon="network-wireless" \ - --image="network-wireless" --image-on-top \ - --title="$title" --text="$text" \ - --column "$(gettext "ESSID Name")" --column "$(gettext "Quality")" \ - --column "$(gettext "Encryption")" --column "$(gettext "Status")" \ - --button="Start wifi:4" --button="Stop wifi:3" \ - --button="Configuration:2" --button="gtk-close:1" -} - -# Main function -wifi() { - # Store box results - main=$(wifi_main) - ret=$? - # Deal with --button values - case $ret in - 1) exit 0 ;; - 2) tazweb http://tazpanel:82/network.cgi?wifi && exit 0 ;; - 3) /etc/init.d/network.sh stop && exit 0 ;; - 3) start_wifi && exit 0 ;; - *) continue ;; - esac - if [ -n "$main" ]; then - essid=$(echo "$main" | cut -d "|" -f 1) - keytype=$(echo "$main" | cut -d "|" -f 3) - connect - fi -} - -# -# Script commands -# - -case "$1" in - usage|help|-*) - echo "$(gettext "Usage:") $(basename $0) [interface]" ;; - *) - . /etc/network.conf - [ -n "$1" ] && WIFI_INTERFACE="$1" - wifi ;; -esac - -exit 0 - diff -r 4a32682281e3 -r cc27e2f27556 po/slitaz-boxes/slitaz-boxes.pot --- a/po/slitaz-boxes/slitaz-boxes.pot Sat Apr 28 22:37:13 2012 +0200 +++ b/po/slitaz-boxes/slitaz-boxes.pot Sun Apr 29 23:07:19 2012 +0200 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: SliTaz Boxes\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-28 20:10+0200\n" +"POT-Creation-Date: 2012-04-29 23:05+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,42 +17,42 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: boxes/wifibox:75 +#: boxes/wifi-box:75 msgid "Wifi connection" msgstr "" -#: boxes/wifibox:76 +#: boxes/wifi-box:76 msgid "Connection to:" msgstr "" -#: boxes/wifibox:81 +#: boxes/wifi-box:81 msgid "Password:" msgstr "" -#: boxes/wifibox:108 +#: boxes/wifi-box:108 msgid "Wifi network" msgstr "" -#: boxes/wifibox:109 +#: boxes/wifi-box:109 msgid "Connect to a wifi network \\(Double click to connect\\)" msgstr "" -#: boxes/wifibox:114 +#: boxes/wifi-box:114 msgid "ESSID Name" msgstr "" -#: boxes/wifibox:114 +#: boxes/wifi-box:114 msgid "Quality" msgstr "" -#: boxes/wifibox:115 +#: boxes/wifi-box:115 msgid "Encryption" msgstr "" -#: boxes/wifibox:115 +#: boxes/wifi-box:115 msgid "Status" msgstr "" -#: boxes/wifibox:146 +#: boxes/wifi-box:146 msgid "Usage:" msgstr "" diff -r 4a32682281e3 -r cc27e2f27556 po/slitaz-tools/slitaz-tools.pot --- a/po/slitaz-tools/slitaz-tools.pot Sat Apr 28 22:37:13 2012 +0200 +++ b/po/slitaz-tools/slitaz-tools.pot Sun Apr 29 23:07:19 2012 +0200 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: SliTaz Tools\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-28 20:10+0200\n" +"POT-Creation-Date: 2012-04-29 23:05+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff -r 4a32682281e3 -r cc27e2f27556 po/tazbox/tazbox.pot --- a/po/tazbox/tazbox.pot Sat Apr 28 22:37:13 2012 +0200 +++ b/po/tazbox/tazbox.pot Sun Apr 29 23:07:19 2012 +0200 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: TazBox\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-28 20:10+0200\n" +"POT-Creation-Date: 2012-04-29 23:05+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff -r 4a32682281e3 -r cc27e2f27556 po/tazdrop/tazdrop.pot --- a/po/tazdrop/tazdrop.pot Sat Apr 28 22:37:13 2012 +0200 +++ b/po/tazdrop/tazdrop.pot Sun Apr 29 23:07:19 2012 +0200 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: TazDrop\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-28 20:10+0200\n" +"POT-Creation-Date: 2012-04-29 23:05+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff -r 4a32682281e3 -r cc27e2f27556 po/tazinst/tazinst.pot --- a/po/tazinst/tazinst.pot Sat Apr 28 22:37:13 2012 +0200 +++ b/po/tazinst/tazinst.pot Sun Apr 29 23:07:19 2012 +0200 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Tazinst\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-28 20:10+0200\n" +"POT-Creation-Date: 2012-04-29 23:05+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n"