From patchwork Thu Dec 1 17:22:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 6238 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 4NNNFv3wTXz3whh for ; Thu, 1 Dec 2022 17:23:31 +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 4NNNFn17XGz2t1; Thu, 1 Dec 2022 17:23:25 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4NNNFm3jNhz30Cf; Thu, 1 Dec 2022 17:23:24 +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 4NNNFk5DKHz2xR5 for ; Thu, 1 Dec 2022 17:23:22 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (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 "michael.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4NNNFj74pFz2QM; Thu, 1 Dec 2022 17:23:21 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4NNNFj59MKzTjnG; Thu, 1 Dec 2022 17:23:21 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 04/29] dhcpcd.exe: Allow using the DHCP setup scripts when RED is not configured as DHCP Date: Thu, 1 Dec 2022 17:22:53 +0000 Message-Id: <20221201172318.3166615-4-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221201172318.3166615-1-michael.tremer@ipfire.org> References: <20221201172318.3166615-1-michael.tremer@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: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This is useful for dial-up methods that use DHCP, but when RED_TYPE is configured as PPP. Signed-off-by: Michael Tremer --- src/initscripts/networking/dhcpcd.exe | 42 +++++++++++++-------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/initscripts/networking/dhcpcd.exe b/src/initscripts/networking/dhcpcd.exe index 38632aa61..8a409d010 100644 --- a/src/initscripts/networking/dhcpcd.exe +++ b/src/initscripts/networking/dhcpcd.exe @@ -34,32 +34,30 @@ dhcpcd_up() fi # Only if RED_TYPE=DHCP update /var/ipfire/red - if [ "$RED_TYPE" == "DHCP" ]; then - # Check if we have to restart the services at update - [ ! -e "/var/ipfire/red/active" ] && update=1; - if [ "$old_domain_name_service" != "$new_domain_name_service" ]; then - update=1; - fi - if [ "$old_ip_address" != "$new_ip_address" ]; then - update=1; - fi - if [ "$old_routers" != "$new_routers" ]; then - update=1; - fi + # Check if we have to restart the services at update + [ ! -e "/var/ipfire/red/active" ] && update=1; + if [ "$old_domain_name_service" != "$new_domain_name_service" ]; then + update=1; + fi + if [ "$old_ip_address" != "$new_ip_address" ]; then + update=1; + fi + if [ "$old_routers" != "$new_routers" ]; then + update=1; + fi - # Get DNS from dhcp - /etc/rc.d/helper/getdnsfromdhcpc.pl 1 > /var/run/dns1 - /etc/rc.d/helper/getdnsfromdhcpc.pl 2 > /var/run/dns2 + # Get DNS from dhcp + /etc/rc.d/helper/getdnsfromdhcpc.pl 1 > /var/run/dns1 + /etc/rc.d/helper/getdnsfromdhcpc.pl 2 > /var/run/dns2 - #Get IP Address - echo -n "$new_ip_address" > /var/ipfire/red/local-ipaddress + #Get IP Address + echo -n "$new_ip_address" > /var/ipfire/red/local-ipaddress - #Get default gateway - grep -v -E "\" /etc/hosts > /tmp/hosts - echo "$new_routers gateway" >> /tmp/hosts - mv /tmp/hosts /etc/hosts + #Get default gateway + grep -v -E "\" /etc/hosts > /tmp/hosts + echo "$new_routers gateway" >> /tmp/hosts + mv /tmp/hosts /etc/hosts - fi if [ $update ]; then [ -e "/var/ipfire/red/active" ] || touch /var/ipfire/red/active echo -n "$new_routers" > /var/ipfire/red/remote-ipaddress