7 if [ ! "$(wifi)" = "wifi = on" ]; then
9 ip link set "$wifi_interface" up
13 if ! echo "${1}"; then
14 echo 'No command given.'
17 elif [ "${1}" = 'eth_connect' ]; then
18 ip link set "$eth_interface" up
19 dhclient "$eth_interface"
21 elif [ "${1}" = 'eth_disconnect' ]; then
22 ip link set "$eth_interface" down
24 elif [ "${1}" = 'wifi_scan' ]; then
26 ip link set "$wifi_interface" up
27 iw dev "$wifi_interface" scan | grep SSID
29 elif [ "${1}" = 'wifi_connect_open' ]; then
31 iw dev "$wifi_interface" connect "${2}"
32 dhclient "$wifi_interface"
33 #ip route delete default
34 #ip route add default via 192.168.1.1 dev wls1
36 elif [ "${1}" = 'wifi_connect_wep_ascii' ]; then
38 iw dev "$wifi_interface" connect "${2}" key 0:"${3}"
39 dhclient "$wifi_interface"
41 elif [ "${1}" = 'wifi_connect_wep_hex' ]; then
43 iw dev "$wifi_interface" connect "${2}" key d:0:"${3}"
44 dhclient "$wifi_interface"
46 elif [ "${1}" = 'wifi_connect_wpa' ]; then
48 wpa_passphrase "${2}" "${3}" > /tmp/wpa_supplicant.conf
49 wpa_supplicant -B -i "$wifi_interface" -c /tmp/wpa_supplicant.conf
50 dhclient "$wifi_interface"
52 elif [ "${1}" = 'wifi_disconnect' ]; then
53 ip link set "$wifi_interface" down
56 echo 'Available commands:'
58 echo ' eth_disconnect'
60 echo ' wifi_connect_open SSID'
61 echo ' wifi_connect_wep_ascii SSID KEY'
62 echo ' wifi_connect_wep_hex SSID KEY'
63 echo ' wifi_connect_wpa SSID KEY'
64 echo ' wifi_disconnect'