diff options
| author | Christian Rößler | 2014-04-04 17:55:17 +0200 |
|---|---|---|
| committer | Christian Rößler | 2014-04-04 17:55:17 +0200 |
| commit | 3bc908c72c4eb3403adfce776d46e119679801be (patch) | |
| tree | c1d8eb572baaa202cacda87c57ab958076b19344 | |
| parent | [cleanup.inc] Better trapping - trap me once, don't trap me twice (Please test!) (diff) | |
| download | tm-scripts-3bc908c72c4eb3403adfce776d46e119679801be.tar.gz tm-scripts-3bc908c72c4eb3403adfce776d46e119679801be.tar.xz tm-scripts-3bc908c72c4eb3403adfce776d46e119679801be.zip | |
[chroot.inc] Check whether anything chroot-related is mounted before trying to unmount
| -rw-r--r-- | remote/includes/chroot.inc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/remote/includes/chroot.inc b/remote/includes/chroot.inc index 48ad39d3..2e0eabfe 100644 --- a/remote/includes/chroot.inc +++ b/remote/includes/chroot.inc @@ -202,9 +202,13 @@ chroot_umount() { # Helper to cleanup the temporary mounts chroot_cleanup_mounts() { - for DIR in $CHROOT_BINDMOUNTS; do - chroot_umount "${CHROOT_MOUNTDIR}/${DIR}" - done - chroot_umount "${CHROOT_MOUNTDIR}" - chroot_umount "${CHROOT_BINDDIR}" + if [[ "$(mount | grep -c $CHROOT_TEMPDIR)" -gt 0 ]]; then # No point in unmounting then... + for DIR in $CHROOT_BINDMOUNTS; do + chroot_umount "${CHROOT_MOUNTDIR}/${DIR}" + done + chroot_umount "${CHROOT_MOUNTDIR}" + chroot_umount "${CHROOT_BINDDIR}" + else + pinfo "Nothing chroot-related is mounted - exiting." + fi } |
