Commit 68c763d1 authored by anonym's avatar anonym
Browse files

Use findmnt to learn what to umount when closing chroot browsers.

This way any mounts made by users of this library (e.g. the Unsafe
Browser) can mount targets inside the chroot and let the automatic
teardown of the chroot browser deal with the umounting.
parent 157964a5
......@@ -21,7 +21,13 @@ try_cleanup_browser_chroot () {
local user="${3}"
try_for 10 "pkill -u ${user} 1>/dev/null 2>&1" 0.1 || \
pkill -9 -u "${user}" || :
for mnt in "${chroot}/dev" "${chroot}/proc" "${chroot}" "${cow}"; do
# findmnt sorts submounts so we just have to revert the list to
# have the proper umount order. We use `tail` to suppress the
# "TARGET" column header.
local chroot_mounts="$(
findmnt --output TARGET --list --submounts "${chroot}" | tail -n+2 | tac
for mnt in ${chroot_mounts} "${cow}"; do
try_for 10 "umount ${mnt} 2>/dev/null" 0.1
rmdir "${cow}" "${chroot}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment