4 if ! echo "${1}" | egrep -q '^[0-9]+$'; then
5 echo 'Wifi identifier must be integer.'
11 if [ ! "$(wifi)" = "wifi = on" ]; then
17 echo 'Available commands:'
19 echo ' eth_disconnect'
21 echo ' wifi_info WIFI_ID'
22 echo ' wifi_set_wpa WIFI_ID KEY'
23 echo ' wifi_connect WIFI_ID'
24 echo ' wifi_disconnect'
27 if ! echo "${1}"; then
28 echo 'No command given.'
31 elif [ "${1}" = 'eth_connect' ]; then
32 wicd-cli --wired --connect
34 elif [ "${1}" = 'eth_disconnect' ]; then
35 wicd-cli --wired --disconnect
37 elif [ "${1}" = 'wifi_scan' ]; then
39 wicd-cli --wireless --scan
40 wicd-cli --wireless --list-networks
42 elif [ "${1}" = 'wifi_info' ]; then
43 check_wifi_id_set "${2}"
44 wicd-cli --wireless --network="${2}" --network-details
46 elif [ "${1}" = 'wifi_set_wpa' ]; then
47 check_wifi_id_set "${2}"
48 if ! echo "${3}" ; then
52 wicd-cli --wireless --network="${2}" --network-property=enctype --set-to=wpa
53 wicd-cli --wireless --network="${2}" --network-property=key --set-to="${3}"
55 elif [ "${1}" = 'wifi_connect' ]; then
57 check_wifi_id_set "${2}"
58 wicd-cli --wireless --network="${2}" --connect
60 elif [ "${1}" = 'wifi_disconnect' ]; then
61 wicd-cli --wireless --disconnect
64 echo 'Unknown command.'