From: Christian Heller Date: Sun, 16 Apr 2017 02:16:54 +0000 (+0200) Subject: In wicd-curses wrapper, start wifi if necessary. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bprefix%7D%7D?a=commitdiff_plain;h=740c8bb35617089451352b4a13b41b3555e2b0ca;p=config In wicd-curses wrapper, start wifi if necessary. --- diff --git a/bin/wicd-wrapper.sh b/bin/wicd-wrapper.sh index 986343a..8ed74bd 100755 --- a/bin/wicd-wrapper.sh +++ b/bin/wicd-wrapper.sh @@ -7,6 +7,12 @@ check_wifi_id_set() { fi } +ensure_wifi_on() { + if [ ! "$(wifi)" = "wifi = on" ]; then + sudo wifi on + fi +} + print_usage() { echo 'Available commands:' echo ' eth_connect' @@ -29,6 +35,7 @@ elif [ "${1}" = 'eth_disconnect' ]; then wicd-cli --wired --disconnect elif [ "${1}" = 'wifi_scan' ]; then + ensure_wifi_on wicd-cli --wireless --scan wicd-cli --wireless --list-networks @@ -46,6 +53,7 @@ elif [ "${1}" = 'wifi_set_wpa' ]; then wicd-cli --wireless --network="${2}" --network-property=key --set-to="${3}" elif [ "${1}" = 'wifi_connect' ]; then + ensure_wifi_on check_wifi_id_set "${2}" wicd-cli --wireless --network="${2}" --connect