From e759ffc8b4ce66fe9149b2dd40b7178ab053597b Mon Sep 17 00:00:00 2001 From: David Galloway Date: Thu, 20 Mar 2025 16:34:09 -0400 Subject: [PATCH] tools: Exclude `option host-name` from grep hostname in set-next-server Otherwise, the `linenum=` line gets two line numbers. Signed-off-by: David Galloway --- tools/set-next-server.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/set-next-server.sh b/tools/set-next-server.sh index 866a7d6a..1eb2e765 100644 --- a/tools/set-next-server.sh +++ b/tools/set-next-server.sh @@ -37,7 +37,7 @@ fogip="172.21.0.72" fogfilename="/undionly.kpxe" macaddr=$(sed -n "/host ${host}-front/,/}/p" $dhcpconfig | grep 'hardware ethernet' | awk '{ print $3 }' | tr -d ';') ipaddr=$(sed -n "/host ${host}-front/,/}/p" $dhcpconfig | grep 'fixed-address' | awk '{ print $2 }' | tr -d ';') -linenum=$(grep -n $host $dhcpconfig | cut -d ':' -f1) +linenum=$(grep -n $host $dhcpconfig | grep -v "host-name" | cut -d ':' -f1) if [ -z "$macaddr" ]; then echo "No MAC address found for $host" -- 2.47.3