slitaz-tools rev 745

Rename wifibox to wifi-box (we may have a tools-gtkdialog packages with old boxes, so avoid name conflicts)
author Christophe Lincoln <pankso@slitaz.org>
date Sun Apr 29 23:07:19 2012 +0200 (2012-04-29)
parents 4a32682281e3
children 6c810b5973a7
files Makefile applications/wifi-box.desktop applications/wifibox.desktop boxes/wifi-box boxes/wifibox po/slitaz-boxes/slitaz-boxes.pot po/slitaz-tools/slitaz-tools.pot po/tazbox/tazbox.pot po/tazdrop/tazdrop.pot po/tazinst/tazinst.pot
line diff
     1.1 --- a/Makefile	Sat Apr 28 22:37:13 2012 +0200
     1.2 +++ b/Makefile	Sun Apr 29 23:07:19 2012 +0200
     1.3 @@ -29,8 +29,9 @@
     1.4  	@echo -n "Generating SliTaz Boxes pot file... "
     1.5  	@xgettext -o po/slitaz-boxes/slitaz-boxes.pot -L Shell \
     1.6  		--package-name="SliTaz Boxes" \
     1.7 -		./boxes/wifibox
     1.8 +		./boxes/wifi-box
     1.9  	@echo "done"
    1.10 +	#./boxes/burn-box
    1.11  
    1.12  tazbox-pot:
    1.13  	@echo -n "Generating tazbox pot file... "
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/applications/wifi-box.desktop	Sun Apr 29 23:07:19 2012 +0200
     2.3 @@ -0,0 +1,10 @@
     2.4 +[Desktop Entry]
     2.5 +Encoding=UTF-8
     2.6 +Name=Wifi configuration
     2.7 +Name[fr]=Configuration Wifi
     2.8 +Name[pt]=Configuração de Wifi
     2.9 +Name[pt_BR]=Configuração de Wifi
    2.10 +Exec=tazbox su wifi-box
    2.11 +Icon=network-wireless
    2.12 +Type=Application
    2.13 +Categories=System;Application;
     3.1 --- a/applications/wifibox.desktop	Sat Apr 28 22:37:13 2012 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,10 +0,0 @@
     3.4 -[Desktop Entry]
     3.5 -Encoding=UTF-8
     3.6 -Name=Wifi configuration
     3.7 -Name[fr]=Configuration Wifi
     3.8 -Name[pt]=Configuração de Wifi
     3.9 -Name[pt_BR]=Configuração de Wifi
    3.10 -Exec=tazbox su wifibox
    3.11 -Icon=network-wireless
    3.12 -Type=Application
    3.13 -Categories=System;Application;
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/boxes/wifi-box	Sun Apr 29 23:07:19 2012 +0200
     4.3 @@ -0,0 +1,154 @@
     4.4 +#!/bin/sh
     4.5 +#
     4.6 +# Small Wifi utility to quickly connect to a network. Easy network connection is
     4.7 +# most important, this tool provides a quick way to connect or change wifi
     4.8 +# settings while full network configuration is done in TazPanel.
     4.9 +#
    4.10 +# Copyright (C) 2012 SliTaz GNU/Linux - GNU gpl v2
    4.11 +#
    4.12 +# Authors : Christophe Lincoln <pankso@slitaz.org>
    4.13 +#
    4.14 +
    4.15 +# Only for root.
    4.16 +if [ $(id -u) != 0 ]; then
    4.17 +	exec tazbox su $(basename $0) $@
    4.18 +	exit 0
    4.19 +fi
    4.20 +
    4.21 +# Internationalization
    4.22 +. /usr/bin/gettext.sh
    4.23 +TEXTDOMAIN='slitaz-boxes'
    4.24 +export TEXTDOMAIN
    4.25 +
    4.26 +# Start a wifi connection
    4.27 +start_wifi() {
    4.28 +	sed -i \
    4.29 +		-e s'/^DHCP=.*/DHCP="yes"/' \
    4.30 +		-e s'/^STATIC=.*/STATIC="no"/' \
    4.31 +		-e s'/^WIFI=.*/WIFI="yes"/' \
    4.32 +		/etc/network.conf
    4.33 +	ifconfig $WIFI_INTERFACE up
    4.34 +	iwconfig $WIFI_INTERFACE txpower auto
    4.35 +	/etc/init.d/network.sh start
    4.36 +}
    4.37 +
    4.38 +# Catch essids and format output for GTK tree. We get the list of
    4.39 +# networks by Cell and without spaces.
    4.40 +detect_wifi() {
    4.41 +	if [ -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then
    4.42 +		ifconfig $WIFI_INTERFACE up
    4.43 +		echo -e "any\nN/A\nnone\n-"
    4.44 +		for i in $(iwlist $WIFI_INTERFACE scan | sed s/"Cell "/Cell-/ | grep "Cell-" | awk '{print $1}')
    4.45 +		do
    4.46 +			scan=$(iwlist $WIFI_INTERFACE scan last | \
    4.47 +				awk '/(Cell|ESS|Qual|Encry|IE: WPA|WPA2)/ {print}' | \
    4.48 +				sed s/"Cell "/Cell-/ | grep -A 5 "$i")
    4.49 +			essid=$(echo $scan | cut -d '"' -f 2)
    4.50 +			if echo "$scan" | grep -q Quality; then
    4.51 +				quality=$(echo $scan | sed 's/.*Quality=\([^ ]*\).*/\1/' | sed 's/.*Quality:\([^ ]*\).*/\1/')
    4.52 +			else
    4.53 +				quality="-"
    4.54 +			fi
    4.55 +			cryto=$(echo $scan | sed 's/.*key:\([^ ]*\).*/\1/')
    4.56 +			# Check encryption type
    4.57 +			if echo "$scan" | grep -q WPA*; then
    4.58 +				cryto="WPA"
    4.59 +			fi
    4.60 +			# Connected or not connected...
    4.61 +			if ifconfig | grep -A 1 $WIFI_INTERFACE | \
    4.62 +				grep -q inet && iwconfig $WIFI_INTERFACE | \
    4.63 +				grep ESSID | grep -q -w "$essid"; then
    4.64 +				status=connected
    4.65 +			else
    4.66 +				status="-"
    4.67 +			fi
    4.68 +
    4.69 +			echo -e "$essid\n$quality\n$cryto\n$status"
    4.70 +		done
    4.71 +	fi
    4.72 +}
    4.73 +
    4.74 +# Prompt for password or connect
    4.75 +connect_main() {
    4.76 +	case $keytype in
    4.77 +		WPA|WEP)
    4.78 +			title=$(gettext "Wifi connection")
    4.79 +			text=$(gettext "Connection to:")
    4.80 +			yad --form --width=520 --height=140 \
    4.81 +				--center --on-top --window-icon="network-wireless" \
    4.82 +				--image="network-wireless" --image-on-top \
    4.83 +				--title="$title" --text="$text <b>$essid</b>" \
    4.84 +				--field="$keytype $(gettext "Password:"):H" ;;
    4.85 +		none) continue ;;
    4.86 +		*) exit 0 ;;
    4.87 +	esac
    4.88 +}
    4.89 +
    4.90 +connect() {
    4.91 +	main=$(connect_main)
    4.92 +	ret=$?
    4.93 +	# Deal with --button values
    4.94 +	case $ret in
    4.95 +		1) exit 0 ;;
    4.96 +		*) continue ;;
    4.97 +	esac
    4.98 +	/etc/init.d/network.sh stop
    4.99 +	sleep 1
   4.100 +	key=$(echo "$main" | cut -d '|' -f 1)
   4.101 +	sed -i \
   4.102 +		-e s"/^WIFI_ESSID=.*/WIFI_ESSID=\"$essid\""/ \
   4.103 +		-e s"/^WIFI_KEY=.*/WIFI_KEY=\"$key\"/" \
   4.104 +		-e s"/^WIFI_KEY_TYPE=.*/WIFI_KEY_TYPE=\"$keytype\"/" \
   4.105 +		/etc/network.conf
   4.106 +	start_wifi
   4.107 +}
   4.108 +
   4.109 +# Main GUI box function with pure Yad spec
   4.110 +wifi_main() {
   4.111 +	title=$(gettext "Wifi network")
   4.112 +	text=$(gettext "<b>Connect to a wifi network</b> \(Double click to connect\)")
   4.113 +	detect_wifi | yad --list --width=520 --height=300 \
   4.114 +		--center --on-top --window-icon="network-wireless" \
   4.115 +		--image="network-wireless" --image-on-top \
   4.116 +		--title="$title" --text="$text" \
   4.117 +		--column "$(gettext "ESSID Name")" --column "$(gettext "Quality")" \
   4.118 +		--column "$(gettext "Encryption")" --column "$(gettext "Status")" \
   4.119 +		--button="Start wifi:4" --button="Stop wifi:3" \
   4.120 +		--button="Configuration:2" --button="gtk-close:1"
   4.121 +}
   4.122 +
   4.123 +# Main function
   4.124 +wifi() {
   4.125 +	# Store box results
   4.126 +	main=$(wifi_main)
   4.127 +	ret=$?
   4.128 +	# Deal with --button values
   4.129 +	case $ret in
   4.130 +		1) exit 0 ;;
   4.131 +		2) tazweb http://tazpanel:82/network.cgi?wifi && exit 0 ;;
   4.132 +		3) /etc/init.d/network.sh stop && exit 0 ;;
   4.133 +		3) start_wifi && exit 0 ;;
   4.134 +		*) continue ;;
   4.135 +	esac
   4.136 +	if [ -n "$main" ]; then
   4.137 +		essid=$(echo "$main" | cut -d "|" -f 1)
   4.138 +		keytype=$(echo "$main" | cut -d "|" -f 3)
   4.139 +		connect
   4.140 +	fi
   4.141 +}
   4.142 +
   4.143 +#
   4.144 +# Script commands
   4.145 +#
   4.146 +
   4.147 +case "$1" in
   4.148 +	usage|help|-*)
   4.149 +		echo "$(gettext "Usage:") $(basename $0) [interface]" ;;
   4.150 +	*)
   4.151 +		. /etc/network.conf
   4.152 +		[ -n "$1" ] && WIFI_INTERFACE="$1"
   4.153 +		wifi ;;
   4.154 +esac
   4.155 +
   4.156 +exit 0
   4.157 +
     5.1 --- a/boxes/wifibox	Sat Apr 28 22:37:13 2012 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,154 +0,0 @@
     5.4 -#!/bin/sh
     5.5 -#
     5.6 -# Small Wifi utility to quickly connect to a network. Easy network connection is
     5.7 -# most important, this tool provides a quick way to connect or change wifi
     5.8 -# settings while full network configuration is done in TazPanel.
     5.9 -#
    5.10 -# Copyright (C) 2012 SliTaz GNU/Linux - GNU gpl v2
    5.11 -#
    5.12 -# Authors : Christophe Lincoln <pankso@slitaz.org>
    5.13 -#
    5.14 -
    5.15 -# Only for root.
    5.16 -if [ $(id -u) != 0 ]; then
    5.17 -	exec tazbox su $(basename $0) $@
    5.18 -	exit 0
    5.19 -fi
    5.20 -
    5.21 -# Internationalization
    5.22 -. /usr/bin/gettext.sh
    5.23 -TEXTDOMAIN='slitaz-boxes'
    5.24 -export TEXTDOMAIN
    5.25 -
    5.26 -# Start a wifi connection
    5.27 -start_wifi() {
    5.28 -	sed -i \
    5.29 -		-e s'/^DHCP=.*/DHCP="yes"/' \
    5.30 -		-e s'/^STATIC=.*/STATIC="no"/' \
    5.31 -		-e s'/^WIFI=.*/WIFI="yes"/' \
    5.32 -		/etc/network.conf
    5.33 -	ifconfig $WIFI_INTERFACE up
    5.34 -	iwconfig $WIFI_INTERFACE txpower auto
    5.35 -	/etc/init.d/network.sh start
    5.36 -}
    5.37 -
    5.38 -# Catch essids and format output for GTK tree. We get the list of
    5.39 -# networks by Cell and without spaces.
    5.40 -detect_wifi() {
    5.41 -	if [ -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then
    5.42 -		ifconfig $WIFI_INTERFACE up
    5.43 -		echo -e "any\nN/A\nnone\n-"
    5.44 -		for i in $(iwlist $WIFI_INTERFACE scan | sed s/"Cell "/Cell-/ | grep "Cell-" | awk '{print $1}')
    5.45 -		do
    5.46 -			scan=$(iwlist $WIFI_INTERFACE scan last | \
    5.47 -				awk '/(Cell|ESS|Qual|Encry|IE: WPA|WPA2)/ {print}' | \
    5.48 -				sed s/"Cell "/Cell-/ | grep -A 5 "$i")
    5.49 -			essid=$(echo $scan | cut -d '"' -f 2)
    5.50 -			if echo "$scan" | grep -q Quality; then
    5.51 -				quality=$(echo $scan | sed 's/.*Quality=\([^ ]*\).*/\1/' | sed 's/.*Quality:\([^ ]*\).*/\1/')
    5.52 -			else
    5.53 -				quality="-"
    5.54 -			fi
    5.55 -			cryto=$(echo $scan | sed 's/.*key:\([^ ]*\).*/\1/')
    5.56 -			# Check encryption type
    5.57 -			if echo "$scan" | grep -q WPA*; then
    5.58 -				cryto="WPA"
    5.59 -			fi
    5.60 -			# Connected or not connected...
    5.61 -			if ifconfig | grep -A 1 $WIFI_INTERFACE | \
    5.62 -				grep -q inet && iwconfig $WIFI_INTERFACE | \
    5.63 -				grep ESSID | grep -q -w "$essid"; then
    5.64 -				status=connected
    5.65 -			else
    5.66 -				status="-"
    5.67 -			fi
    5.68 -
    5.69 -			echo -e "$essid\n$quality\n$cryto\n$status"
    5.70 -		done
    5.71 -	fi
    5.72 -}
    5.73 -
    5.74 -# Prompt for password or connect
    5.75 -connect_main() {
    5.76 -	case $keytype in
    5.77 -		WPA|WEP)
    5.78 -			title=$(gettext "Wifi connection")
    5.79 -			text=$(gettext "Connection to:")
    5.80 -			yad --form --width=520 --height=140 \
    5.81 -				--center --on-top --window-icon="network-wireless" \
    5.82 -				--image="network-wireless" --image-on-top \
    5.83 -				--title="$title" --text="$text <b>$essid</b>" \
    5.84 -				--field="$keytype $(gettext "Password:"):H" ;;
    5.85 -		none) continue ;;
    5.86 -		*) exit 0 ;;
    5.87 -	esac
    5.88 -}
    5.89 -
    5.90 -connect() {
    5.91 -	main=$(connect_main)
    5.92 -	ret=$?
    5.93 -	# Deal with --button values
    5.94 -	case $ret in
    5.95 -		1) exit 0 ;;
    5.96 -		*) continue ;;
    5.97 -	esac
    5.98 -	/etc/init.d/network.sh stop
    5.99 -	sleep 1
   5.100 -	key=$(echo "$main" | cut -d '|' -f 1)
   5.101 -	sed -i \
   5.102 -		-e s"/^WIFI_ESSID=.*/WIFI_ESSID=\"$essid\""/ \
   5.103 -		-e s"/^WIFI_KEY=.*/WIFI_KEY=\"$key\"/" \
   5.104 -		-e s"/^WIFI_KEY_TYPE=.*/WIFI_KEY_TYPE=\"$keytype\"/" \
   5.105 -		/etc/network.conf
   5.106 -	start_wifi
   5.107 -}
   5.108 -
   5.109 -# Main GUI box function with pure Yad spec
   5.110 -wifi_main() {
   5.111 -	title=$(gettext "Wifi network")
   5.112 -	text=$(gettext "<b>Connect to a wifi network</b> \(Double click to connect\)")
   5.113 -	detect_wifi | yad --list --width=520 --height=300 \
   5.114 -		--center --on-top --window-icon="network-wireless" \
   5.115 -		--image="network-wireless" --image-on-top \
   5.116 -		--title="$title" --text="$text" \
   5.117 -		--column "$(gettext "ESSID Name")" --column "$(gettext "Quality")" \
   5.118 -		--column "$(gettext "Encryption")" --column "$(gettext "Status")" \
   5.119 -		--button="Start wifi:4" --button="Stop wifi:3" \
   5.120 -		--button="Configuration:2" --button="gtk-close:1"
   5.121 -}
   5.122 -
   5.123 -# Main function
   5.124 -wifi() {
   5.125 -	# Store box results
   5.126 -	main=$(wifi_main)
   5.127 -	ret=$?
   5.128 -	# Deal with --button values
   5.129 -	case $ret in
   5.130 -		1) exit 0 ;;
   5.131 -		2) tazweb http://tazpanel:82/network.cgi?wifi && exit 0 ;;
   5.132 -		3) /etc/init.d/network.sh stop && exit 0 ;;
   5.133 -		3) start_wifi && exit 0 ;;
   5.134 -		*) continue ;;
   5.135 -	esac
   5.136 -	if [ -n "$main" ]; then
   5.137 -		essid=$(echo "$main" | cut -d "|" -f 1)
   5.138 -		keytype=$(echo "$main" | cut -d "|" -f 3)
   5.139 -		connect
   5.140 -	fi
   5.141 -}
   5.142 -
   5.143 -#
   5.144 -# Script commands
   5.145 -#
   5.146 -
   5.147 -case "$1" in
   5.148 -	usage|help|-*)
   5.149 -		echo "$(gettext "Usage:") $(basename $0) [interface]" ;;
   5.150 -	*)
   5.151 -		. /etc/network.conf
   5.152 -		[ -n "$1" ] && WIFI_INTERFACE="$1"
   5.153 -		wifi ;;
   5.154 -esac
   5.155 -
   5.156 -exit 0
   5.157 -
     6.1 --- a/po/slitaz-boxes/slitaz-boxes.pot	Sat Apr 28 22:37:13 2012 +0200
     6.2 +++ b/po/slitaz-boxes/slitaz-boxes.pot	Sun Apr 29 23:07:19 2012 +0200
     6.3 @@ -8,7 +8,7 @@
     6.4  msgstr ""
     6.5  "Project-Id-Version: SliTaz Boxes\n"
     6.6  "Report-Msgid-Bugs-To: \n"
     6.7 -"POT-Creation-Date: 2012-04-28 20:10+0200\n"
     6.8 +"POT-Creation-Date: 2012-04-29 23:05+0200\n"
     6.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    6.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    6.11  "Language-Team: LANGUAGE <LL@li.org>\n"
    6.12 @@ -17,42 +17,42 @@
    6.13  "Content-Type: text/plain; charset=CHARSET\n"
    6.14  "Content-Transfer-Encoding: 8bit\n"
    6.15  
    6.16 -#: boxes/wifibox:75
    6.17 +#: boxes/wifi-box:75
    6.18  msgid "Wifi connection"
    6.19  msgstr ""
    6.20  
    6.21 -#: boxes/wifibox:76
    6.22 +#: boxes/wifi-box:76
    6.23  msgid "Connection to:"
    6.24  msgstr ""
    6.25  
    6.26 -#: boxes/wifibox:81
    6.27 +#: boxes/wifi-box:81
    6.28  msgid "Password:"
    6.29  msgstr ""
    6.30  
    6.31 -#: boxes/wifibox:108
    6.32 +#: boxes/wifi-box:108
    6.33  msgid "Wifi network"
    6.34  msgstr ""
    6.35  
    6.36 -#: boxes/wifibox:109
    6.37 +#: boxes/wifi-box:109
    6.38  msgid "<b>Connect to a wifi network</b> \\(Double click to connect\\)"
    6.39  msgstr ""
    6.40  
    6.41 -#: boxes/wifibox:114
    6.42 +#: boxes/wifi-box:114
    6.43  msgid "ESSID Name"
    6.44  msgstr ""
    6.45  
    6.46 -#: boxes/wifibox:114
    6.47 +#: boxes/wifi-box:114
    6.48  msgid "Quality"
    6.49  msgstr ""
    6.50  
    6.51 -#: boxes/wifibox:115
    6.52 +#: boxes/wifi-box:115
    6.53  msgid "Encryption"
    6.54  msgstr ""
    6.55  
    6.56 -#: boxes/wifibox:115
    6.57 +#: boxes/wifi-box:115
    6.58  msgid "Status"
    6.59  msgstr ""
    6.60  
    6.61 -#: boxes/wifibox:146
    6.62 +#: boxes/wifi-box:146
    6.63  msgid "Usage:"
    6.64  msgstr ""
     7.1 --- a/po/slitaz-tools/slitaz-tools.pot	Sat Apr 28 22:37:13 2012 +0200
     7.2 +++ b/po/slitaz-tools/slitaz-tools.pot	Sun Apr 29 23:07:19 2012 +0200
     7.3 @@ -8,7 +8,7 @@
     7.4  msgstr ""
     7.5  "Project-Id-Version: SliTaz Tools\n"
     7.6  "Report-Msgid-Bugs-To: \n"
     7.7 -"POT-Creation-Date: 2012-04-28 20:10+0200\n"
     7.8 +"POT-Creation-Date: 2012-04-29 23:05+0200\n"
     7.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    7.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    7.11  "Language-Team: LANGUAGE <LL@li.org>\n"
     8.1 --- a/po/tazbox/tazbox.pot	Sat Apr 28 22:37:13 2012 +0200
     8.2 +++ b/po/tazbox/tazbox.pot	Sun Apr 29 23:07:19 2012 +0200
     8.3 @@ -8,7 +8,7 @@
     8.4  msgstr ""
     8.5  "Project-Id-Version: TazBox\n"
     8.6  "Report-Msgid-Bugs-To: \n"
     8.7 -"POT-Creation-Date: 2012-04-28 20:10+0200\n"
     8.8 +"POT-Creation-Date: 2012-04-29 23:05+0200\n"
     8.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    8.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    8.11  "Language-Team: LANGUAGE <LL@li.org>\n"
     9.1 --- a/po/tazdrop/tazdrop.pot	Sat Apr 28 22:37:13 2012 +0200
     9.2 +++ b/po/tazdrop/tazdrop.pot	Sun Apr 29 23:07:19 2012 +0200
     9.3 @@ -8,7 +8,7 @@
     9.4  msgstr ""
     9.5  "Project-Id-Version: TazDrop\n"
     9.6  "Report-Msgid-Bugs-To: \n"
     9.7 -"POT-Creation-Date: 2012-04-28 20:10+0200\n"
     9.8 +"POT-Creation-Date: 2012-04-29 23:05+0200\n"
     9.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    9.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    9.11  "Language-Team: LANGUAGE <LL@li.org>\n"
    10.1 --- a/po/tazinst/tazinst.pot	Sat Apr 28 22:37:13 2012 +0200
    10.2 +++ b/po/tazinst/tazinst.pot	Sun Apr 29 23:07:19 2012 +0200
    10.3 @@ -8,7 +8,7 @@
    10.4  msgstr ""
    10.5  "Project-Id-Version: Tazinst\n"
    10.6  "Report-Msgid-Bugs-To: \n"
    10.7 -"POT-Creation-Date: 2012-04-28 20:10+0200\n"
    10.8 +"POT-Creation-Date: 2012-04-29 23:05+0200\n"
    10.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
   10.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
   10.11  "Language-Team: LANGUAGE <LL@li.org>\n"