aboutsummaryrefslogtreecommitdiff
path: root/coWifi
blob: 334eec146150148791252eddd91217b4b42ba06c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32


echo "$@ $*"
if [ -z "$1" ]
then
    for i in `ls /sys/class/net/`; do
        if [ -d "/sys/class/net/$i/wireless" ] ; then 
            interface="$i"
        fi
    done
    if [ -z $interface ] ; then
        echo $'No Wireless interface found\nExit'
        exit 1
    fi
else
    interface="$1"
fi


if [ -z "$2" ]
then
    sudo wpa_supplicant -B "-i${interface}" -D wext -c/etc/wpa_supplicant/wpa_supplicant.conf
else
    if [ -z "$3" ]
    then
        sudo iwconfig "${interface}" essid "$2"
    else
        sudo iwconfig "${interface}" ap "$3"
        sudo iwconfig "${interface}" essid "$2"
    fi
fi
sudo dhcpcd "${interface}"