From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 13/15] network startup: Add scripts for local and uplink Date: Tue, 23 May 2023 19:23:13 +0200 Message-ID: <20230523172314.7826-14-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7025433013565451149==" List-Id: --===============7025433013565451149== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This allows us to start the local and uplink network independent of each other. The function of /etc/init.d/network remains unchangend to maintain backwards compatibility. Signed-off-by: Jonatan Schlag --- config/rootfiles/common/aarch64/initscripts | 2 ++ config/rootfiles/common/riscv64/initscripts | 2 ++ config/rootfiles/common/x86_64/initscripts | 2 ++ lfs/initscripts | 3 +++ src/initscripts/system/network | 22 ++++++++++++--------- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/config/rootfiles/common/aarch64/initscripts b/config/rootfiles/c= ommon/aarch64/initscripts index 506f616e6..739503ae6 100644 --- a/config/rootfiles/common/aarch64/initscripts +++ b/config/rootfiles/common/aarch64/initscripts @@ -36,6 +36,8 @@ etc/rc.d/init.d/mountfs etc/rc.d/init.d/mountkernfs etc/rc.d/init.d/mounttmpfs etc/rc.d/init.d/network +etc/rc.d/init.d/network-local +etc/rc.d/init.d/network-uplink #etc/rc.d/init.d/networking etc/rc.d/init.d/networking/any etc/rc.d/init.d/networking/blue diff --git a/config/rootfiles/common/riscv64/initscripts b/config/rootfiles/c= ommon/riscv64/initscripts index e834cbfc3..ed1eae904 100644 --- a/config/rootfiles/common/riscv64/initscripts +++ b/config/rootfiles/common/riscv64/initscripts @@ -36,6 +36,8 @@ etc/rc.d/init.d/mountfs etc/rc.d/init.d/mountkernfs etc/rc.d/init.d/mounttmpfs etc/rc.d/init.d/network +etc/rc.d/init.d/network-local +etc/rc.d/init.d/network-uplink #etc/rc.d/init.d/networking etc/rc.d/init.d/networking/any etc/rc.d/init.d/networking/blue diff --git a/config/rootfiles/common/x86_64/initscripts b/config/rootfiles/co= mmon/x86_64/initscripts index e834cbfc3..ed1eae904 100644 --- a/config/rootfiles/common/x86_64/initscripts +++ b/config/rootfiles/common/x86_64/initscripts @@ -36,6 +36,8 @@ etc/rc.d/init.d/mountfs etc/rc.d/init.d/mountkernfs etc/rc.d/init.d/mounttmpfs etc/rc.d/init.d/network +etc/rc.d/init.d/network-local +etc/rc.d/init.d/network-uplink #etc/rc.d/init.d/networking etc/rc.d/init.d/networking/any etc/rc.d/init.d/networking/blue diff --git a/lfs/initscripts b/lfs/initscripts index 263292da9..e8a2e4c6e 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -193,6 +193,9 @@ $(TARGET) : ln -sf any /etc/rc.d/init.d/networking/$$i; \ done =20 + ln -sf /etc/rc.d/init.d/network /etc/rc.d/init.d/network-local + ln -sf /etc/rc.d/init.d/networking/red /etc/rc.d/init.d/network-uplink + # intel intel no swconfig ifeq "$(BUILD_PLATFORM)" "arm" ln -sf ../init.d/swconfig /etc/rc.d/rcsysinit.d/S73swconfig diff --git a/src/initscripts/system/network b/src/initscripts/system/network index e3fe47597..ff305e472 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -36,20 +36,24 @@ declare -a VALID_ZONES VALID_ZONES+=3D("blue") VALID_ZONES+=3D("green") VALID_ZONES+=3D("orange") -VALID_ZONES+=3D("red") + +# If we are called as /etc/init.d/network also red is a valid zone. +# Otherwise we are called as /etc/init.d/network-local where red +# is invalid. +if [[ "$(basename $0)" =3D=3D "network" ]]; then + VALID_ZONES+=3D("red") +fi =20 declare -A ZONE_ACTION =20 -ZONE_ACTION[blue]=3Dfalse -ZONE_ACTION[green]=3Dfalse -ZONE_ACTION[orange]=3Dfalse -ZONE_ACTION[red]=3Dfalse +for i in "${VALID_ZONES[@]}"; do + ZONE_ACTION[${i}]=3Dfalse +done =20 if [ $# -eq 0 ]; then - ZONE_ACTION[blue]=3Dtrue - ZONE_ACTION[green]=3Dtrue - ZONE_ACTION[orange]=3Dtrue - ZONE_ACTION[red]=3Dtrue + for i in "${VALID_ZONES[@]}"; do + ZONE_ACTION[${i}]=3Dtrue + done fi =20 while [ $# -ne 0 ]; do --=20 2.30.2 --===============7025433013565451149==--