121229
From 927428e6a5e90b2214ee9edf15d4eb6c0fc5c203 Mon Sep 17 00:00:00 2001
121229
From: Kairui Song <kasong@redhat.com>
121229
Date: Mon, 11 Mar 2019 18:44:02 +0800
121229
Subject: [PATCH] squash: squash systemd binary and udevadm
121229
121229
systemd binary and udevadm are not needed to be outside the squash
121229
image. Some binaries are kept outside because they are required before
121229
mounting the image, or after umounting the image (when switching root),
121229
or they may block umounting the image. But we are using lazy umounting,
121229
so actually nothing will block the umount.
121229
121229
Keep more binaries outside the squash image won't hurt but cost extra
121229
memories, the idea of squash image is to save memory usage.
121229
121229
So, there is no reason to keep udevadm outside, that should be a debug
121229
left over. For systemd binary, it's running when switch root happens,
121229
But we have lazy umounted the image and overlay, once systemd process
121229
exec the new systemd in new root, everything will be cleared by kernel.
121229
121229
Also tidy up the comment make it less confussing.
121229
121229
Signed-off-by: Kairui Song <kasong@redhat.com>
121229
(cherry picked from commit e1e1f6e8e6747d8f32c065e267e0a57587818c9e)
121229
121229
Resolves: #1691705
121229
---
121229
 dracut.sh | 8 +++++---
121229
 1 file changed, 5 insertions(+), 3 deletions(-)
121229
121229
diff --git a/dracut.sh b/dracut.sh
121229
index e683a9bc..a0158f22 100755
121229
--- a/dracut.sh
121229
+++ b/dracut.sh
121229
@@ -1772,9 +1772,11 @@ if dracut_module_included "squash"; then
121229
         mv $initdir/$folder $squash_dir/$folder
121229
     done
121229
 
121229
-    # Reinstall required files, because we have moved some important folders to $squash_dir
121229
-    inst_multiple "echo" "sh" "mount" "modprobe" "mkdir" \
121229
-        "systemctl" "udevadm" "$systemdutildir/systemd"
121229
+    # Reinstall required files for the squash image setup script.
121229
+    # We have moved them inside the squashed image, but they need to be
121229
+    # accessible before mounting the image. Also install systemctl,
121229
+    # it's requires for switch-root, but we will umount the image before switch-root
121229
+    inst_multiple "echo" "sh" "mount" "modprobe" "mkdir" "systemctl"
121229
     hostonly="" instmods "loop" "squashfs" "overlay"
121229
 
121229
     for folder in "${squash_candidate[@]}"; do
121229