Making unmount routines a bit more robust.
This commit is contained in:
parent
6d215be0e7
commit
45406a5c98
|
@ -20,10 +20,19 @@ Exit ()
|
||||||
# Always exit true in case we are not able to unmount
|
# Always exit true in case we are not able to unmount
|
||||||
# (e.g. due to running processes in chroot from user customizations)
|
# (e.g. due to running processes in chroot from user customizations)
|
||||||
Echo_message "Begin unmounting filesystems..."
|
Echo_message "Begin unmounting filesystems..."
|
||||||
for DIRECTORY in $(awk -v dir="${PWD}/chroot/" '$2 ~ dir { print $2 }' /proc/mounts | sort -r)
|
|
||||||
do
|
if [ -e /proc/mounts ]
|
||||||
umount ${DIRECTORY} > /dev/null 2>&1 || true
|
then
|
||||||
done
|
for DIRECTORY in $(awk -v dir="${PWD}/chroot/" '$2 ~ dir { print $2 }' /proc/mounts | sort -r)
|
||||||
|
do
|
||||||
|
umount ${DIRECTORY} > /dev/null 2>&1 || true
|
||||||
|
done
|
||||||
|
else
|
||||||
|
for DIRECTORY in /dev/pts /dev /proc /selinux /sys
|
||||||
|
do
|
||||||
|
umount -f chroot/${DIRECTORY} > /dev/null 2>&1 || true
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
return ${VALUE}
|
return ${VALUE}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,11 @@ case "${1}" in
|
||||||
# Unmounting /dev/pts
|
# Unmounting /dev/pts
|
||||||
if [ "${LH_USE_FAKEROOT}" != "true" ]
|
if [ "${LH_USE_FAKEROOT}" != "true" ]
|
||||||
then
|
then
|
||||||
if Find_files chroot/dev/pts/*
|
if grep -qs "$(pwd)/chroot/dev/pts" /proc/mounts || Find_files chroot/dev/pts/*
|
||||||
then
|
then
|
||||||
${LH_ROOT_COMMAND} umount chroot/dev/pts
|
${LH_ROOT_COMMAND} umount chroot/dev/pts
|
||||||
|
else
|
||||||
|
${LH_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue