From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 15/29] dhcpcd.exe: Only set gateway when we have received one Date: Thu, 01 Dec 2022 17:23:04 +0000 Message-ID: <20221201172318.3166615-15-michael.tremer@ipfire.org> In-Reply-To: <20221201172318.3166615-1-michael.tremer@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0581480942984579485==" List-Id: --===============0581480942984579485== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Signed-off-by: Michael Tremer --- src/initscripts/networking/dhcpcd.exe | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/initscripts/networking/dhcpcd.exe b/src/initscripts/networki= ng/dhcpcd.exe index c083b8d96..b557bcb12 100644 --- a/src/initscripts/networking/dhcpcd.exe +++ b/src/initscripts/networking/dhcpcd.exe @@ -54,10 +54,12 @@ dhcpcd_up() #Get IP Address echo -n "$new_ip_address" > /var/ipfire/red/local-ipaddress =20 - #Get default gateway - grep -v -E "\" /etc/hosts > /tmp/hosts - echo "$new_routers gateway" >> /tmp/hosts - mv /tmp/hosts /etc/hosts + # Get default gateway + if [ -n "${new_routers}" ]; then + grep -v -E "\" /etc/hosts > /tmp/hosts + echo "$new_routers gateway" >> /tmp/hosts + mv /tmp/hosts /etc/hosts + fi =20 if [ $update ]; then [ -e "/var/ipfire/red/active" ] || touch /var/ipfire/red/active --=20 2.30.2 --===============0581480942984579485==--