mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-07 13:16:26 +02:00
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:
parent
e08639b859
commit
e8aec37165
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user