From afa1dfc1835a8bdbd9774dcb576d27f28f77ef7a Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 11 Nov 2019 15:05:15 +0100 Subject: [slx-network] fix args passing to udhcpc --- .../slx-network/scripts/setup-bootif-network.stage3 | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/builder/modules.d/slx-network/scripts/setup-bootif-network.stage3 b/builder/modules.d/slx-network/scripts/setup-bootif-network.stage3 index 53ad8de9..dad3e84c 100755 --- a/builder/modules.d/slx-network/scripts/setup-bootif-network.stage3 +++ b/builder/modules.d/slx-network/scripts/setup-bootif-network.stage3 @@ -88,17 +88,28 @@ if [ -n "$SLX_PXE_CLIENT_IP" ]; then dev "$MAIN_NETIF" fi -if [ "$USE_DHCP_UUID" = "yes" ] && [ -s "/run/system-uuid" ]; then - UUID="$(cat /run/system-uuid)" +ADDOPTS=() + +# we need to send the same UID (without '-') as the PXE firmware did, so use the plain +# one read with dmidecode (and not the one by get-system-uuid). +if [ "$USE_DHCP_UUID" = "yes" ]; then + UID="$(dmidecode -s system-uuid | sed -r 's/^(..)(..)(..)(..)-(..)(..)-(..)(..)-(....)-/00\4\3\2\1\6\5\8\7\9/')" + if [ "${#UID}" = 34 ]; then + echo "Using SMBIOS UID for DHCP" + ADDOPTS+=("-x" "0x3d:$UID") + fi +fi + +if [ -n "$SLX_PXE_CLIENT_IP" ]; then + ADDOPTS+=("-r" "$SLX_PXE_CLIENT_IP") fi # udhcpc for i in 1 1 1 fail; do [ "$i" = "fail" ] && emergency_shell "DHCP failed 3 times... cannot continue." udhcpc -t 4 -T 3 -f -n -q \ + "${ADDOPTS[@]}" \ -i "${MAIN_NETIF}" \ - "${SLX_PXE_CLIENT_IP:+-r $SLX_PXE_CLIENT_IP}" \ - "${UUID:+-x 0x3d:$UUID}" \ -O ntpsrv -O domain -O wpad -O search -O nisdomain \ -s "/usr/local/bin/udhcpc-trigger" # success? @@ -110,3 +121,5 @@ done set +x } &>> "/run/openslx/initramfs-network.log.$$" + + -- cgit v1.2.3-55-g7522