Skip to content

Commit

Permalink
refactor(squash): don't record mount points in text file
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ryncsn authored and johannbg committed Mar 9, 2021
1 parent 5a18b24 commit bdd194b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
10 changes: 5 additions & 5 deletions modules.d/99squash/clear-squash.sh
Original file line number Diff line number Diff line change
@@ -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
8 changes: 0 additions & 8 deletions modules.d/99squash/init-squash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit bdd194b

Please sign in to comment.