[RFC,08/15] network startup: Always cleanup before red gets started

Message ID 20230523172314.7826-9-jonatan.schlag@ipfire.org
State Changes Requested
Headers
Series [RFC,01/15] Remove ipsec interface creation from network startup |

Commit Message

Jonatan Schlag May 23, 2023, 5:23 p.m. UTC
  There is no sense in doing this only in /etc/init.d/network
and not in /etc/init.d/networking/red

This files should be always deleted before a startup

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
 src/initscripts/networking/red | 3 +++
 src/initscripts/system/network | 6 +-----
 2 files changed, 4 insertions(+), 5 deletions(-)
  

Comments

Michael Tremer May 24, 2023, 9 a.m. UTC | #1
Agreed. Stuff for RED should be in its own script.

> On 23 May 2023, at 18:23, Jonatan Schlag <jonatan.schlag@ipfire.org> wrote:
> 
> There is no sense in doing this only in /etc/init.d/network
> and not in /etc/init.d/networking/red
> 
> This files should be always deleted before a startup
> 
> Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
> ---
> src/initscripts/networking/red | 3 +++
> src/initscripts/system/network | 6 +-----
> 2 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/src/initscripts/networking/red b/src/initscripts/networking/red
> index 8e41314b6..3873974ea 100644
> --- a/src/initscripts/networking/red
> +++ b/src/initscripts/networking/red
> @@ -80,6 +80,9 @@ fi
> 
> case "${1}" in
> start)
> + # Remove possible leftover files
> + rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
> +
> if [ "${DEVICE}" != "${GREEN_DEV}" ] && [ "${DEVICE}" != "" ]; then
> boot_mesg "Bringing up the ${DEVICE} interface..."
> boot_mesg_flush
> diff --git a/src/initscripts/system/network b/src/initscripts/system/network
> index b346d487c..9694165f2 100644
> --- a/src/initscripts/system/network
> +++ b/src/initscripts/system/network
> @@ -60,11 +60,7 @@ case "${DO}" in
> [ "$orange" == "1" ] && /etc/rc.d/init.d/networking/orange start
> 
> # RED
> - if [ "$red" == "1" ]; then
> - # Remove possible leftover files
> - rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
> - /etc/rc.d/init.d/networking/red start
> - fi
> + [ "$red" == "1" ] && /etc/rc.d/init.d/networking/red start
> 
> boot_mesg "Mounting network file systems..."
> mount -a -O _netdev
> -- 
> 2.30.2
>
  

Patch

diff --git a/src/initscripts/networking/red b/src/initscripts/networking/red
index 8e41314b6..3873974ea 100644
--- a/src/initscripts/networking/red
+++ b/src/initscripts/networking/red
@@ -80,6 +80,9 @@  fi
 
 case "${1}" in
 	start)
+		# Remove possible leftover files
+		rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
+
 		if [ "${DEVICE}" != "${GREEN_DEV}" ] && [ "${DEVICE}" != "" ]; then
 			boot_mesg "Bringing up the ${DEVICE} interface..."
 			boot_mesg_flush
diff --git a/src/initscripts/system/network b/src/initscripts/system/network
index b346d487c..9694165f2 100644
--- a/src/initscripts/system/network
+++ b/src/initscripts/system/network
@@ -60,11 +60,7 @@  case "${DO}" in
 		[ "$orange" == "1" ] && /etc/rc.d/init.d/networking/orange start
 
 		# RED
-		if [ "$red" == "1" ]; then
-			# Remove possible leftover files
-			rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
-			/etc/rc.d/init.d/networking/red start
-		fi
+		[ "$red" == "1" ] && /etc/rc.d/init.d/networking/red start
 
 		boot_mesg "Mounting network file systems..."
 		mount -a -O _netdev