summaryrefslogtreecommitdiff
path: root/initramfs-tools
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2017-03-28 16:07:09 -0400
committerAndrew Cady <d@jerkface.net>2017-03-28 16:12:28 -0400
commit5160fd50cf2bf09700c20236cac992a7a85fc943 (patch)
treec4bef4cc1b8a0635222cf83b4927f5fdcdedf635 /initramfs-tools
parent2a575328ac1432c21e0b983d2432f1f64dff0f96 (diff)
Use pxelinux "ipappend" option to choose rootfs source
This fixes the issue described in the first 'netkeys' commit, where the network would need to be available even when it was not used. The "ipappend" option results in a $BOOTIF variable in the initrd environment. This variable is now used to determine whether to wait on the network for a rootfs & keys, or to wait on the boot device becoming available to determine whether it has the keys. That is, there may or may not be a boot device which may or may not have keys and/or rootfs, but we will always know for sure whether it does, therefore there are no races and no waiting on the network unnecessarily. The qemu.sh script was updated to provide the BOOTIF variable when PXE boot is emulated.
Diffstat (limited to 'initramfs-tools')
-rw-r--r--initramfs-tools/scripts/samizdat19
1 files changed, 14 insertions, 5 deletions
diff --git a/initramfs-tools/scripts/samizdat b/initramfs-tools/scripts/samizdat
index 515b724..a42b321 100644
--- a/initramfs-tools/scripts/samizdat
+++ b/initramfs-tools/scripts/samizdat
@@ -8,20 +8,29 @@ mountroot()
8 samizdat_install_udev_rules 8 samizdat_install_udev_rules
9 9
10 if [ "${nbdroot%%,*}" ]; then 10 if [ "${nbdroot%%,*}" ]; then
11 # I guess this isn't getting called otherwise? I don't know why this should 11 (. common.sh
12 # be necessary, but it is. 12 sh /scripts/local-top/nbd >/dev/null 2>&1;
13 sh /scripts/local-top/nbd >/dev/null 2>&1 13 bootdone nbd-script) &
14 fi 14 fi
15 15
16 if keys_via_network; then 16 if ! cdrom_has_keys && keys_via_network; then
17 wait_for_gnupghome_tar "$tftp_key_server" 17 bootwait nbd-script
18 wait_for_gnupghome_tar "$tftp_key_server"
18 fi 19 fi
20
19 bootwait samizdat-gpg 21 bootwait samizdat-gpg
20 bootmenu 22 bootmenu
21 bootwait root-mounted 23 bootwait root-mounted
22 chvt 1 24 chvt 1
23} 25}
24 26
27cdrom_has_keys()
28{
29 [ ! "$BOOTIF" ] || return
30 bootwait samizdat-cdrom
31 [ -d /cdrom/gnupghome ]
32}
33
25# Sets $tftp_key_server or returns false. 34# Sets $tftp_key_server or returns false.
26keys_via_network() 35keys_via_network()
27{ 36{