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"
34 elif [ "${1}" = 'wifi_connect_wep_ascii' ]; then
36 iw dev "$wifi_interface" connect "${2}" key 0:"${3}"
37 #dhclient "$wifi_interface"
39 elif [ "${1}" = 'wifi_connect_wep_hex' ]; then
41 iw dev "$wifi_interface" connect "${2}" key d:0:"${3}"
42 #dhclient "$wifi_interface"
44 elif [ "${1}" = 'wifi_connect_wpa' ]; then
46 wpa_passphrase "${2}" "${3}" > /tmp/wpa_supplicant.conf
47 wpa_supplicant -B -i "$wifi_interface" -c /tmp/wpa_supplicant.conf
48 dhclient "$wifi_interface"
50 elif [ "${1}" = 'wifi_disconnect' ]; then
51 ip link set "$wifi_interface" down
54 echo 'Available commands:'
56 echo ' eth_disconnect'
58 echo ' wifi_connect_open SSID'
59 echo ' wifi_connect_wep_ascii SSID KEY'
60 echo ' wifi_connect_wep_hex SSID KEY'
61 echo ' wifi_connect_wpa SSID KEY'
62 echo ' wifi_disconnect'