]> git.ipfire.org Git - people/jschlag/ipfire-2.x.git/commitdiff
functions.network: Add network_zone_exists improve_network_startup_4
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Sun, 3 Dec 2023 15:16:55 +0000 (16:16 +0100)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Sun, 3 Dec 2023 15:19:50 +0000 (16:19 +0100)
As our Network is quite static a case does the trick

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
src/initscripts/networking/functions.network

index ab664739ad3e6da129114022f7e57a65c27e992e..67330226aa03e415ccb4647f12c17103bd47ada6 100644 (file)
@@ -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" ]
 }