]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
squash: squash systemd binary and udevadm
authorKairui Song <kasong@redhat.com>
Mon, 11 Mar 2019 10:44:02 +0000 (18:44 +0800)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 19 Jul 2019 13:38:54 +0000 (15:38 +0200)
systemd binary and udevadm are not needed to be outside the squash
image. Some binaries are kept outside because they are required before
mounting the image, or after umounting the image (when switching root),
or they may block umounting the image. But we are using lazy umounting,
so actually nothing will block the umount.

Keep more binaries outside the squash image won't hurt but cost extra
memories, the idea of squash image is to save memory usage.

So, there is no reason to keep udevadm outside, that should be a debug
left over. For systemd binary, it's running when switch root happens,
But we have lazy umounted the image and overlay, once systemd process
exec the new systemd in new root, everything will be cleared by kernel.

Also tidy up the comment make it less confussing.

Signed-off-by: Kairui Song <kasong@redhat.com>
dracut.sh

index 41fd76f9aa658ddd6a62d108230bb83f11caf5f8..017a7a3bd5b6e6c6753784d269b8708c3da1d369 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -1772,9 +1772,11 @@ if dracut_module_included "squash"; then
         mv $initdir/$folder $squash_dir/$folder
     done
 
-    # Reinstall required files, because we have moved some important folders to $squash_dir
-    inst_multiple "echo" "sh" "mount" "modprobe" "mkdir" \
-        "systemctl" "udevadm" "$systemdutildir/systemd"
+    # Reinstall required files for the squash image setup script.
+    # We have moved them inside the squashed image, but they need to be
+    # accessible before mounting the image. Also install systemctl,
+    # it's requires for switch-root, but we will umount the image before switch-root
+    inst_multiple "echo" "sh" "mount" "modprobe" "mkdir" "systemctl"
     hostonly="" instmods "loop" "squashfs" "overlay"
 
     for folder in "${squash_candidate[@]}"; do