From patchwork Tue May 23 17:23:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 6911 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4h54JRz3wlf for ; Tue, 23 May 2023 17:24:04 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4QQh4h03nHz1V2; Tue, 23 May 2023 17:24:04 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4QQh4g6cVbz30Kd; Tue, 23 May 2023 17:24:03 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4QQh4d1Vrdz2yTC for ; Tue, 23 May 2023 17:24:01 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4QQh4c6YgXz9WM; Tue, 23 May 2023 17:24:00 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1684862640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uB1W/dX60tFKRUVUfnvFW076F0sO+PCSAxrzpqsT/7s=; b=KJ6LdmurMtcNL6KppiX6qaM0NqWJVFDD7ncG3bp/19qWHhuMT7xBZyX/Tuw3jKJrmyUjou YE1A0lt1/TTZ8kBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1684862640; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uB1W/dX60tFKRUVUfnvFW076F0sO+PCSAxrzpqsT/7s=; b=Wo4S8hdEyrl6I9/iDJzATG8Bu2Ss7VO1WK8HbYK36VC3MrgZqD5CBhjBkcXfuLO0h7tyv+ Yw/Bi1rznrKwfFj2h00N04HBfCuV5DKuwnMnKZ6jn+scTlRPxeSdsS6lqSJEURd8AgYHQ+ S8JMSrTOkFFiOUzgLmr5KgHd7HRiM/yZs2Fo84Jor/B7HV4y47xFFUdIigGDskFUog57br ruez3SeawVGKG1DVMwOJqzVS1SR63c8hHtcm9CMBldaj1uYf1GVacCY7aLqvHNy4+FfYKE 4/5DrEnlmVosx6pd3ODUPjqKARRlhDcF3w6N/Xr7WSqtUNKjTa/f8DhESXF3sg== From: Jonatan Schlag To: development@lists.ipfire.org Subject: [Patch RFC 12/15] network script: add extra scripts for action that depend on a network Date: Tue, 23 May 2023 19:23:12 +0200 Message-Id: <20230523172314.7826-13-jonatan.schlag@ipfire.org> In-Reply-To: <20230523172314.7826-1-jonatan.schlag@ipfire.org> References: <20230523172314.7826-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This allows us to split the network startup further up into seperate scripts. The mount of the network filesystems is now done after the startup of the network, but can be delayed further when the network is started through seperate scripts. Signed-off-by: Jonatan Schlag --- config/rootfiles/common/aarch64/initscripts | 4 +++ config/rootfiles/common/riscv64/initscripts | 4 +++ config/rootfiles/common/x86_64/initscripts | 4 +++ lfs/initscripts | 3 ++ src/initscripts/system/depends-on-network | 40 +++++++++++++++++++++ src/initscripts/system/network | 8 ----- 6 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 src/initscripts/system/depends-on-network diff --git a/config/rootfiles/common/aarch64/initscripts b/config/rootfiles/common/aarch64/initscripts index d9f80e6b2..506f616e6 100644 --- a/config/rootfiles/common/aarch64/initscripts +++ b/config/rootfiles/common/aarch64/initscripts @@ -18,6 +18,7 @@ etc/rc.d/init.d/collectd etc/rc.d/init.d/connectd etc/rc.d/init.d/conntrackd etc/rc.d/init.d/console +etc/rc.d/init.d/depends-on-network etc/rc.d/init.d/dhcp etc/rc.d/init.d/dhcrelay etc/rc.d/init.d/fcron @@ -105,6 +106,7 @@ etc/rc.d/rc0.d/K49cyrus-sasl etc/rc.d/rc0.d/K51vnstat etc/rc.d/rc0.d/K77conntrackd etc/rc.d/rc0.d/K78suricata +etc/rc.d/rc0.d/K79depends-on-network etc/rc.d/rc0.d/K79leds etc/rc.d/rc0.d/K80network etc/rc.d/rc0.d/K82wlanclient @@ -128,6 +130,7 @@ etc/rc.d/rc3.d/S15fireinfo etc/rc.d/rc3.d/S19smartenabler etc/rc.d/rc3.d/S19wlanclient etc/rc.d/rc3.d/S20network +etc/rc.d/rc3.d/S21depends-on-network etc/rc.d/rc3.d/S21leds etc/rc.d/rc3.d/S22conntrackd etc/rc.d/rc3.d/S24cyrus-sasl @@ -154,6 +157,7 @@ etc/rc.d/rc6.d/K49cyrus-sasl etc/rc.d/rc6.d/K51vnstat etc/rc.d/rc6.d/K77conntrackd etc/rc.d/rc6.d/K78suricata +etc/rc.d/rc6.d/K79depends-on-network etc/rc.d/rc6.d/K79leds etc/rc.d/rc6.d/K80network etc/rc.d/rc6.d/K82wlanclient diff --git a/config/rootfiles/common/riscv64/initscripts b/config/rootfiles/common/riscv64/initscripts index a4865aa29..e834cbfc3 100644 --- a/config/rootfiles/common/riscv64/initscripts +++ b/config/rootfiles/common/riscv64/initscripts @@ -18,6 +18,7 @@ etc/rc.d/init.d/collectd etc/rc.d/init.d/connectd etc/rc.d/init.d/conntrackd etc/rc.d/init.d/console +etc/rc.d/init.d/depends-on-network etc/rc.d/init.d/dhcp etc/rc.d/init.d/dhcrelay etc/rc.d/init.d/fcron @@ -104,6 +105,7 @@ etc/rc.d/rc0.d/K49cyrus-sasl etc/rc.d/rc0.d/K51vnstat etc/rc.d/rc0.d/K77conntrackd etc/rc.d/rc0.d/K78suricata +etc/rc.d/rc0.d/K79depends-on-network etc/rc.d/rc0.d/K79leds etc/rc.d/rc0.d/K80network etc/rc.d/rc0.d/K82wlanclient @@ -127,6 +129,7 @@ etc/rc.d/rc3.d/S15fireinfo etc/rc.d/rc3.d/S19smartenabler etc/rc.d/rc3.d/S19wlanclient etc/rc.d/rc3.d/S20network +etc/rc.d/rc3.d/S21depends-on-network etc/rc.d/rc3.d/S21leds etc/rc.d/rc3.d/S22conntrackd etc/rc.d/rc3.d/S24cyrus-sasl @@ -153,6 +156,7 @@ etc/rc.d/rc6.d/K49cyrus-sasl etc/rc.d/rc6.d/K51vnstat etc/rc.d/rc6.d/K77conntrackd etc/rc.d/rc6.d/K78suricata +etc/rc.d/rc6.d/K79depends-on-network etc/rc.d/rc6.d/K79leds etc/rc.d/rc6.d/K80network etc/rc.d/rc6.d/K82wlanclient diff --git a/config/rootfiles/common/x86_64/initscripts b/config/rootfiles/common/x86_64/initscripts index a4865aa29..e834cbfc3 100644 --- a/config/rootfiles/common/x86_64/initscripts +++ b/config/rootfiles/common/x86_64/initscripts @@ -18,6 +18,7 @@ etc/rc.d/init.d/collectd etc/rc.d/init.d/connectd etc/rc.d/init.d/conntrackd etc/rc.d/init.d/console +etc/rc.d/init.d/depends-on-network etc/rc.d/init.d/dhcp etc/rc.d/init.d/dhcrelay etc/rc.d/init.d/fcron @@ -104,6 +105,7 @@ etc/rc.d/rc0.d/K49cyrus-sasl etc/rc.d/rc0.d/K51vnstat etc/rc.d/rc0.d/K77conntrackd etc/rc.d/rc0.d/K78suricata +etc/rc.d/rc0.d/K79depends-on-network etc/rc.d/rc0.d/K79leds etc/rc.d/rc0.d/K80network etc/rc.d/rc0.d/K82wlanclient @@ -127,6 +129,7 @@ etc/rc.d/rc3.d/S15fireinfo etc/rc.d/rc3.d/S19smartenabler etc/rc.d/rc3.d/S19wlanclient etc/rc.d/rc3.d/S20network +etc/rc.d/rc3.d/S21depends-on-network etc/rc.d/rc3.d/S21leds etc/rc.d/rc3.d/S22conntrackd etc/rc.d/rc3.d/S24cyrus-sasl @@ -153,6 +156,7 @@ etc/rc.d/rc6.d/K49cyrus-sasl etc/rc.d/rc6.d/K51vnstat etc/rc.d/rc6.d/K77conntrackd etc/rc.d/rc6.d/K78suricata +etc/rc.d/rc6.d/K79depends-on-network etc/rc.d/rc6.d/K79leds etc/rc.d/rc6.d/K80network etc/rc.d/rc6.d/K82wlanclient diff --git a/lfs/initscripts b/lfs/initscripts index e078632ab..263292da9 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -103,6 +103,7 @@ $(TARGET) : ln -sf ../init.d/vnstat /etc/rc.d/rc0.d/K51vnstat ln -sf ../init.d/conntrackd /etc/rc.d/rc0.d/K77conntrackd ln -sf ../init.d/suricata /etc/rc.d/rc0.d/K78suricata + ln -sf ../init.d/depends-on-network /etc/rc.d/rc0.d/K79depends-on-network ln -sf ../init.d/leds /etc/rc.d/rc0.d/K79leds ln -sf ../init.d/network /etc/rc.d/rc0.d/K80network ln -sf ../init.d/wlanclient /etc/rc.d/rc0.d/K82wlanclient @@ -124,6 +125,7 @@ $(TARGET) : ln -sf ../init.d/smartenabler /etc/rc.d/rc3.d/S19smartenabler ln -sf ../init.d/wlanclient /etc/rc.d/rc3.d/S19wlanclient ln -sf ../init.d/network /etc/rc.d/rc3.d/S20network + ln -sf ../init.d/depends-on-network /etc/rc.d/rc3.d/S21depends-on-network ln -sf ../init.d/leds /etc/rc.d/rc3.d/S21leds ln -sf ../init.d/conntrackd /etc/rc.d/rc3.d/S22conntrackd ln -sf ../init.d/cyrus-sasl /etc/rc.d/rc3.d/S24cyrus-sasl @@ -148,6 +150,7 @@ $(TARGET) : ln -sf ../init.d/vnstat /etc/rc.d/rc6.d/K51vnstat ln -sf ../init.d/conntrackd /etc/rc.d/rc6.d/K77conntrackd ln -sf ../init.d/suricata /etc/rc.d/rc6.d/K78suricata + ln -sf ../init.d/depends-on-network /etc/rc.d/rc6.d/K79depends-on-network ln -sf ../init.d/leds /etc/rc.d/rc6.d/K79leds ln -sf ../init.d/network /etc/rc.d/rc6.d/K80network ln -sf ../init.d/wlanclient /etc/rc.d/rc6.d/K82wlanclient diff --git a/src/initscripts/system/depends-on-network b/src/initscripts/system/depends-on-network new file mode 100644 index 000000000..777a2dbd1 --- /dev/null +++ b/src/initscripts/system/depends-on-network @@ -0,0 +1,40 @@ +#!/bin/bash +######################################################################## +# Begin $rc_base/init.d/depends-on-network +# +# Description : Script to execute actions after complete network startup +# +# Notes : Written for IPFire by its team +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +DO="${1}" +shift + +case "${DO}" in + start) + boot_mesg "Mounting network file systems..." + mount -a -O _netdev + evaluate_retval + ;; + + stop) + boot_mesg "Umounting network file systems..." + umount -a -O _netdev + evaluate_retval + ;; + restart) + ${0} stop + sleep 1 + ${0} start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + +# End /etc/rc.d/init.d/depends-on-network diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 0db64eaad..e3fe47597 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -75,17 +75,9 @@ case "${DO}" in 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 - evaluate_retval ;; stop) - boot_mesg "Umounting network file systems..." - umount -a -O _netdev - evaluate_retval - # Stopping interfaces... for i in "${VALID_ZONES[@]}"; do ${ZONE_ACTION[${i}]} && /etc/rc.d/init.d/networking/${i} stop