Simplify the squash mount layout. Instead of overlay on each top
directory (/etc, /usr), just mount and switch_root into the squash
image, with a overlay on top of it.
Also install the binaries and setup scripts separately, so the squash
setup code and the squash image content is independent of each other,
all squash setup script and binaries can be deleted safely upon
switch_root.
With this change, previous squash clean up service and other tricky
implementations are all gone.
This commit depends on systemd commits from:
https://github.com/systemd/systemd/pull/18124
Previouly systemd doesn't recognize non-ramfs initramfs, now this is
doable with SYSTEMD_IN_INITRD=lenient
Signed-off-by: Kairui Song <kasong@redhat.com>
When building squash image, squash module forgot to install the new
shutdown.sh, and the shutdown hooks are always skipped on ordinary
shutdown if squash module is enabled.
The new shutdown.sh will remount the squash image and then everything
will just work, but currently re-mounting the squash image on shutdown
may have selinux problem and make the system hang, and there is no
easy way to fix it.
So skip fixing the shutdown.sh not being install problem, instead
just drop the new shutdown.sh, and unsquash the image on ordinary
shutdown, which is safer and should always work.
Signed-off-by: Kairui Song <kasong@redhat.com>
Script enables errexit option (set -e). So if /boot is not a mount point
or is already mounted, then script dies after unsuccessful mount
command. Fix this by always returning successful result.
Dracut claims to have LZ4 support, but trying to use it will result in an xzcat failure at the end due to missing CAT support.
The lz4 command chokes on '--', so abstract that out into the CAT select.
Something similar will need to be done for LZO.
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>