diff --git a/tools/qmnt b/tools/qmnt index 29b86f2..1d64afb 100755 --- a/tools/qmnt +++ b/tools/qmnt @@ -135,13 +135,20 @@ if [[ "$#" -eq 0 ]]; then print_help fi +EFF_UID="${EFF_UID:-$UID}" +if [[ ! -z $SUDO_USER ]]; then + EFF_UID=$SUDO_UID +elif [[ ! -z $DOAS_USER ]]; then + EFF_UID=$(id -u $DOAS_USER) +fi + for arg in "$@"; do case "${arg}" in "-h" | "--help") print_help ;; "-p" | "--permissions") - MOUNT_OPTS+=",uid=$UID,gid=$(id -g $UID)" + MOUNT_OPTS+=",uid=$EFF_UID,gid=$(id -g $EFF_UID)" ;; "-u" | "--uuid") ALLOW_UUID="1" @@ -191,12 +198,14 @@ fi trap - EXIT + if [[ -z "${DEFAULT_MOUNT_OPTS["$TYPE"]}" ]]; then MOUNT_OPTS="${DEFAULT_MOUNT_OPTS["OTHER"]},${MOUNT_OPTS}" else MOUNT_OPTS="${DEFAULT_MOUNT_OPTS["$TYPE"]},${MOUNT_OPTS}" fi + [[ ! -d "${MOUNT_FOLDER}" && -z $DRY_RUN ]] && mkdir "${MOUNT_FOLDER}" [[ ! -d "${MOUNT_FOLDER}/${LABEL}" && -z $DRY_RUN ]] && mkdir "${MOUNT_FOLDER}/${LABEL}"