From 8556bdacbdf81c98a1fbfac40c3e693bd57040c9 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Thu, 20 Aug 2020 17:47:02 +0200 Subject: [PATCH] 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 --- tinyipa/finalise-tinyipa.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tinyipa/finalise-tinyipa.sh b/tinyipa/finalise-tinyipa.sh index 38617c7..422aa06 100755 --- a/tinyipa/finalise-tinyipa.sh +++ b/tinyipa/finalise-tinyipa.sh @@ -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