diff options
author | Jonathan Bauer | 2019-08-08 14:55:56 +0200 |
---|---|---|
committer | Jonathan Bauer | 2019-08-08 14:55:56 +0200 |
commit | ce1558966a8481d04f1ff78c1b58a91740513e69 (patch) | |
tree | 58c2042c79d57eea8ecefb413c1da805203a033f /builder/modules.d/slx-network/scripts/setup-bootif-network.stage4 | |
parent | [slx-network] support for dhcp in stage4 (diff) | |
download | systemd-init-ce1558966a8481d04f1ff78c1b58a91740513e69.tar.gz systemd-init-ce1558966a8481d04f1ff78c1b58a91740513e69.tar.xz systemd-init-ce1558966a8481d04f1ff78c1b58a91740513e69.zip |
[slx-network] only care about main bootif
+ rdns
Diffstat (limited to 'builder/modules.d/slx-network/scripts/setup-bootif-network.stage4')
-rwxr-xr-x | builder/modules.d/slx-network/scripts/setup-bootif-network.stage4 | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/builder/modules.d/slx-network/scripts/setup-bootif-network.stage4 b/builder/modules.d/slx-network/scripts/setup-bootif-network.stage4 index 7ccb94e6..bd89fec6 100755 --- a/builder/modules.d/slx-network/scripts/setup-bootif-network.stage4 +++ b/builder/modules.d/slx-network/scripts/setup-bootif-network.stage4 @@ -1,13 +1,18 @@ #!/bin/bash -# For arrays +# +# This script sets up the main network interface we booted from, +# as designated by SLX_PXE_NETIF in /opt/openslx/config +# It will run on either the bridge (SLX_BRIDGE is set) or the +# physical interface directly. export PATH=$PATH:/opt/openslx/sbin:/opt/openslx/bin -. /run/openslx/network.conf +. /opt/openslx/config -net_if="$1" -net_ip="$(ip addr show dev "${net_if}" | grep -m1 '^\s*inet ' | \ - awk -F " " '{print $2}' | awk -F "/" '{print $1}')" +if [ -z "$SLX_PXE_NETIF" ] || [ -z "$SLX_PXE_CLIENT_IP" ]; then + echo "Missing network information of the main boot interface." + exit 1 +fi # set default options declare -a udhcpc_opts @@ -19,16 +24,8 @@ udhcpc_opts+=("-O" "wpad") udhcpc_opts+=("-O" "search") udhcpc_opts+=("-O" "wins") -# need to renew? -if [ -n "$net_ip" ]; then - udhcpc_opts+=( "-r" "$net_ip" ) -fi - -primary="br0" -[ -n "$SLX_BRIDGE" ] && primary="$SLX_BRIDGE" - -# send machine uuid during DHCP if acting on primary interface -if [ "$primary" = "$net_if" ] && [ "$SLX_NET_DHCP_UUID" = "yes" ]; then +# send machine uuid during DHCP if configured +if [ "$SLX_NET_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 @@ -39,7 +36,9 @@ fi mkdir -p /run/udhcpc || echo "Could not create '/run/udhcpc'." -udhcpc "${udhcpc_opts[@]}" -i "${net_if}" \ +udhcpc "${udhcpc_opts[@]}" \ + -i "${SLX_BRIDGE:-${SLX_PXE_NETIF}}" \ + -r "${SLX_PXE_CLIENT_IP}" \ -s /opt/openslx/scripts/udhcpc-trigger \ -p "/run/udhcpc/udhcpc.${net_if}.pid" ret=$? |