Message ID | 20240302110928.10377-3-jonatan.schlag@ipfire.org |
---|---|
State | New |
Headers |
Return-Path: <development-bounces@lists.ipfire.org> 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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4Tn2Ks2KBcz3wmD for <patchwork@web04.haj.ipfire.org>; Sat, 2 Mar 2024 11:09:53 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4Tn2Kq5vDfz2Jv; Sat, 2 Mar 2024 11:09:51 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4Tn2Kq5Mxgz32gT; Sat, 2 Mar 2024 11:09:51 +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 (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4Tn2Kn6097z32Q8 for <development@lists.ipfire.org>; Sat, 2 Mar 2024 11:09:49 +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 (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4Tn2Kn4x0rz1XD; Sat, 2 Mar 2024 11:09:49 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1709377789; 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=XkvyQLBmEZYz6Q9nNrVpxLPBzqWRnA7pl7HYSTcPH+A=; b=E/6eQlhbxAsTKrfAOghp71CAN2ud44gGsmFEvAni3kq9n9e8oyHEvjT8PFV9fWLW8OLLIu pZdNmCC1YLRpVRAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1709377789; 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=XkvyQLBmEZYz6Q9nNrVpxLPBzqWRnA7pl7HYSTcPH+A=; b=QS/0iogvDk7AI3DNBkrO2hbceHvZrkbPQOCOkY8e1X304thS3xuUowcS0m02hVFRuej7UL I2znAl8trNOv5zQIhnCKT+qlyTnyvBiW7ZCtqbkk+CRKVB46wwN3hfO/pppGXb3CwMIUqx TXgimTdf3fMILNByuZDfs9F5v5pWKTEID4gE/y6pdrGOzcR+k5xtOBdNAnI9FkIMM/RPzr /i3NgezSJqKFn8CwcuKB12pzt8cRsbTx+I0T2MMSHCcZstgzBKPpFKpZYZGoOBybuGYfos aGlFsW3HvP+JulI/QUtVvabJ2//H2CHWOYMBnUhumE0A6kdbpu2k8sVBDfHCFQ== From: Jonatan Schlag <jonatan.schlag@ipfire.org> To: development@lists.ipfire.org Subject: [PATCH 3/5] network initscript: Use network_zone_exists Date: Sat, 2 Mar 2024 12:09:26 +0100 Message-Id: <20240302110928.10377-3-jonatan.schlag@ipfire.org> In-Reply-To: <20240302110928.10377-1-jonatan.schlag@ipfire.org> References: <20240302110928.10377-1-jonatan.schlag@ipfire.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: O5PJV4WW6SIC36XLT6ECL6G6GWH63DM6 X-Message-ID-Hash: O5PJV4WW6SIC36XLT6ECL6G6GWH63DM6 X-MailFrom: jonatan.schlag@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk <development.lists.ipfire.org> Archived-At: <https://lists.ipfire.org/hyperkitty/list/development@lists.ipfire.org/message/O5PJV4WW6SIC36XLT6ECL6G6GWH63DM6/> List-Archive: <https://lists.ipfire.org/hyperkitty/list/development@lists.ipfire.org/> List-Help: <mailto:development-request@lists.ipfire.org?subject=help> List-Owner: <mailto:development-owner@lists.ipfire.org> List-Post: <mailto:development@lists.ipfire.org> List-Subscribe: <mailto:development-join@lists.ipfire.org> List-Unsubscribe: <mailto:development-leave@lists.ipfire.org> |
Series |
[1/5] functions.network: Add proper Exit Codes
|
|
Commit Message
Jonatan Schlag
March 2, 2024, 11:09 a.m. UTC
This only a cosmetic change but should making the code easier changeable
later on.
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
src/initscripts/system/network | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
Comments
Hello, Can we no rewrite this entire script? Even after your fix, I am very unhappy with it. -Michael > On 2 Mar 2024, at 11:09, Jonatan Schlag <jonatan.schlag@ipfire.org> wrote: > > This only a cosmetic change but should making the code easier changeable > later on. > > Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org> > --- > src/initscripts/system/network | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/src/initscripts/system/network b/src/initscripts/system/network > index 0dcce060f..f334561de 100644 > --- a/src/initscripts/system/network > +++ b/src/initscripts/system/network > @@ -21,6 +21,8 @@ > > . /etc/sysconfig/rc > . ${rc_functions} > +. /etc/init.d/networking/functions.network > + > eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) > > DO="${1}" > @@ -54,11 +56,11 @@ case "${DO}" in > [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green start > > # BLUE > - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \ > + [ "$blue" == "1" ] && network_zone_exists "blue" && \ > /etc/rc.d/init.d/networking/blue start > > # ORANGE > - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \ > + [ "$orange" == "1" ] && network_zone_exists "orange" && \ > /etc/rc.d/init.d/networking/orange start > > # RED > @@ -84,16 +86,16 @@ case "${DO}" in > [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green stop > > # BLUE > - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \ > + [ "$blue" == "1" ] && network_zone_exists "blue" && \ > /etc/rc.d/init.d/networking/blue stop > > # ORANGE > - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \ > + [ "$orange" == "1" ] && network_zone_exists "orange" && \ > /etc/rc.d/init.d/networking/orange stop > > # RED > if [ "$red" == "1" ]; then > - if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then > + if network_zone_exists "red"; then > /etc/rc.d/init.d/networking/red stop > fi > fi > -- > 2.39.2 >
Hi, This will happen. But you do not seem to want too many patches at once, so I started to gradually improve it, to avoid a full rewrite. I currently have some trouble getting your point, how big a patch series or the changes should be. Because both ways, full rewrite and gradually improving it seem to be wrong. Jonatan Am 2024-03-11 18:02, schrieb Michael Tremer: > Hello, > > Can we no rewrite this entire script? Even after your fix, I am very > unhappy with it. > > -Michael > >> On 2 Mar 2024, at 11:09, Jonatan Schlag <jonatan.schlag@ipfire.org> >> wrote: >> >> This only a cosmetic change but should making the code easier >> changeable >> later on. >> >> Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org> >> --- >> src/initscripts/system/network | 12 +++++++----- >> 1 file changed, 7 insertions(+), 5 deletions(-) >> >> diff --git a/src/initscripts/system/network >> b/src/initscripts/system/network >> index 0dcce060f..f334561de 100644 >> --- a/src/initscripts/system/network >> +++ b/src/initscripts/system/network >> @@ -21,6 +21,8 @@ >> >> . /etc/sysconfig/rc >> . ${rc_functions} >> +. /etc/init.d/networking/functions.network >> + >> eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) >> >> DO="${1}" >> @@ -54,11 +56,11 @@ case "${DO}" in >> [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green start >> >> # BLUE >> - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" >> ] && \ >> + [ "$blue" == "1" ] && network_zone_exists "blue" && \ >> /etc/rc.d/init.d/networking/blue start >> >> # ORANGE >> - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = >> "4" ] && \ >> + [ "$orange" == "1" ] && network_zone_exists "orange" && \ >> /etc/rc.d/init.d/networking/orange start >> >> # RED >> @@ -84,16 +86,16 @@ case "${DO}" in >> [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green stop >> >> # BLUE >> - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" >> ] && \ >> + [ "$blue" == "1" ] && network_zone_exists "blue" && \ >> /etc/rc.d/init.d/networking/blue stop >> >> # ORANGE >> - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = >> "4" ] && \ >> + [ "$orange" == "1" ] && network_zone_exists "orange" && \ >> /etc/rc.d/init.d/networking/orange stop >> >> # RED >> if [ "$red" == "1" ]; then >> - if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" >> = "3" -o "$CONFIG_TYPE" = "4" ]; then >> + if network_zone_exists "red"; then >> /etc/rc.d/init.d/networking/red stop >> fi >> fi >> -- >> 2.39.2 >>
Okay, keep them coming then :) > On 16 Mar 2024, at 09:46, Jonatan Schlag <jonatan.schlag@ipfire.org> wrote: > > > Hi, > > This will happen. But you do not seem to want too many patches at once, so I started to gradually improve it, to avoid a full rewrite. I currently have some trouble getting your point, how big a patch series or the changes should be. Because both ways, full rewrite and gradually improving it seem to be wrong. > > Jonatan > > > Am 2024-03-11 18:02, schrieb Michael Tremer: >> Hello, >> Can we no rewrite this entire script? Even after your fix, I am very unhappy with it. >> -Michael >>> On 2 Mar 2024, at 11:09, Jonatan Schlag <jonatan.schlag@ipfire.org> wrote: >>> This only a cosmetic change but should making the code easier changeable >>> later on. >>> Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org> >>> --- >>> src/initscripts/system/network | 12 +++++++----- >>> 1 file changed, 7 insertions(+), 5 deletions(-) >>> diff --git a/src/initscripts/system/network b/src/initscripts/system/network >>> index 0dcce060f..f334561de 100644 >>> --- a/src/initscripts/system/network >>> +++ b/src/initscripts/system/network >>> @@ -21,6 +21,8 @@ >>> . /etc/sysconfig/rc >>> . ${rc_functions} >>> +. /etc/init.d/networking/functions.network >>> + >>> eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) >>> DO="${1}" >>> @@ -54,11 +56,11 @@ case "${DO}" in >>> [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green start >>> # BLUE >>> - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \ >>> + [ "$blue" == "1" ] && network_zone_exists "blue" && \ >>> /etc/rc.d/init.d/networking/blue start >>> # ORANGE >>> - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \ >>> + [ "$orange" == "1" ] && network_zone_exists "orange" && \ >>> /etc/rc.d/init.d/networking/orange start >>> # RED >>> @@ -84,16 +86,16 @@ case "${DO}" in >>> [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green stop >>> # BLUE >>> - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \ >>> + [ "$blue" == "1" ] && network_zone_exists "blue" && \ >>> /etc/rc.d/init.d/networking/blue stop >>> # ORANGE >>> - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \ >>> + [ "$orange" == "1" ] && network_zone_exists "orange" && \ >>> /etc/rc.d/init.d/networking/orange stop >>> # RED >>> if [ "$red" == "1" ]; then >>> - if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then >>> + if network_zone_exists "red"; then >>> /etc/rc.d/init.d/networking/red stop >>> fi >>> fi >>> -- >>> 2.39.2
diff --git a/src/initscripts/system/network b/src/initscripts/system/network index 0dcce060f..f334561de 100644 --- a/src/initscripts/system/network +++ b/src/initscripts/system/network @@ -21,6 +21,8 @@ . /etc/sysconfig/rc . ${rc_functions} +. /etc/init.d/networking/functions.network + eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) DO="${1}" @@ -54,11 +56,11 @@ case "${DO}" in [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green start # BLUE - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \ + [ "$blue" == "1" ] && network_zone_exists "blue" && \ /etc/rc.d/init.d/networking/blue start # ORANGE - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \ + [ "$orange" == "1" ] && network_zone_exists "orange" && \ /etc/rc.d/init.d/networking/orange start # RED @@ -84,16 +86,16 @@ case "${DO}" in [ "$green" == "1" ] && /etc/rc.d/init.d/networking/green stop # BLUE - [ "$blue" == "1" ] && [ "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ] && \ + [ "$blue" == "1" ] && network_zone_exists "blue" && \ /etc/rc.d/init.d/networking/blue stop # ORANGE - [ "$orange" == "1" ] && [ "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "4" ] && \ + [ "$orange" == "1" ] && network_zone_exists "orange" && \ /etc/rc.d/init.d/networking/orange stop # RED if [ "$red" == "1" ]; then - if [ "$CONFIG_TYPE" = "1" -o "$CONFIG_TYPE" = "2" -o "$CONFIG_TYPE" = "3" -o "$CONFIG_TYPE" = "4" ]; then + if network_zone_exists "red"; then /etc/rc.d/init.d/networking/red stop fi fi