# HG changeset patch # User Pierre-Jean Fichet # Date 1216665383 -7200 # Node ID 59bc9f9263f5ff50ec13a64ac5f6c14455d16c82 # Parent a08b2e53cf9600f6d48c408a61296b4324b63cbd nomad nomadbox, tool to configure multiple wifi access points diff -r a08b2e53cf96 -r 59bc9f9263f5 nomad/process.log --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nomad/process.log Mon Jul 21 20:36:23 2008 +0200 @@ -0,0 +1,5 @@ +date 20080721 20:20:43 +package nomad (compile) +no compile_rules +executing genpkg_rules +nomad-0.1.tazpkg (done) diff -r a08b2e53cf96 -r 59bc9f9263f5 nomad/receipt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nomad/receipt Mon Jul 21 20:36:23 2008 +0200 @@ -0,0 +1,21 @@ +# SliTaz package receipt. + +PACKAGE="nomad" +VERSION="0.1" +CATEGORY="extra" +SHORT_DESC="user friendly wifi configure for nomads." +MAINTAINER="sygne@ombres.eu" +DEPENDS="gtkdialog wireless_tools" + + +# Rules to gen a SliTaz package suitable for Tazpkg. +genpkg_rules() +{ + mkdir -p $fs/usr/sbin + cp -a stuff/nomad $fs/usr/sbin/ + cp -a stuff/nomadbox $fs/usr/sbin/ + + mkdir $fs/etc + cp -a stuff/nomad.conf $fs/etc/ +} + diff -r a08b2e53cf96 -r 59bc9f9263f5 nomad/stuff/nomad --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nomad/stuff/nomad Mon Jul 21 20:36:23 2008 +0200 @@ -0,0 +1,131 @@ +#! /bin/sh +# nomad: configure wifi and change acces point easily. + +# Copyright (C) <2008> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +CONFIG="/etc/nomad.conf" + +. $CONFIG +. /etc/init.d/rc.functions + + +case "$1" in + # we want to configure au new interface + new) + TYPE="wifi" + WIFI_INTERFACE="$2" + ESSID="$3" + KEYTYPE="$4" + KEY="$5" + DRIVER="$6" + if [ "$KEYTYPE" = "wpa" ]; then + WPA=" +ap_scan=1 +network={ + ssid=\"$ESSID\" + scan_ssid=1 + proto=WPA + key_mgmt=WPA-PSK + psk=\"$KEY\" + priority=5 +}" + fi + ;; + + # we want to poweroff wifi + stop) + echo -n "pidof wpa_supplicant: " + if pidof wpa_supplicant; then + echo -n "stopping wpa_supplicant..." + killall wpa_supplicant + status + else + echo "None" + fi + echo -n "power off wifi..." + iwconfig $WIFI_INTERFACE txpower off + status + ;; + + + *) + # we want to join a known access point + if [ "$1" != "" ] && grep -q "$1() {" $CONFIG ; then + $1 # here we launch the function to set variables + # we don't know how to use nomad + else + echo -n -e "\033[01musage:\033[0m `basename $0` [" + for line in `grep "() {" $CONFIG | sed "/#.*/d" | sed -e "s/() {//g"` + do + echo -n "$line|" + done + echo -n "stop]" + echo "" + echo -e "\033[1mOr :\033[0m `basename $0` new \ +WIFI_INTERFACE ESSID KEYTYPE KEY DRIVER" + echo " KEYTYPE is: wpa or wep" + echo " DRIVER is wext or another-wpa_supplicant-driver" + echo "" + echo -e " But first, you have to edit \033[1m/etc/nomad.conf\033[0m " + echo "" + echo -e "You can also use \033[1mnomadbox\033[0m, if you want a graphical interface for nomad" + echo "" + exit 1 + fi + ;; +esac + + +#Si ethernet +if [ "$TYPE" = "ethernet" ]; then + if [ "$DHCP" = "yes" ] ; then + echo "Starting udhcpc client on: $INTERFACE... " + /sbin/udhcpc -b -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid + status + fi + # For a static IP. + if [ "$STATIC" = "yes" ] ; then + echo -n "Configuring static IP on $INTERFACE: $IP... " + /sbin/ifconfig $INTERFACE $IP netmask $NETMASK up + /sbin/route add default gateway $GATEWAY + status + # Multi-DNS server in $DNS_SERVER. + /bin/mv /etc/resolv.conf /tmp/resolv.conf.$$ + for NS in $DNS_SERVER + do + echo "nameserver $NS" >> /etc/resolv.conf + done + fi + +#si wifi +elif [ "$TYPE" = "wifi" ]; then + iwconfig $WIFI_INTERFACE txpower on + status + iwconfig $WIFI_INTERFACE essid $ESSID + if [ -n "$WPA" ]; then + echo "$WPA" >/tmp/wpa.conf + echo "starting wpa_supplicant for $INTERFACE..." + wpa_supplicant -B -w -c/tmp/wpa.conf -D$DRIVER -i$WIFI_INTERFACE + status + rm /tmp/wpa.conf + elif [ -n "$KEY" ]; then + iwconfig $WIFI_INTERFACE key $KEY + fi + /sbin/udhcpc -b -i $WIFI_INTERFACE -p /var/run/udhcpc.$WIFI_INTERFACE.pid +fi + +exit 0 diff -r a08b2e53cf96 -r 59bc9f9263f5 nomad/stuff/nomad.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nomad/stuff/nomad.conf Mon Jul 21 20:36:23 2008 +0200 @@ -0,0 +1,42 @@ +## Configuration of nomad. +## You can specify as any places to connect as you want. +## Nomad will recognize them if they follow this format: + +######################################################################## +# Name_I_want() { +# BOOT="yes" or "no" +# TYPE="wifi" or "ethernet" +# +# #if ethernet: +# DHCP="yes" or "no" +# STATIC="yes" or "no" +# IP="192.168.0.6 +# GATEWAY="192.168.0.1" +# DNS_SERVER="192.168.0.1" +# +# #if wifi: +# ESSID="MY-ESSID" +# #if wpa (need wpa_supplicant): +# DRIVER="wext" or "my-wpa-driver" +# WPA=' #my wpa_supplicant configuration, ex: +# ap_scan=1 +# network={ +# ssid="SSID-WICH-NEED-WPA" +# scan_ssid=1 +# proto=WPA +# key_mgmt=WPA-PSK +# psk=52b72d55b8ca0913c5339a2f +# priority=5 +# }' +# #if wep: +# KEY="my-wep-key" +# } +######################################################################## + + +## first, we have to say which interface is ethernet, which is wifi: +INTERFACE="eth0" +WIFI_INTERFACE="wlan0" + +## place here your differents access points: + diff -r a08b2e53cf96 -r 59bc9f9263f5 nomad/stuff/nomadbox --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nomad/stuff/nomadbox Mon Jul 21 20:36:23 2008 +0200 @@ -0,0 +1,195 @@ +#! /bin/sh +# nomad: configure wifi and change acces point easily -- gtkdialog version. + +# Copyright (C) <2008> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. /etc/nomad.conf + +for line in `grep "() {" /etc/nomad.conf | sed "/#.*/d" | sed -e "s/() {//g"` + do + ITEM="$line" + ITEMS="$ITEMS$ITEM" + done + +for linessid in `iwlist $WIFI_INTERFACE scanning | grep "ESSID" | grep -v "" | sed -n 's/ESSID:"//p' | sed -n 's/"//p'` + do + ESSID="$linessid" + ESSIDS="$ESSIDS$ESSID" + done + +export IWCONFIG=' + + + + + + + + iwconfig 2>&1 + + + + + + + +' + +export SCAN=" + + + + + + + + iwlist $WIFI_INTERFACE scanning | grep \"ESSID\|Encryption\|Quality\" | sed -e \"s/^ *ESSID/ESSID/g\" 2>&1 + + + + + + + +" + + + + + +export NOMADBOX=" + + + + + + + + + + + + + + + + + + INTERFACE + $ITEMS + + + + + + + + + + + + + + + + NEWINTERFACE + wlan0 + eth1 + eth0 + + + + + + + NEWESSID + + $ESSIDS + + + + + + + + + NEWKEYTYPE + Without Key + wep + wpa + + + + + + + + DRIVER + wext + + + + + + + NEWKEY + + + + + + + + + + + + +" + +gtkdialog --program=NOMADBOX + +exit 0 diff -r a08b2e53cf96 -r 59bc9f9263f5 nomad/taz/nomad-0.1/files.list --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nomad/taz/nomad-0.1/files.list Mon Jul 21 20:36:23 2008 +0200 @@ -0,0 +1,3 @@ +/etc/nomad.conf +/usr/sbin/nomadbox +/usr/sbin/nomad diff -r a08b2e53cf96 -r 59bc9f9263f5 nomad/taz/nomad-0.1/fs/etc/nomad.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nomad/taz/nomad-0.1/fs/etc/nomad.conf Mon Jul 21 20:36:23 2008 +0200 @@ -0,0 +1,42 @@ +## Configuration of nomad. +## You can specify as any places to connect as you want. +## Nomad will recognize them if they follow this format: + +######################################################################## +# Name_I_want() { +# BOOT="yes" or "no" +# TYPE="wifi" or "ethernet" +# +# #if ethernet: +# DHCP="yes" or "no" +# STATIC="yes" or "no" +# IP="192.168.0.6 +# GATEWAY="192.168.0.1" +# DNS_SERVER="192.168.0.1" +# +# #if wifi: +# ESSID="MY-ESSID" +# #if wpa (need wpa_supplicant): +# DRIVER="wext" or "my-wpa-driver" +# WPA=' #my wpa_supplicant configuration, ex: +# ap_scan=1 +# network={ +# ssid="SSID-WICH-NEED-WPA" +# scan_ssid=1 +# proto=WPA +# key_mgmt=WPA-PSK +# psk=52b72d55b8ca0913c5339a2f +# priority=5 +# }' +# #if wep: +# KEY="my-wep-key" +# } +######################################################################## + + +## first, we have to say which interface is ethernet, which is wifi: +INTERFACE="eth0" +WIFI_INTERFACE="wlan0" + +## place here your differents access points: + diff -r a08b2e53cf96 -r 59bc9f9263f5 nomad/taz/nomad-0.1/fs/usr/sbin/nomad --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nomad/taz/nomad-0.1/fs/usr/sbin/nomad Mon Jul 21 20:36:23 2008 +0200 @@ -0,0 +1,127 @@ +#! /bin/sh +# nomad: configure wifi and change acces point easily. + +# Copyright (C) <2008> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +CONFIG="/etc/nomad.conf" + +. $CONFIG +. /etc/init.d/rc.functions + + +case "$1" in + # we want to configure au new interface + new) + TYPE="wifi" + WIFI_INTERFACE="$2" + ESSID="$3" + KEYTYPE="$4" + KEY="$5" + DRIVER="$6" + if [ "$KEYTYPE" = "wpa" ]; then + WPA=" +ap_scan=1 +network={ + ssid=\"$ESSID\" + scan_ssid=1 + proto=WPA + key_mgmt=WPA-PSK + psk=\"$KEY\" + priority=5 +}" + fi + ;; + + # we want to poweroff wifi + stop) + echo -n "pidof wpa_supplicant: " + if pidof wpa_supplicant; then + echo -n "stopping wpa_supplicant..." + killall wpa_supplicant + status + else + echo "None" + fi + echo -n "power off wifi..." + iwconfig $WIFI_INTERFACE txpower off + status + ;; + + + *) + # we want to join a known access point + if [ "$1" != "" ] && grep -q "$1() {" $CONFIG ; then + $1 # here we launch the function to set variables + # we don't know how to use nomad + else + echo -n -e "\033[01musage:\033[0m `basename $0` [" + for line in `grep "() {" $CONFIG | sed "/#.*/d" | sed -e "s/() {//g"` + do + echo -n "$line|" + done + echo -n "stop]" + echo "" + echo -e "\033[1mOr :\033[0m `basename $0` new \ +WIFI_INTERFACE ESSID KEYTYPE KEY DRIVER" + echo " KEYTYPE is: wpa or wep" + echo " DRIVER is wext or another-wpa_supplicant-driver" + echo "" + exit 1 + fi + ;; +esac + + +#Si ethernet +if [ "$TYPE" = "ethernet" ]; then + if [ "$DHCP" = "yes" ] ; then + echo "Starting udhcpc client on: $INTERFACE... " + /sbin/udhcpc -b -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid + status + fi + # For a static IP. + if [ "$STATIC" = "yes" ] ; then + echo -n "Configuring static IP on $INTERFACE: $IP... " + /sbin/ifconfig $INTERFACE $IP netmask $NETMASK up + /sbin/route add default gateway $GATEWAY + status + # Multi-DNS server in $DNS_SERVER. + /bin/mv /etc/resolv.conf /tmp/resolv.conf.$$ + for NS in $DNS_SERVER + do + echo "nameserver $NS" >> /etc/resolv.conf + done + fi + +#si wifi +elif [ "$TYPE" = "wifi" ]; then + iwconfig $WIFI_INTERFACE txpower on + status + iwconfig $WIFI_INTERFACE essid $ESSID + if [ -n "$WPA" ]; then + echo "$WPA" >/tmp/wpa.conf + echo "starting wpa_supplicant for $INTERFACE..." + wpa_supplicant -B -w -c/tmp/wpa.conf -D$DRIVER -i$WIFI_INTERFACE + status + rm /tmp/wpa.conf + elif [ -n "$KEY" ]; then + iwconfig $WIFI_INTERFACE key $KEY + fi + /sbin/udhcpc -b -i $WIFI_INTERFACE -p /var/run/udhcpc.$WIFI_INTERFACE.pid +fi + +exit 0 diff -r a08b2e53cf96 -r 59bc9f9263f5 nomad/taz/nomad-0.1/fs/usr/sbin/nomadbox --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nomad/taz/nomad-0.1/fs/usr/sbin/nomadbox Mon Jul 21 20:36:23 2008 +0200 @@ -0,0 +1,195 @@ +#! /bin/sh +# nomad: configure wifi and change acces point easily -- gtkdialog version. + +# Copyright (C) <2008> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +. /etc/nomad.conf + +for line in `grep "() {" /etc/nomad.conf | sed "/#.*/d" | sed -e "s/() {//g"` + do + ITEM="$line" + ITEMS="$ITEMS$ITEM" + done + +for linessid in `iwlist $WIFI_INTERFACE scanning | grep "ESSID" | grep -v "" | sed -n 's/ESSID:"//p' | sed -n 's/"//p'` + do + ESSID="$linessid" + ESSIDS="$ESSIDS$ESSID" + done + +export IWCONFIG=' + + + + + + + + iwconfig 2>&1 + + + + + + + +' + +export SCAN=" + + + + + + + + iwlist $WIFI_INTERFACE scanning | grep \"ESSID\|Encryption\|Quality\" | sed -e \"s/^ *ESSID/ESSID/g\" 2>&1 + + + + + + + +" + + + + + +export NOMADBOX=" + + + + + + + + + + + + + + + + + + INTERFACE + $ITEMS + + + + + + + + + + + + + + + + NEWINTERFACE + wlan0 + eth1 + eth0 + + + + + + + NEWESSID + + $ESSIDS + + + + + + + + + NEWKEYTYPE + Without Key + wep + wpa + + + + + + + + DRIVER + wext + + + + + + + NEWKEY + + + + + + + + + + + + +" + +gtkdialog --program=NOMADBOX + +exit 0 diff -r a08b2e53cf96 -r 59bc9f9263f5 nomad/taz/nomad-0.1/md5sum --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nomad/taz/nomad-0.1/md5sum Mon Jul 21 20:36:23 2008 +0200 @@ -0,0 +1,3 @@ +c3f71937dc0ae32b34db0a65f45c069f /etc/nomad.conf +758ada5291678255a3755bab64ca0c67 /usr/sbin/nomadbox +9291dae920d28679e21cc52b99fd3fb1 /usr/sbin/nomad diff -r a08b2e53cf96 -r 59bc9f9263f5 nomad/taz/nomad-0.1/receipt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nomad/taz/nomad-0.1/receipt Mon Jul 21 20:36:23 2008 +0200 @@ -0,0 +1,23 @@ +# SliTaz package receipt. + +PACKED_SIZE="20.0k" +UNPACKED_SIZE="48.0k" +PACKAGE="nomad" +VERSION="0.1" +CATEGORY="extra" +SHORT_DESC="user friendly wifi configure for nomads." +MAINTAINER="sygne@ombres.eu" +DEPENDS="gtkdialog wireless_tools" + + +# Rules to gen a SliTaz package suitable for Tazpkg. +genpkg_rules() +{ + mkdir -p $fs/usr/sbin + cp -a stuff/nomad $fs/usr/sbin/ + cp -a stuff/nomadbox $fs/usr/sbin/ + + mkdir $fs/etc + cp -a stuff/nomad.conf $fs/etc/ +} +