feat(squash): install and depmod modules seperately

Separately install the modules required for squash image setup.
These modules can be deleted after squash image setup to save
memory.

Signed-off-by: Kairui Song <kasong@redhat.com>
master
Kairui Song 2021-02-15 22:58:20 +08:00 committed by Jóhann B. Guðmundsson
parent f9f4264d03
commit 5a18b24a8b
2 changed files with 8 additions and 7 deletions

View File

@ -34,6 +34,9 @@ if [ $? != 0 ]; then
echo "Unable to setup overlay module" echo "Unable to setup overlay module"
fi fi


# These modules are no longer needed, delete to save memory
rm -rf /usr/lib/modules/

[ ! -d "$SQUASH_MNT" ] && \ [ ! -d "$SQUASH_MNT" ] && \
mkdir -m 0755 -p $SQUASH_MNT mkdir -m 0755 -p $SQUASH_MNT



View File

@ -18,10 +18,6 @@ depends() {
return 0 return 0
} }


installkernel() {
hostonly="" instmods squashfs loop overlay
}

installpost() { installpost() {
local squash_candidate=( "usr" "etc" ) local squash_candidate=( "usr" "etc" )


@ -36,7 +32,6 @@ installpost() {
# - Files need to be accessible without mounting the squash image # - Files need to be accessible without mounting the squash image
# - Initramfs marker # - Initramfs marker
for file in \ for file in \
"$squash_dir"/usr/lib/modules/*/modules.* \
"$squash_dir"/usr/lib/dracut/* \ "$squash_dir"/usr/lib/dracut/* \
"$squash_dir"/etc/initrd-release "$squash_dir"/etc/initrd-release
do do
@ -46,8 +41,7 @@ installpost() {
done done


# Install required files for the squash image setup script. # Install required files for the squash image setup script.
hostonly="" instmods "loop" "squashfs" "overlay" inst_multiple modprobe mount mkdir ln echo rm
inst_multiple modprobe mount mkdir ln echo


mv "$initdir"/init "$initdir"/init.orig mv "$initdir"/init "$initdir"/init.orig
inst "$moddir"/init-squash.sh /init inst "$moddir"/init-squash.sh /init
@ -63,6 +57,10 @@ installpost() {
find "$initdir/$folder/" -not -type d \ find "$initdir/$folder/" -not -type d \
-exec bash -c 'mv -f "$squash_dir${1#$initdir}" "$1"' -- "{}" \; -exec bash -c 'mv -f "$squash_dir${1#$initdir}" "$1"' -- "{}" \;
done done

# Install required modules for the squash image init script.
hostonly="" instmods "loop" "squashfs" "overlay"
dracut_kernel_post
} }


install() { install() {