Browse Source

dracut-ramdisk: fix support for elements with ramdisk-install.d

Copy all of TMP_MOUNT_PATH into the ramdisk so that
ramdisk-install.d actions are respected.

Includes a workaround for a bug in Dracut that caused the copy
to fail.

Also moves init instead of copying it so we don't conflict with
the Dracut init.

Change-Id: Ia8d7b210369fe7eb7ab239cbdb7f96841104a35d
Closes-Bug: 1403121
tags/0.1.39
Erwan Velu 4 years ago
parent
commit
75b34baa98
1 changed files with 9 additions and 2 deletions
  1. 9
    2
      elements/dracut-ramdisk/post-install.d/99-build-dracut-ramdisk

+ 9
- 2
elements/dracut-ramdisk/post-install.d/99-build-dracut-ramdisk View File

@@ -35,7 +35,14 @@ populate_init
35 35
 SCRIPT_HOME=/tmp/in_target.d/bin TMP_HOOKS_PATH=/tmp/in_target.d run_d ramdisk-install
36 36
 MODULE_PATH="/usr/lib/dracut/modules.d"
37 37
 cp -r "$MODULE" "$MODULE_PATH/80deploy-ramdisk"
38
-cp "$TMP_MOUNT_PATH/init" "$MODULE_PATH/80deploy-ramdisk/init.sh"
38
+mv "$TMP_MOUNT_PATH/init" "$MODULE_PATH/80deploy-ramdisk/init.sh"
39
+
40
+# NOTE(bnemec): Workaround for bug in Dracut.  This fix has been proposed to
41
+# Dracut as well in https://github.com/haraldh/dracut/pull/34 , and once it has
42
+# been released for all of our supported platforms we can remove this.  Until then
43
+# this makes --include work correctly and will be a noop if we're running a fixed
44
+# Dracut version.
45
+sed -i 's|cp --reflink=auto --sparse=auto -fa -t "$s" "$i"$|cp --reflink=auto --sparse=auto -fa -t "${initdir}/${tgt}" "$i"|g' $(which dracut)
39 46
 
40 47
 # Notes on the options passed to Dracut:
41 48
 # -N: Do not build a host-specific ramdisk.  We want to be able to run this ramdisk
@@ -53,7 +60,7 @@ cp "$TMP_MOUNT_PATH/init" "$MODULE_PATH/80deploy-ramdisk/init.sh"
53 60
 dracut -N \
54 61
     --install "$(cat /etc/dib_binary_deps)" \
55 62
     --kernel-cmdline "rd.shell rd.debug rd.neednet=1 rd.driver.pre=ahci" \
56
-    --include "$TMP_MOUNT_PATH/init-func" /init-func \
63
+    --include "$TMP_MOUNT_PATH/" / \
57 64
     --kver "${KERNEL_VERSION}" \
58 65
     --add-drivers "virtio virtio_net virtio_blk" \
59 66
     -o "dash plymouth" \

Loading…
Cancel
Save