From: Jonatan Schlag Date: Sun, 3 Dec 2023 15:16:55 +0000 (+0100) Subject: functions.network: Add network_zone_exists X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fimprove_network_startup_4;p=people%2Fjschlag%2Fipfire-2.x.git functions.network: Add network_zone_exists As our Network is quite static a case does the trick Signed-off-by: Jonatan Schlag --- diff --git a/src/initscripts/networking/functions.network b/src/initscripts/networking/functions.network index ab664739ad..67330226aa 100644 --- a/src/initscripts/networking/functions.network +++ b/src/initscripts/networking/functions.network @@ -290,6 +290,28 @@ qmi_assign_address() { ip link set "${intf}" address "${address}" } +network_zone_exists(){ + local zone="${1}" + + case "${zone}" in + "blue") + [ "${CONFIG_TYPE}" = "3" ] || [ "${CONFIG_TYPE}" = "4" ] + ;; + "green") + [ -n "${GREEN_DEV}" ] && [ -v "GREEN_DEV" ] + ;; + "orange") + [ "${CONFIG_TYPE}" = "2" ] || [ "${CONFIG_TYPE}" = "4" ] + ;; + "red") + return ${EXIT_TRUE} + ;; + *) + return ${EXIT_FALSE} + ;; + esac +} + is_blue_used() { [ "${CONFIG_TYPE}" = "3" ] || [ "${CONFIG_TYPE}" = "4" ] }