???
On 23 May 2023, at 18:23, Jonatan Schlag jonatan.schlag@ipfire.org wrote:
This gives us more flexibilty for future changes.
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org
src/initscripts/system/network | 43 +++++++++++++--------------------- 1 file changed, 16 insertions(+), 27 deletions(-)
diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 008fbbe2b..0db64eaad 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -31,6 +31,13 @@ if ! [[ "${DO}" == "start" || "${DO}" == "restart" || "${DO}" == "stop" ]]; the exit 1 fi
+declare -a VALID_ZONES
+VALID_ZONES+=("blue") +VALID_ZONES+=("green") +VALID_ZONES+=("orange") +VALID_ZONES+=("red")
declare -A ZONE_ACTION
ZONE_ACTION[blue]=false @@ -47,7 +54,7 @@ fi
while [ $# -ne 0 ]; do ZONE_VALID=false
- for i in green red blue orange; do
- for i in "${VALID_ZONES[@]}"; do
if [ "${i}" == "${1}" ]; then ZONE_ACTION[${i}]=true ZONE_VALID=true @@ -65,17 +72,9 @@ done case "${DO}" in start) # Starting interfaces...
- # GREEN
- ${ZONE_ACTION[green]} && /etc/rc.d/init.d/networking/green start
- # BLUE
- ${ZONE_ACTION[blue]} && /etc/rc.d/init.d/networking/blue start
- # ORANGE
- ${ZONE_ACTION[orange]} && /etc/rc.d/init.d/networking/orange start
- # RED
- ${ZONE_ACTION[red]} && /etc/rc.d/init.d/networking/red start
- for i in "${VALID_ZONES[@]}"; do
- ${ZONE_ACTION[${i}]} && /etc/rc.d/init.d/networking/${i} start
- done
boot_mesg "Mounting network file systems..." mount -a -O _netdev @@ -88,26 +87,16 @@ case "${DO}" in evaluate_retval
# Stopping interfaces...
- # GREEN
- ${ZONE_ACTION[green]} && /etc/rc.d/init.d/networking/green stop
- # BLUE
- ${ZONE_ACTION[blue]} && /etc/rc.d/init.d/networking/blue stop
- # ORANGE
- ${ZONE_ACTION[orange]} && /etc/rc.d/init.d/networking/orange stop
- # RED
- if ${ZONE_ACTION[red]}; then
- /etc/rc.d/init.d/networking/red stop
- fi
- for i in "${VALID_ZONES[@]}"; do
- ${ZONE_ACTION[${i}]} && /etc/rc.d/init.d/networking/${i} stop
- done
exit 0 ;;
restart)
- for i in green red blue orange; do
- if {ZONE_ACTION[${i}]}; then
- for i in "${VALID_ZONES[@]}"; do
- if ${ZONE_ACTION[${i}]}; then
ARGS+=" ${i}" fi done -- 2.30.2