From 06cf7afbc2646706186f74694d223c392135824a Mon Sep 17 00:00:00 2001 From: Stephan Pillhofer <43667664+StephanPillhofer@users.noreply.github.com> Date: Sat, 29 Oct 2022 17:52:24 +0200 Subject: [PATCH] Fix static IP not set Signed-off-by: Stephan Pillhofer <43667664+StephanPillhofer@users.noreply.github.com> --- automated install/basic-install.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index d4c1ce77..0fda391d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -828,8 +828,11 @@ It is also possible to use a DHCP reservation, but if you are going to do that, # Configure networking via dhcpcd setDHCPCD() { - # Check if the IP is already in the file - if grep -q "${IPV4_ADDRESS}" /etc/dhcpcd.conf; then + # Regex for matching a non-commented static ip address setting + local regex="^[ \t]*static ip_address[ \t]*=[ \t]*${IPV4_ADDRESS}[ \t]*$" + + # Check if static IP is already set in file + if grep -xq "${regex}" /etc/dhcpcd.conf; then printf " %b Static IP already configured\\n" "${INFO}" # If it's not, else