cryptsetup-veracrypt: fix chmod operation not permitted

This commit is contained in:
minoplhy 2024-12-12 11:01:50 +07:00
parent d791f31d51
commit 135ab85010
Signed by: minoplhy
GPG Key ID: 41D406044E2434BF

View File

@ -45,20 +45,31 @@ prompting() {
printf "\nSelect Container Name: " printf "\nSelect Container Name: "
read container_name read container_name
MOUNT_PARAMETERS+="-o "
case $MODE in case $MODE in
"mount") mount_permission_prompt && mount;; "mount") mount_parameters_prompt && mount;;
"unmount") unmount;; "unmount") unmount;;
esac esac
} }
mount_permission_prompt() { mount_parameters_prompt() {
printf "Currently the Mount Parameters is hardcoded, so you have not much choice!\n" printf "Mounting with Permission?\n"
printf "Mounting with '-o umask=000' (Y/n)? " printf "000 - umask 000\nuser/<username> - owner of this device\n"
read mount_permission read mount_parameters_ask
case $mount_permission in case $mount_parameters_ask in
"Y"|"y") MOUNT_PARAMETERS+="-o umask=000" ;; "000") MOUNT_PARAMETERS+="umask=000" ;;
"N"|"n") ;; user/*)
*) mount_permission_prompt ;; local user="${mount_parameters_ask#user/}"
local user_uid=$(id -u "$user" 2>/dev/null)
local group_uid=$(id -g "$user" 2>/dev/null)
if [ $? -eq 0 ] && [ -n "$user_uid" ] && [ -n "$group_uid" ]; then
MOUNT_PARAMETERS+="gid=$user_uid,uid=$group_uid"
else
printf "User id for %s not found!\n" $user
mount_parameters_prompt
fi ;;
*) mount_parameters_prompt ;;
esac esac
} }