From 861eee8eea0e852cf7d86d9468f63b7974da4b8e Mon Sep 17 00:00:00 2001 From: Jonatan Schlag Date: Sun, 3 Dec 2023 16:16:55 +0100 Subject: [PATCH] functions.network: Add network_zone_exists As our Network is quite static a case does the trick Signed-off-by: Jonatan Schlag --- src/initscripts/networking/functions.network | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) 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" ] } -- 2.47.2