Skip to content

Commit 7b1d53d

Browse files
committed
[fix] : Fixed unmount
1 parent 0af3491 commit 7b1d53d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tools/clean.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env bash
22

3+
set -eu
4+
35
script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && cd .. && pwd )"
46
work_dir="${script_path}/work"
57
debug=false
@@ -92,12 +94,13 @@ umount_chroot () {
9294
if [[ ! -d "${work_dir}" ]]; then
9395
return 0
9496
fi
95-
for _mount in $(cat "/proc/mounts" | getclm 2 | grep "$(realpath -s ${work_dir})" | tac | grep -xv "$(realpath -s ${work_dir})/${arch}/airootfs"); do
97+
for _mount in $(cat "/proc/mounts" | getclm 2 | grep "$(realpath -s ${work_dir})" | tac | grep -xv "$(realpath -s "${work_dir}")"); do
9698
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
9799
msg_info "Unmounting ${_mount}"
98100
_umount "${_mount}" 2> /dev/null
99101
else
100102
msg_error "It is dangerous to unmount a directory that is not managed by the script."
103+
msg_error "Path: ${_mount}"
101104
fi
102105
done
103106
}

0 commit comments

Comments
 (0)