|
|
28ab1c |
From 122da496446405e60a6eb5b037af263b5fd14378 Mon Sep 17 00:00:00 2001
|
|
|
28ab1c |
From: Kairui Song <kasong@redhat.com>
|
|
|
28ab1c |
Date: Mon, 15 Feb 2021 23:05:08 +0800
|
|
|
28ab1c |
Subject: [PATCH] refactor(squash): don't record mount points in text file
|
|
|
28ab1c |
|
|
|
28ab1c |
The squasn mount points are recorded in text file so later clean up
|
|
|
28ab1c |
script can umount them, this is not needed, the mount points are fixed
|
|
|
28ab1c |
so just detect the umount by hardcoded pattern.
|
|
|
28ab1c |
|
|
|
28ab1c |
(cherry picked from commit bdd194bb8c0427921b87b4dce16c05e18e0c2fb0)
|
|
|
28ab1c |
|
|
|
28ab1c |
Resolves: #1959336
|
|
|
28ab1c |
---
|
|
|
28ab1c |
modules.d/99squash/clear-squash.sh | 10 +++++-----
|
|
|
28ab1c |
modules.d/99squash/init-squash.sh | 8 --------
|
|
|
28ab1c |
2 files changed, 5 insertions(+), 13 deletions(-)
|
|
|
28ab1c |
|
|
|
28ab1c |
diff --git a/modules.d/99squash/clear-squash.sh b/modules.d/99squash/clear-squash.sh
|
|
|
28ab1c |
index 1d626f98..4f357817 100755
|
|
|
28ab1c |
--- a/modules.d/99squash/clear-squash.sh
|
|
|
28ab1c |
+++ b/modules.d/99squash/clear-squash.sh
|
|
|
28ab1c |
@@ -1,6 +1,6 @@
|
|
|
28ab1c |
#!/bin/bash
|
|
|
28ab1c |
-SQUASH_MNT_REC=/squash/mounts
|
|
|
28ab1c |
-
|
|
|
28ab1c |
-mapfile -t SQUASH_MNTS < $SQUASH_MNT_REC
|
|
|
28ab1c |
-
|
|
|
28ab1c |
-umount --lazy -- "${SQUASH_MNTS[@]}"
|
|
|
28ab1c |
+mnt="/squash/root"
|
|
|
28ab1c |
+for dir in jsquash/root/*; do
|
|
|
28ab1c |
+ mnt="$mnt ${dir#$SQUASH_MNT}"
|
|
|
28ab1c |
+done
|
|
|
28ab1c |
+umount --lazy -- $mnt
|
|
|
28ab1c |
diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh
|
|
|
28ab1c |
index ecb6cc58..fee0105e 100755
|
|
|
28ab1c |
--- a/modules.d/99squash/init-squash.sh
|
|
|
28ab1c |
+++ b/modules.d/99squash/init-squash.sh
|
|
|
28ab1c |
@@ -3,9 +3,6 @@ PATH=/bin:/sbin
|
|
|
28ab1c |
|
|
|
28ab1c |
SQUASH_IMG=/squash/root.img
|
|
|
28ab1c |
SQUASH_MNT=/squash/root
|
|
|
28ab1c |
-SQUASH_MNT_REC=/squash/mounts
|
|
|
28ab1c |
-
|
|
|
28ab1c |
-echo $SQUASH_MNT > $SQUASH_MNT_REC
|
|
|
28ab1c |
|
|
|
28ab1c |
# Following mount points are neccessary for mounting a squash image
|
|
|
28ab1c |
|
|
|
28ab1c |
@@ -34,9 +31,6 @@ 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 |
@@ -59,8 +53,6 @@ for file in $SQUASH_MNT/*; do
|
|
|
28ab1c |
|
|
|
28ab1c |
mount -t overlay overlay -o\
|
|
|
28ab1c |
lowerdir=$lowerdir,upperdir=$upperdir,workdir=$workdir $mntdir
|
|
|
28ab1c |
-
|
|
|
28ab1c |
- echo $mntdir >> $SQUASH_MNT_REC
|
|
|
28ab1c |
done
|
|
|
28ab1c |
|
|
|
28ab1c |
exec /init.orig
|
|
|
28ab1c |
|