refactor(squash): don't record mount points in text file

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.
master
Kairui Song 2021-02-15 23:05:08 +08:00 committed by Jóhann B. Guðmundsson
parent 5a18b24a8b
commit bdd194bb8c
2 changed files with 5 additions and 13 deletions

View File

@ -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

View File

@ -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