|
|
28ab1c |
From 39d06b934fd4bec88b0945b5277407d7b5510c22 Mon Sep 17 00:00:00 2001
|
|
|
28ab1c |
From: Kairui Song <kasong@redhat.com>
|
|
|
28ab1c |
Date: Mon, 15 Feb 2021 22:58:20 +0800
|
|
|
28ab1c |
Subject: [PATCH] feat(squash): install and depmod modules seperately
|
|
|
28ab1c |
|
|
|
28ab1c |
Separately install the modules required for squash image setup.
|
|
|
28ab1c |
These modules can be deleted after squash image setup to save
|
|
|
28ab1c |
memory.
|
|
|
28ab1c |
|
|
|
28ab1c |
Signed-off-by: Kairui Song <kasong@redhat.com>
|
|
|
28ab1c |
(cherry picked from commit 5a18b24a8b9c20c98f711963ce5407ceb2f3d57b)
|
|
|
28ab1c |
|
|
|
28ab1c |
Cherry-picked from: 5a18b24a8b9c20c98f711963ce5407ceb2f3d57b
|
|
|
28ab1c |
Resolves: #1959336
|
|
|
28ab1c |
---
|
|
|
28ab1c |
modules.d/99squash/init-squash.sh | 3 +++
|
|
|
28ab1c |
modules.d/99squash/module-setup.sh | 12 +++++-------
|
|
|
28ab1c |
2 files changed, 8 insertions(+), 7 deletions(-)
|
|
|
28ab1c |
|
|
|
28ab1c |
diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh
|
|
|
28ab1c |
index 449585f0..ecb6cc58 100755
|
|
|
28ab1c |
--- a/modules.d/99squash/init-squash.sh
|
|
|
28ab1c |
+++ b/modules.d/99squash/init-squash.sh
|
|
|
28ab1c |
@@ -34,6 +34,9 @@ if [ $? != 0 ]; then
|
|
|
28ab1c |
echo "Unable to setup overlay module"
|
|
|
28ab1c |
fi
|
|
|
28ab1c |
|
|
|
28ab1c |
+# These modules are no longer needed, delete to save memory
|
|
|
28ab1c |
+rm -rf /usr/lib/modules/
|
|
|
28ab1c |
+
|
|
|
28ab1c |
[ ! -d "$SQUASH_MNT" ] && \
|
|
|
28ab1c |
mkdir -m 0755 -p $SQUASH_MNT
|
|
|
28ab1c |
|
|
|
28ab1c |
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
|
|
|
28ab1c |
index c0eb4acd..ad619176 100644
|
|
|
28ab1c |
--- a/modules.d/99squash/module-setup.sh
|
|
|
28ab1c |
+++ b/modules.d/99squash/module-setup.sh
|
|
|
28ab1c |
@@ -18,10 +18,6 @@ depends() {
|
|
|
28ab1c |
return 0
|
|
|
28ab1c |
}
|
|
|
28ab1c |
|
|
|
28ab1c |
-installkernel() {
|
|
|
28ab1c |
- hostonly="" instmods -c squashfs loop overlay
|
|
|
28ab1c |
-}
|
|
|
28ab1c |
-
|
|
|
28ab1c |
installpost() {
|
|
|
28ab1c |
local squash_candidate=( "usr" "etc" )
|
|
|
28ab1c |
|
|
|
28ab1c |
@@ -36,7 +32,6 @@ installpost() {
|
|
|
28ab1c |
# - Files need to be accessible without mounting the squash image
|
|
|
28ab1c |
# - Initramfs marker
|
|
|
28ab1c |
for file in \
|
|
|
28ab1c |
- "$squash_dir"/usr/lib/modules/*/modules.* \
|
|
|
28ab1c |
"$squash_dir"/usr/lib/dracut/* \
|
|
|
28ab1c |
"$squash_dir"/etc/initrd-release
|
|
|
28ab1c |
do
|
|
|
28ab1c |
@@ -46,8 +41,7 @@ installpost() {
|
|
|
28ab1c |
done
|
|
|
28ab1c |
|
|
|
28ab1c |
# Install required files for the squash image setup script.
|
|
|
28ab1c |
- hostonly="" instmods "loop" "squashfs" "overlay"
|
|
|
28ab1c |
- inst_multiple modprobe mount mkdir ln echo
|
|
|
28ab1c |
+ inst_multiple modprobe mount mkdir ln echo rm
|
|
|
28ab1c |
|
|
|
28ab1c |
mv "$initdir"/init "$initdir"/init.orig
|
|
|
28ab1c |
inst "$moddir"/init-squash.sh /init
|
|
|
28ab1c |
@@ -63,6 +57,10 @@ installpost() {
|
|
|
28ab1c |
find "$initdir/$folder/" -not -type d \
|
|
|
28ab1c |
-exec bash -c 'mv -f "$squash_dir${1#$initdir}" "$1"' -- "{}" \;
|
|
|
28ab1c |
done
|
|
|
28ab1c |
+
|
|
|
28ab1c |
+ # Install required modules for the squash image init script.
|
|
|
28ab1c |
+ hostonly="" instmods "loop" "squashfs" "overlay"
|
|
|
28ab1c |
+ dracut_kernel_post
|
|
|
28ab1c |
}
|
|
|
28ab1c |
|
|
|
28ab1c |
install() {
|
|
|
28ab1c |
|