M #-: Replace real mount check for flag check

Because MOUNT_DIR can be different than real MOUNT_DIR,
so we would need to pass it to realpath. Which is not on
some legacy systems like RHEL 6 or Ubuntu 14.04.
pull/232/head
Vlastimil Holer 4 years ago
parent 9d4d93eaa7
commit d1f4d3a97d
No known key found for this signature in database
GPG Key ID: EB549BADEFD07C53

@ -171,6 +171,7 @@ function get_new_context {
;; ;;
esac esac
_mount_dir_mounted=no
if [ -e "${dev_context}" ]; then if [ -e "${dev_context}" ]; then
mount_dir mount_dir
@ -198,6 +199,7 @@ function get_new_context {
exit 1 exit 1
fi fi
_mount_dir_mounted=yes
context_sh $MOUNT_DIR context_sh $MOUNT_DIR
elif find '/context' -mindepth 1 -print 2>/dev/null | grep -q .; then elif find '/context' -mindepth 1 -print 2>/dev/null | grep -q .; then
@ -308,7 +310,7 @@ function acquire_lock {
function cleanup { function cleanup {
# unmount context # unmount context
if [ -d "${MOUNT_DIR}" ]; then if [ -d "${MOUNT_DIR}" ]; then
if mount | grep -q " ${MOUNT_DIR} "; then if [ "x${_mount_dir_mounted}" = 'xyes' ]; then
log debug "Unmounting ${MOUNT_DIR}" log debug "Unmounting ${MOUNT_DIR}"
if [ "$distro" = 'Linux' ]; then if [ "$distro" = 'Linux' ]; then
@ -318,7 +320,7 @@ function cleanup {
fi fi
fi fi
rm -r "${MOUNT_DIR}" rm -rf "${MOUNT_DIR}"
fi fi
# remove remporary files # remove remporary files

Loading…
Cancel
Save