From acf9c115b437fc07a3520b4d2542c03f95f57767 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Wed, 19 Jun 2019 16:54:41 -0400 Subject: initramfs: make sure we get $ROOTSERVER propagated --- initramfs-tools/scripts/samizdat | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/initramfs-tools/scripts/samizdat b/initramfs-tools/scripts/samizdat index 5acf266..4f93a7f 100644 --- a/initramfs-tools/scripts/samizdat +++ b/initramfs-tools/scripts/samizdat @@ -3,6 +3,18 @@ klogd -c1 # TODO: This should be even earlier. Can it go on the kernel command . common.sh debug_log samizdat.init +my_configure_networking() +{ + configure_networking + if [ -e /run/net-"$DEVICE".conf ] + then + . /run/net-"$DEVICE".conf + printf 'Note: configure_networking: ROOTSERVER=%s\n', "$ROOTSERVER" >&2 + else + false + fi +} + mountroot() { openvt -c 13 sh @@ -11,7 +23,7 @@ mountroot() samizdat_install_udev_rules if [ "$nbdroot" ]; then - configure_networking + my_configure_networking (debug_log samizdat.nbd . /scripts/local-top/nbd @@ -24,10 +36,9 @@ mountroot() bootmenu bootwait root-mounted - if [ "$IPV4DNS0" ]; then + if [ "$IPV4DNS0" != '0.0.0.0' ]; then printf '%s\n' "$IPV4DNS0" "$IPV4DNS1" | - grep -v 0.0.0.0 | - sed 's/^/nameserver /' > /root/etc/resolv.conf + sed -e '/^0.0.0.0$/d; s/^/nameserver /' > /root/etc/resolv.conf fi chvt 1 } @@ -43,6 +54,7 @@ wait_for_gnupghome_tar() { [ -e /gnupghome.tar ] && return echo -n Waiting to receive GPG keys through the network... + my_configure_networking (while ! tftp -g -r gnupghome.tar -l /gnupghome.tar.$$ "$ROOTSERVER" 2>/run/initramfs/samizdat/log/tftp.$$.log; do sleep 1; echo -n . -- cgit v1.2.3