summarylogtreecommitdiffstats
path: root/enter-chroot.sh
diff options
context:
space:
mode:
authornoobping2023-04-02 16:15:52 +0200
committernoobping2023-04-02 16:15:52 +0200
commit30013acb34c6d173158d578873f6dce447977d49 (patch)
tree0af3fba091a2d1650533d41685dbbb79ce70370b /enter-chroot.sh
parent3bb4b791c831b0cc8b71e8648f4962ebaf91f59b (diff)
downloadaur-alpine-minirootfs.tar.gz
Fix posseble unmount host sys, proc and dev folders.
Diffstat (limited to 'enter-chroot.sh')
-rw-r--r--enter-chroot.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/enter-chroot.sh b/enter-chroot.sh
index 6b3927376368..9edbbffee7f6 100644
--- a/enter-chroot.sh
+++ b/enter-chroot.sh
@@ -35,6 +35,18 @@ monitor_chroot_exit() {
fi
done < $MOUNT_POINT/exit.fifo
+ if grep -qs "$MOUNT_POINT/sys" /proc/mounts
+ then umount -l $MOUNT_POINT/sys
+ fi
+
+ if grep -qs "$MOUNT_POINT/dev" /proc/mounts
+ then umount -l $MOUNT_POINT/dev
+ fi
+
+ if grep -qs "$MOUNT_POINT/proc" /proc/mounts
+ then umount -l $MOUNT_POINT/proc
+ fi
+
# Send a SIGTERM signal to the parent process (which is running the chroot command)
kill -s TERM $$
}