From f6659cc56ecdef375fb868a3a44ada37b4cbfc3c Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 30 Mar 2019 16:30:05 +0100 Subject: [PATCH] hooks: Use cli_get_bool convenience function where ever possible Signed-off-by: Michael Tremer --- src/hooks/ports/bonding | 11 +---------- src/hooks/ports/ethernet | 11 +---------- src/hooks/ports/wireless-ap | 22 ++-------------------- 3 files changed, 4 insertions(+), 40 deletions(-) diff --git a/src/hooks/ports/bonding b/src/hooks/ports/bonding index a0cf5c0b..96cb8543 100644 --- a/src/hooks/ports/bonding +++ b/src/hooks/ports/bonding @@ -59,16 +59,7 @@ hook_parse_cmdline() { MODE=$(cli_get_val "${1}") ;; --offloading=*) - OFFLOADING="$(cli_get_val "${1}")" - - if enabled OFFLOADING; then - OFFLOADING="on" - elif disabled OFFLOADING; then - OFFLOADING="off" - else - error "Invalid value for offloading: ${OFFLOADING}" - return ${EXIT_ERROR} - fi + OFFLOADING="$(cli_get_bool "${1}")" ;; +*) local slave=$(cli_get_val "${1:1}") diff --git a/src/hooks/ports/ethernet b/src/hooks/ports/ethernet index 82664fa1..80b55031 100644 --- a/src/hooks/ports/ethernet +++ b/src/hooks/ports/ethernet @@ -85,16 +85,7 @@ hook_parse_cmdline() { ;; --offloading=*) - OFFLOADING="$(cli_get_val "${1}")" - - if enabled OFFLOADING; then - OFFLOADING="on" - elif disabled OFFLOADING; then - OFFLOADING="off" - else - error "Invalid value for offloading: ${OFFLOADING}" - return ${EXIT_ERROR} - fi + OFFLOADING="$(cli_get_bool "${1}")" ;; *) diff --git a/src/hooks/ports/wireless-ap b/src/hooks/ports/wireless-ap index 9676369f..25285858 100644 --- a/src/hooks/ports/wireless-ap +++ b/src/hooks/ports/wireless-ap @@ -84,16 +84,7 @@ hook_parse_cmdline() { CHANNEL_BANDWIDTH="$(cli_get_val "${1}")" ;; --dfs=*) - DFS="$(cli_get_val "${1}")" - - if enabled DFS; then - DFS="on" - elif disabled DFS; then - DFS="off" - else - error "Invalid value for DFS: ${DFS}" - return ${EXIT_ERROR} - fi + DFS="$(cli_get_bool "${1}")" ;; --environment=*) ENVIRONMENT="$(cli_get_val "${1}")" @@ -107,16 +98,7 @@ hook_parse_cmdline() { ADDRESS=$(cli_get_val "${1}") ;; --mfp=*) - MFP="$(cli_get_val "${1}")" - - if enabled MFP; then - MFP="on" - elif disabled MFP; then - MFP="off" - else - error "Invalid value for --mfp: ${MFP}" - return ${EXIT_ERROR} - fi + MFP="$(cli_get_bool "${1}")" ;; --mode=*) MODE=$(cli_get_val "${1}") -- 2.39.2