summaryrefslogtreecommitdiff
path: root/src/initrd
diff options
context:
space:
mode:
Diffstat (limited to 'src/initrd')
-rw-r--r--src/initrd/btrfs-create.sh12
-rw-r--r--src/initrd/common.sh5
-rwxr-xr-xsrc/initrd/grok-block9
3 files changed, 23 insertions, 3 deletions
diff --git a/src/initrd/btrfs-create.sh b/src/initrd/btrfs-create.sh
index 8688560..edd2d1c 100644
--- a/src/initrd/btrfs-create.sh
+++ b/src/initrd/btrfs-create.sh
@@ -1,5 +1,8 @@
1#!/bin/sh 1#!/bin/sh
2 2
3. loop-layer.sh
4. mdadm-dup.sh
5
3losetup() { /sbin/losetup "$@"; } 6losetup() { /sbin/losetup "$@"; }
4 7
5luks_secret() 8luks_secret()
@@ -24,10 +27,15 @@ ceil4()
24 printf '%d\n' "$x" 27 printf '%d\n' "$x"
25} 28}
26 29
27. loop-layer.sh
28
29losetup_layers() 30losetup_layers()
30{ 31{
32 if netbooting; then
33 bootwait samizdat-nbd-dev
34 dd if=/dev/zero of=/nbd0.rw bs=1M count=10
35 dm_snapshot /dev/nbd0 /nbd0.rw
36 return
37 fi
38
31 bootwait samizdat-cdrom 39 bootwait samizdat-cdrom
32 local fs fs_rw 40 local fs fs_rw
33 for fs in /cdrom/rootfs/*.btrfs; do 41 for fs in /cdrom/rootfs/*.btrfs; do
diff --git a/src/initrd/common.sh b/src/initrd/common.sh
index b91bbf9..1471e7c 100644
--- a/src/initrd/common.sh
+++ b/src/initrd/common.sh
@@ -52,6 +52,11 @@ bootmenu()
52 fi 52 fi
53} 53}
54 54
55netbooting()
56{
57 [ "$nbdroot" ]
58}
59
55xtrace() 60xtrace()
56{ 61{
57 case "$-" in 62 case "$-" in
diff --git a/src/initrd/grok-block b/src/initrd/grok-block
index 93770d5..4978a92 100755
--- a/src/initrd/grok-block
+++ b/src/initrd/grok-block
@@ -108,7 +108,14 @@ grok_block()
108 retry_mount $mount_type -o ro "$DEVNAME" "$mountpoint" 108 retry_mount $mount_type -o ro "$DEVNAME" "$mountpoint"
109 fi 109 fi
110 110
111 if mountpoint -q "$mountpoint"; then 111 if [ "$DEVNAME" = /dev/nbd0 ] && mountpoint -q "$mountpoint"; then
112
113 # This is our rootfs, over the network
114 umount "$mountpoint"
115 rmdir "$mountpoint"
116 bootdone samizdat-nbd-dev
117
118 elif mountpoint -q "$mountpoint"; then
112 umount=true 119 umount=true
113 # Device has an unencrypted filesystem on it. 120 # Device has an unencrypted filesystem on it.
114 # So we mount it and look for loop-back overlays. 121 # So we mount it and look for loop-back overlays.