That whole section with the udisksctl check and the variable to mark support is a bit troublesome. The variable will always be true in the later check, no matter the result of the udisksctl call; both if [ false ]
and if [ true ]
are always true; they are non-empty strings.
I ended up patching the PKGBUILD as follows:
--- PKGBUILD
+++ PKGBUILD
@@ -403,9 +403,11 @@
touch test.mount
- _unprivilegedMountAllowed=false
- _testLoopDev=$(udisksctl loop-setup -r -f test.mount --no-user-interaction | awk '{print $NF}') && _unprivilegedMountAllowed=true
- _testLoopDev=${_testLoopDev::-1}
- udisksctl loop-delete -b "$_testLoopDev" --no-user-interaction
+ _testLoopDev=$(udisksctl loop-setup -r -f test.mount --no-user-interaction | awk '{print $NF}')
+ if [ -n "${_testLoopDev}" ]; then
+ _unprivilegedMountAllowed=1
+ _testLoopDev=${_testLoopDev::-1}
+ udisksctl loop-delete -b "$_testLoopDev" --no-user-interaction
+ fi
rm test.mount
- if [ $_unprivilegedMountAllowed ]; then
+ if [ -n "$_unprivilegedMountAllowed" ]; then
echo "allowed"
It can probably be minimized a bit more and might not catch some other cases (e.g. it doesn't account for non-zero exit codes for udisksctl
calls that produce normal output) but I did not want to spend to much time on this atm as the udisks path does not cover my use-case anyway.
Pinned Comments
kode54 commented on 2024-02-04 10:43 (UTC) (edited on 2024-02-04 10:45 (UTC) by kode54)
You apparently need to be a member of the
disk
group to mount a filesystem as an otherwise unprivileged user.And log out and back in again.