mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-06-04 02:31:27 +00:00
polkit: add udisks2 rule
The rule allows non-priviledged users from plugdev group to mount/unmount block devices Signed-off-by: Vyacheslav Yurkov <v.yurkov@precitec.de> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
committed by
Khem Raj
parent
8ac08ac7d8
commit
d7ff4a7724
@@ -0,0 +1,24 @@
|
|||||||
|
polkit.addRule(function(action, subject) {
|
||||||
|
var YES = polkit.Result.YES;
|
||||||
|
var permission = {
|
||||||
|
// required for udisks1:
|
||||||
|
"org.freedesktop.udisks.filesystem-mount": YES,
|
||||||
|
"org.freedesktop.udisks.luks-unlock": YES,
|
||||||
|
"org.freedesktop.udisks.drive-eject": YES,
|
||||||
|
"org.freedesktop.udisks.drive-detach": YES,
|
||||||
|
// 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,
|
||||||
|
// required for udisks2 if using udiskie from another seat (e.g. systemd):
|
||||||
|
"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
|
||||||
|
};
|
||||||
|
if (subject.isInGroup("plugdev")) {
|
||||||
|
return permission[action.id];
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
DESCRIPTION = "Polkit rule to allow non-priviledged users mount/umount block devices via udisks2"
|
||||||
|
LICENSE = "MIT"
|
||||||
|
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
|
||||||
|
|
||||||
|
require polkit-group-rule.inc
|
||||||
|
|
||||||
|
# The file originates from https://github.com/coldfix/udiskie/wiki/Permissions
|
||||||
|
SRC_URI = "file://50-org.freedesktop.udiskie.rules"
|
||||||
|
|
||||||
|
RDEPENDS_${PN} += "udisks2"
|
||||||
|
|
||||||
|
do_install() {
|
||||||
|
install -m 0755 ${WORKDIR}/50-org.freedesktop.udiskie.rules ${D}${sysconfdir}/polkit-1/rules.d
|
||||||
|
}
|
||||||
|
|
||||||
|
USERADD_PACKAGES = "${PN}"
|
||||||
|
GROUPADD_PARAM:${PN} = "--system plugdev"
|
||||||
Reference in New Issue
Block a user