From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: Re: [Patch RFC 12/15] network script: add extra scripts for action that depend on a network
Date: Wed, 24 May 2023 10:00:43 +0100 [thread overview]
Message-ID: <88995FBC-F59D-4FB7-A399-E4E75D389B41@ipfire.org> (raw)
In-Reply-To: <20230523172314.7826-13-jonatan.schlag@ipfire.org>
[-- Attachment #1: Type: text/plain, Size: 8380 bytes --]
Why is this script breaking with the “one script, one task” philosophy of sysvinit?
It should just be called “mountnetfs” and be called just with the right priority.
> On 23 May 2023, at 18:23, Jonatan Schlag <jonatan.schlag(a)ipfire.org> wrote:
>
> 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 <jonatan.schlag(a)ipfire.org>
> ---
> 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
> --
> 2.30.2
>
next prev parent reply other threads:[~2023-05-24 9:00 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 17:23 Start local and uplink network independent Jonatan Schlag
2023-05-23 17:23 ` [Patch RFC 01/15] Remove ipsec interface creation from network startup Jonatan Schlag
2023-05-24 8:59 ` Michael Tremer
2023-05-23 17:23 ` [Patch RFC 02/15] Remove Start/Stop links for client175 Jonatan Schlag
2023-05-23 17:23 ` [Patch RFC 03/15] Use bash as shebang in network initscripts Jonatan Schlag
2023-05-24 8:59 ` Michael Tremer
2023-05-23 17:23 ` [Patch RFC 04/15] network initscripts: check if the zone in the current config exists Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer
2023-08-18 12:55 ` Jonatan Schlag
2023-08-21 9:40 ` Michael Tremer
2023-05-23 17:23 ` [Patch RFC 05/15] network initscripts: Remove code for old zone scheme Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer
2023-05-23 17:23 ` [Patch RFC 06/15] network scripts: remove check for AUTOCONNECT Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer
2023-05-23 17:23 ` [Patch RFC 07/15] network startup: Reload routing informations for every interface Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer
2023-05-23 17:23 ` [Patch RFC 08/15] network startup: Always cleanup before red gets started Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer
2023-05-23 17:23 ` [Patch RFC 09/15] network startup: check for correct action at start Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer
2023-08-18 10:23 ` Jonatan Schlag
2023-05-23 17:23 ` [Patch RFC 10/15] network startup: Refactor how cmd args are processed Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer
2023-05-23 17:23 ` [Patch RFC 11/15] network startup: Clean up duplicated Code Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer
2023-05-23 17:23 ` [Patch RFC 12/15] network script: add extra scripts for action that depend on a network Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer [this message]
2023-05-23 17:23 ` [Patch RFC 13/15] network startup: Add scripts for local and uplink Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer
2023-05-23 17:23 ` [Patch RFC 14/15] network startup: Start local and uplink network independent Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer
2023-05-23 17:23 ` [Patch RFC 15/15] network startup: Only work with configured zones Jonatan Schlag
2023-05-24 9:00 ` Michael Tremer
2023-05-24 8:59 ` Start local and uplink network independent Michael Tremer
2023-08-18 10:30 ` Jonatan Schlag
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=88995FBC-F59D-4FB7-A399-E4E75D389B41@ipfire.org \
--to=michael.tremer@ipfire.org \
--cc=development@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox