File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -197,12 +197,19 @@ _mount() { if ! mountpoint -q "${2}" && [[ -f "${1}" ]] && [[ -d "${2}" ]]; then
197197# Unmount chroot dir
198198umount_chroot () {
199199 local _mount
200- if [[ ! -v build_dir ]] || [[ " ${build_dir} " = " " ]]; then
200+ if [[ ! -v " build_dir" ]] || [[ " ${build_dir} " = " " ]]; then
201201 msg_error " Exception error about working directory" 1
202202 fi
203- for _mount in $( cat /proc/mounts | getclm 2 | grep " $( realpath ${build_dir} ) " | tac | grep -xv " $( realpath ${build_dir} ) /${arch} /airootfs" ) ; do
204- msg_info " Unmounting ${_mount} "
205- _umount " ${_mount} " 2> /dev/null
203+ if [[ ! -d " ${build_dir} " ]]; then
204+ return 0
205+ fi
206+ for _mount in $( cat " /proc/mounts" | getclm 2 | grep " $( realpath -s ${build_dir} ) " | tac | grep -xv " $( realpath -s ${build_dir} ) /${arch} /airootfs" ) ; do
207+ 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
208+ msg_info " Unmounting ${_mount} "
209+ _umount " ${_mount} " 2> /dev/null
210+ else
211+ msg_error " It is dangerous to unmount a directory that is not managed by the script."
212+ fi
206213 done
207214}
208215
You can’t perform that action at this time.
0 commit comments