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