Remove old proc before finalising tinyipa

When building locally, if the finalise process fails, it might
happen that the old proc filesystem mounted for the chroot jail
is still there.
Unmount it before removing the old finaldir to prevent the script
to fail early.

Change-Id: I0ffe7c71ca3145202ffd5412434e6ce163df53fe
This commit is contained in:
Riccardo Pittau 2020-08-20 17:47:02 +02:00
parent b609df3111
commit 8556bdacbd
1 changed files with 8 additions and 0 deletions

View File

@ -57,6 +57,14 @@ fi
sudo -v
# Let's umount proc in case the old finalise process went sideways and
# it's still mounted
if grep -qs "$FINALDIR/proc" /proc/mounts; then
sudo umount "$FINALDIR/proc"
fi
# Remove the old final chroot dir with all its content before starting a new
# finalise process
if [ -d "$FINALDIR" ]; then
sudo rm -rf "$FINALDIR"
fi