summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-28 09:11:50 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-28 09:11:50 -0600
commitcb31da9e55a2173da2780fa998a16e4384001d66 (patch)
treeac73a12ba560db764b3b288eed31ba3c814fcf9d
parentae20f2dfbda852fbbba2bd6754071788b1915c12 (diff)
downloadpackages-cb31da9e55a2173da2780fa998a16e4384001d66.tar.gz
packages-cb31da9e55a2173da2780fa998a16e4384001d66.tar.bz2
packages-cb31da9e55a2173da2780fa998a16e4384001d66.tar.xz
packages-cb31da9e55a2173da2780fa998a16e4384001d66.zip
user/udisks2: Finally add PolKit rules for mounting as user
-rw-r--r--user/udisks2/50-udisks2.rules28
-rw-r--r--user/udisks2/APKBUILD6
2 files changed, 33 insertions, 1 deletions
diff --git a/user/udisks2/50-udisks2.rules b/user/udisks2/50-udisks2.rules
new file mode 100644
index 000000000..4c6088eaf
--- /dev/null
+++ b/user/udisks2/50-udisks2.rules
@@ -0,0 +1,28 @@
+// Source: https://gist.github.com/Scrumplex/8f528c1f63b5f4bfabe14b0804adaba7
+// Original rules: https://github.com/coldfix/udiskie/wiki/Permissions
+// Changes: Added org.freedesktop.udisks2.filesystem-mount-system, as this is used by Dolphin.
+
+polkit.addRule(function(action, subject) {
+ var YES = polkit.Result.YES;
+ // NOTE: there must be a comma at the end of each line except for the last:
+ var permission = {
+ // required for udisks2:
+ "org.freedesktop.udisks2.filesystem-mount": YES,
+ "org.freedesktop.udisks2.encrypted-unlock": YES,
+ "org.freedesktop.udisks2.eject-media": YES,
+ "org.freedesktop.udisks2.power-off-drive": YES,
+ // Dolphin specific
+ "org.freedesktop.udisks2.filesystem-mount-system": YES,
+ // required for udisks2 if using another seat:
+ "org.freedesktop.udisks2.filesystem-mount-other-seat": YES,
+ "org.freedesktop.udisks2.filesystem-unmount-others": YES,
+ "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES,
+ "org.freedesktop.udisks2.eject-media-other-seat": YES,
+ "org.freedesktop.udisks2.power-off-drive-other-seat": YES
+ };
+ // This is a terrible group choice, but nobody on the Horizon team wanted to
+ // give admins 'disk', which would be so much more appropriate...
+ if (subject.isInGroup("usb")) {
+ return permission[action.id];
+ }
+});
diff --git a/user/udisks2/APKBUILD b/user/udisks2/APKBUILD
index 07921ae96..02118dcd5 100644
--- a/user/udisks2/APKBUILD
+++ b/user/udisks2/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=udisks2
pkgver=2.8.4
-pkgrel=0
+pkgrel=1
pkgdesc="A Disk Manager"
url="https://www.freedesktop.org/wiki/Software/udisks"
arch="all"
@@ -13,6 +13,7 @@ depends_dev="acl-dev gobject-introspection-dev libatasmart-dev libblockdev-dev
makedepends="$depends_dev glib-dev gtk-doc intltool linux-headers"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-libs"
source="https://github.com/storaged-project/udisks/releases/download/udisks-$pkgver/udisks-$pkgver.tar.bz2
+ 50-udisks2.rules
O_CLOEXEC.patch
"
builddir="$srcdir"/udisks-$pkgver
@@ -37,6 +38,8 @@ check() {
package() {
make DESTDIR="$pkgdir" install
+ install -D -m644 "$srcdir"/50-udisks2.rules \
+ "$pkgdir"/etc/polkit-1/rules.d/50-udisks2.rules
}
libs() {
@@ -49,4 +52,5 @@ libs() {
}
sha512sums="70860e5ca9ac73d442ca67f0e0429ce2f33575d8f64945fbf06d1694b080c8b6fed8d65b2485eff0ab66eab59cdebeb9309424820a2ee82c5faaa38029e15e6c udisks-2.8.4.tar.bz2
+e2b2cc10868ca341603c3403631b9962c9c776bf96f4ac2c764425363ffdbe1cd9c35233e568f84b276a1f6702b1ac5b9a14b4a62983067c44c433b58d1b7175 50-udisks2.rules
4352d63458ca51b362844d60109948ebeeecdc492a93443b391c0d75b6fff0c0af5018c8a8e441fb37bffd59c734298eaa936fcb0cd4c42ac55c1298b398b1dc O_CLOEXEC.patch"