hooks: Use cli_get_bool convenience function where ever possible
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 30 Mar 2019 15:30:05 +0000 (16:30 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 30 Mar 2019 15:30:05 +0000 (16:30 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/hooks/ports/bonding
src/hooks/ports/ethernet
src/hooks/ports/wireless-ap

index a0cf5c0..96cb854 100644 (file)
@@ -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}")
index 82664fa..80b5503 100644 (file)
@@ -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}")"
                                ;;
 
                        *)
index 9676369..2528585 100644 (file)
@@ -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}")