]> git.ipfire.org Git - network.git/commitdiff
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 a0cf5c0bc5e1937495b2e0d5c6e4ad862f7ddd9a..96cb85434aa95ae74cc5a2a0f0b25b02a3852a8c 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 82664fa15376198d712e1fed7267d0025a2d21be..80b550312d5b4e3098cc4763bb891bb03bcf39d1 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 9676369f7eb19411fc3d3478cc99a86964d42398..252858581afbe57b2ec23d2e824f5cbb584744ce 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}")