Skip to content

Commit bd00ef2

Browse files
committed
[fix] : Safer unmounting
1 parent c79f252 commit bd00ef2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

build.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ umount_chroot () {
187187
if [[ ! -d "${build_dir}" ]]; then
188188
return 0
189189
fi
190-
for _mount in $(cat "/proc/mounts" | getclm 2 | grep "$(realpath -s ${build_dir})" | tac | grep -xv "$(realpath -s ${airootfs_dir})"); do
190+
#for _mount in $(cat "/proc/mounts" | getclm 2 | grep "$(realpath -s ${build_dir})" | tac | grep -xv "$(realpath -s ${airootfs_dir})"); do
191+
for _mount in $(find "${build_dir}" -mindepth 1 -type d -printf "%p\0" | xargs -0 -I{} bash -c "mountpoint -q {} && echo {}"); do
191192
if echo "${_mount}" | grep "${work_dir}" > /dev/null 2>&1 || echo "${_mount}" | grep "${script_path}" > /dev/null 2>&1 || echo "${_mount}" | grep "${out_dir}" > /dev/null 2>&1; then
192193
msg_info "Unmounting ${_mount}"
193194
_umount "${_mount}" 2> /dev/null

0 commit comments

Comments
 (0)