Browse Source

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 4 years ago committed by Jóhann B. Guðmundsson
parent
commit
bdd194bb8c
  1. 10
      modules.d/99squash/clear-squash.sh
  2. 8
      modules.d/99squash/init-squash.sh

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

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
SQUASH_MNT_REC=/squash/mounts mnt="/squash/root"

for dir in jsquash/root/*; do
mapfile -t SQUASH_MNTS < $SQUASH_MNT_REC mnt="$mnt ${dir#$SQUASH_MNT}"

done
umount --lazy -- "${SQUASH_MNTS[@]}" umount --lazy -- $mnt

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

@ -3,9 +3,6 @@ PATH=/bin:/sbin


SQUASH_IMG=/squash/root.img SQUASH_IMG=/squash/root.img
SQUASH_MNT=/squash/root 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 # Following mount points are neccessary for mounting a squash image


@ -34,9 +31,6 @@ if [ $? != 0 ]; then
echo "Unable to setup overlay module" echo "Unable to setup overlay module"
fi fi


# These modules are no longer needed, delete to save memory
rm -rf /usr/lib/modules/

[ ! -d "$SQUASH_MNT" ] && \ [ ! -d "$SQUASH_MNT" ] && \
mkdir -m 0755 -p $SQUASH_MNT mkdir -m 0755 -p $SQUASH_MNT


@ -59,8 +53,6 @@ for file in $SQUASH_MNT/*; do


mount -t overlay overlay -o\ mount -t overlay overlay -o\
lowerdir=$lowerdir,upperdir=$upperdir,workdir=$workdir $mntdir lowerdir=$lowerdir,upperdir=$upperdir,workdir=$workdir $mntdir

echo $mntdir >> $SQUASH_MNT_REC
done done


exec /init.orig exec /init.orig

Loading…
Cancel
Save