Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- src/functions/functions.wireless-networks | 33 +++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-)
diff --git a/src/functions/functions.wireless-networks b/src/functions/functions.wireless-networks index 4fedcb9..b1d65f9 100644 --- a/src/functions/functions.wireless-networks +++ b/src/functions/functions.wireless-networks @@ -24,7 +24,7 @@ WIRELESS_NETWORK_SUPPORTED_PSK_MODES="WPA2-PSK-SHA256 WPA2-PSK WPA-PSK-SHA256 WP WIRELESS_NETWORK_SUPPORTED_MODES="${WIRELESS_NETWORK_SUPPORTED_PSK_MODES} \ 802.1X WPA-EAP NONE"
-WIRELESS_NETWORK_CONFIG_SETTINGS="ANONYMOUS_IDENTITY EAP_MODES HIDDEN \ +WIRELESS_NETWORK_CONFIG_SETTINGS="ANONYMOUS_IDENTITY EAP_MODES ENABLED HIDDEN \ IDENTITY MODES PASSWORD PRIORITY PSK SSID"
cli_wireless_network() { @@ -49,7 +49,7 @@ cli_wireless_network() { local handle="$(wireless_network_hash "${ssid}")"
case "${key}" in - modes|pre_shared_key|priority) + disable|enable|modes|pre_shared_key|priority) wireless_network_${key} "${handle}" "$@" ;; show) @@ -220,6 +220,7 @@ wireless_network_new() { fi
local ${WIRELESS_NETWORK_CONFIG_SETTINGS} + ENABLED="true" MODES="${WIRELESS_NETWORK_SUPPORTED_MODES}" SSID="${ssid}" PRIORITY=0 @@ -251,6 +252,34 @@ wireless_network_destroy() { return ${EXIT_OK} }
+wireless_network_enable() { + if [ ! $# -eq 1 ]; then + log ERROR "Not enough arguments" + return ${EXIT_ERROR} + fi + + local handle="${1}" + + if ! wireless_network_write_config_key "${handle}" "ENABLED" "true"; then + log ERROR "Could not write configuration settings" + return ${EXIT_ERROR} + fi +} + +wireless_network_disable() { + if [ ! $# -eq 1 ]; then + log ERROR "Not enough arguments" + return ${EXIT_ERROR} + fi + + local handle="${1}" + + if ! wireless_network_write_config_key "${handle}" "ENABLED" "false"; then + log ERROR "Could not write configuration settings" + return ${EXIT_ERROR} + fi +} + wireless_networks_mode_is_valid() { assert [ $# -eq 1 ] local mode=${1}