]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
refactor(squash): don't record mount points in text file
authorKairui Song <kasong@redhat.com>
Mon, 15 Feb 2021 15:05:08 +0000 (23:05 +0800)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Tue, 9 Mar 2021 13:40:35 +0000 (13:40 +0000)
The squasn mount points are recorded in text file so later clean up
script can umount them, this is not needed, the mount points are fixed
so just detect the umount by hardcoded pattern.

modules.d/99squash/clear-squash.sh
modules.d/99squash/init-squash.sh

index 1d626f9823a569ff7fbfc0b49fc8306121753609..4f3578179b3838fd88c14627abe4d4d055bf1451 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
-SQUASH_MNT_REC=/squash/mounts
-
-mapfile -t SQUASH_MNTS < $SQUASH_MNT_REC
-
-umount --lazy -- "${SQUASH_MNTS[@]}"
+mnt="/squash/root"
+for dir in jsquash/root/*; do
+       mnt="$mnt ${dir#$SQUASH_MNT}"
+done
+umount --lazy -- $mnt
index ecb6cc58f62f9ca451c5ff5793d46c97b899a456..fee0105e1895cdaf4a6fa00f45d5555f05a1aef9 100755 (executable)
@@ -3,9 +3,6 @@ PATH=/bin:/sbin
 
 SQUASH_IMG=/squash/root.img
 SQUASH_MNT=/squash/root
-SQUASH_MNT_REC=/squash/mounts
-
-echo $SQUASH_MNT > $SQUASH_MNT_REC
 
 # Following mount points are neccessary for mounting a squash image
 
@@ -34,9 +31,6 @@ if [ $? != 0 ]; then
     echo "Unable to setup overlay module"
 fi
 
-# These modules are no longer needed, delete to save memory
-rm -rf /usr/lib/modules/
-
 [ ! -d "$SQUASH_MNT" ] && \
        mkdir -m 0755 -p $SQUASH_MNT
 
@@ -59,8 +53,6 @@ for file in $SQUASH_MNT/*; do
 
        mount -t overlay overlay -o\
                lowerdir=$lowerdir,upperdir=$upperdir,workdir=$workdir $mntdir
-
-       echo $mntdir >> $SQUASH_MNT_REC
 done
 
 exec /init.orig