qmnt - Fixed permissions flag when running as sudo or doas
This commit is contained in:
parent
c5da64b238
commit
9b88c38ae2
1 changed files with 10 additions and 1 deletions
11
tools/qmnt
11
tools/qmnt
|
@ -135,13 +135,20 @@ if [[ "$#" -eq 0 ]]; then
|
||||||
print_help
|
print_help
|
||||||
fi
|
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
|
for arg in "$@"; do
|
||||||
case "${arg}" in
|
case "${arg}" in
|
||||||
"-h" | "--help")
|
"-h" | "--help")
|
||||||
print_help
|
print_help
|
||||||
;;
|
;;
|
||||||
"-p" | "--permissions")
|
"-p" | "--permissions")
|
||||||
MOUNT_OPTS+=",uid=$UID,gid=$(id -g $UID)"
|
MOUNT_OPTS+=",uid=$EFF_UID,gid=$(id -g $EFF_UID)"
|
||||||
;;
|
;;
|
||||||
"-u" | "--uuid")
|
"-u" | "--uuid")
|
||||||
ALLOW_UUID="1"
|
ALLOW_UUID="1"
|
||||||
|
@ -191,12 +198,14 @@ fi
|
||||||
|
|
||||||
trap - EXIT
|
trap - EXIT
|
||||||
|
|
||||||
|
|
||||||
if [[ -z "${DEFAULT_MOUNT_OPTS["$TYPE"]}" ]]; then
|
if [[ -z "${DEFAULT_MOUNT_OPTS["$TYPE"]}" ]]; then
|
||||||
MOUNT_OPTS="${DEFAULT_MOUNT_OPTS["OTHER"]},${MOUNT_OPTS}"
|
MOUNT_OPTS="${DEFAULT_MOUNT_OPTS["OTHER"]},${MOUNT_OPTS}"
|
||||||
else
|
else
|
||||||
MOUNT_OPTS="${DEFAULT_MOUNT_OPTS["$TYPE"]},${MOUNT_OPTS}"
|
MOUNT_OPTS="${DEFAULT_MOUNT_OPTS["$TYPE"]},${MOUNT_OPTS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
[[ ! -d "${MOUNT_FOLDER}" && -z $DRY_RUN ]] && mkdir "${MOUNT_FOLDER}"
|
[[ ! -d "${MOUNT_FOLDER}" && -z $DRY_RUN ]] && mkdir "${MOUNT_FOLDER}"
|
||||||
[[ ! -d "${MOUNT_FOLDER}/${LABEL}" && -z $DRY_RUN ]] && mkdir "${MOUNT_FOLDER}/${LABEL}"
|
[[ ! -d "${MOUNT_FOLDER}/${LABEL}" && -z $DRY_RUN ]] && mkdir "${MOUNT_FOLDER}/${LABEL}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue