cros_sdk: skip unmount phase if no mounts are found

Normally safe_umount_tree isn't called if there are no mount points in the
chroot, but there are some edge cases (like early setup errors) where it
may be possible.  So add a simple check to make sure that there are mount
points for us to work on before calling umount.

BUG=None
TEST=add early `die` before mounts; see no umount error output

Change-Id: I57e5022c3242c635097bceed44772f10eecf6a64
Reviewed-on: http://gerrit.chromium.org/gerrit/8026
Reviewed-by: Raymes Khoury <raymes@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2011-09-21 00:03:22 -04:00 committed by chrome-bot
parent e08639b859
commit e8aec37165

View File

@ -393,6 +393,11 @@ function sub_mounts() {
function safe_umount_tree {
local mounts=$(sub_mounts "$1")
# Hmm, this shouldn't normally happen, but anything is possible.
if [ -z "${mounts}" ] ; then
return 0
fi
# First try to unmount in one shot to speed things up.
if sudo umount -d ${mounts}; then
return 0