diff options
author | Andreas Müller <schnitzeltony@googlemail.com> | 2015-10-29 18:07:20 +0100 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2015-11-06 17:49:34 +0100 |
commit | 165de549b7a80a3a93c5ab1cc54b197101ffd2cf (patch) | |
tree | 4c4eaae6c526c659aaa7198c30b4cf3d0bcef240 /meta-gnome/recipes-extended | |
parent | 0bd73fae2f925297fbdca175be1923fa14c24dce (diff) | |
download | meta-openembedded-165de549b7a80a3a93c5ab1cc54b197101ffd2cf.tar.gz |
gparted: add polkit support
* This was missing for me and is a good test case for xfce-polkit asking for
root's password.
* Decision to use polkit (installed?) is made at runtime. Unfortunately this
cool solution was not my idea but stolen from [1]
[1] http://pkgs.fedoraproject.org/cgit/gparted.git
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
Diffstat (limited to 'meta-gnome/recipes-extended')
3 files changed, 52 insertions, 2 deletions
diff --git a/meta-gnome/recipes-extended/gparted/files/gparted_polkit b/meta-gnome/recipes-extended/gparted/files/gparted_polkit new file mode 100644 index 0000000000..feabd0eebb --- /dev/null +++ b/meta-gnome/recipes-extended/gparted/files/gparted_polkit | |||
@@ -0,0 +1,10 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # polkit installed? | ||
4 | if [ $(which pkexec) ]; then | ||
5 | pkexec --disable-internal-agent "%sbindir%/gparted" "$@" | ||
6 | else | ||
7 | %sbindir%/gparted "$@" | ||
8 | fi | ||
9 | |||
10 | |||
diff --git a/meta-gnome/recipes-extended/gparted/files/org.yoctoproject.pkexec.run-gparted.policy b/meta-gnome/recipes-extended/gparted/files/org.yoctoproject.pkexec.run-gparted.policy new file mode 100644 index 0000000000..77a91923eb --- /dev/null +++ b/meta-gnome/recipes-extended/gparted/files/org.yoctoproject.pkexec.run-gparted.policy | |||
@@ -0,0 +1,20 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <!DOCTYPE policyconfig PUBLIC | ||
3 | "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" | ||
4 | "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd"> | ||
5 | <policyconfig> | ||
6 | |||
7 | <action id="org.yoctoproject.pkexec.run-gparted"> | ||
8 | <description>Run the GParted program</description> | ||
9 | <message>Authentication is required to run the GParted Partition Editor</message> | ||
10 | <icon_name>gparted</icon_name> | ||
11 | <defaults> | ||
12 | <allow_any>auth_admin</allow_any> | ||
13 | <allow_inactive>auth_admin</allow_inactive> | ||
14 | <allow_active>auth_admin</allow_active> | ||
15 | </defaults> | ||
16 | <annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/gparted</annotate> | ||
17 | <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate> | ||
18 | </action> | ||
19 | |||
20 | </policyconfig> | ||
diff --git a/meta-gnome/recipes-extended/gparted/gparted_0.24.0.bb b/meta-gnome/recipes-extended/gparted/gparted_0.24.0.bb index 0fe95a0d29..2f38977fdc 100644 --- a/meta-gnome/recipes-extended/gparted/gparted_0.24.0.bb +++ b/meta-gnome/recipes-extended/gparted/gparted_0.24.0.bb | |||
@@ -5,14 +5,34 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" | |||
5 | 5 | ||
6 | inherit autotools pkgconfig gtk-icon-cache | 6 | inherit autotools pkgconfig gtk-icon-cache |
7 | 7 | ||
8 | SRC_URI = "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}/${BPN}-${PV}/${BPN}-${PV}.tar.bz2" | 8 | SRC_URI = " \ |
9 | ${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}/${BPN}-${PV}/${BPN}-${PV}.tar.bz2 \ | ||
10 | file://org.yoctoproject.pkexec.run-gparted.policy \ | ||
11 | file://gparted_polkit \ | ||
12 | " | ||
9 | SRC_URI[md5sum] = "b8480274c68876acff5965d4346710e7" | 13 | SRC_URI[md5sum] = "b8480274c68876acff5965d4346710e7" |
10 | SRC_URI[sha256sum] = "02398ab33894a59b0bd8707e598c46d8bb56f1413cd54de48eed61e2920ecd60" | 14 | SRC_URI[sha256sum] = "02398ab33894a59b0bd8707e598c46d8bb56f1413cd54de48eed61e2920ecd60" |
11 | 15 | ||
12 | DEPENDS = "glib-2.0 gtkmm parted gnome-doc-utils-native" | 16 | DEPENDS = "glib-2.0 gtkmm parted gnome-doc-utils-native" |
13 | 17 | ||
18 | do_install_append() { | ||
19 | # Add a script which checks if polkit is installed. | ||
20 | # If yes: a policy is requested from polkit / otherwise start as usual | ||
21 | install ${WORKDIR}/gparted_polkit ${D}${sbindir} | ||
22 | sed -i 's:%sbindir%:${sbindir}:g' ${D}${sbindir}/gparted_polkit | ||
23 | # relink menu entry to use our script | ||
24 | sed -i 's:${sbindir}/gparted:${sbindir}/gparted_polkit:g' ${D}${datadir}/applications/gparted.desktop | ||
25 | |||
26 | install -d ${D}${datadir}/polkit-1/actions | ||
27 | install ${WORKDIR}/org.yoctoproject.pkexec.run-gparted.policy ${D}${datadir}/polkit-1/actions/org.yoctoproject.pkexec.run-gparted.policy | ||
28 | } | ||
29 | |||
14 | EXTRA_OECONF = "--disable-scrollkeeper --disable-doc" | 30 | EXTRA_OECONF = "--disable-scrollkeeper --disable-doc" |
15 | 31 | ||
16 | FILES_${PN} += "${datadir}/icons ${datadir}/appdata" | 32 | FILES_${PN} += " \ |
33 | ${datadir}/appdata \ | ||
34 | ${datadir}/icons \ | ||
35 | ${datadir}/polkit-1 \ | ||
36 | " | ||
17 | 37 | ||
18 | RDEPENDS_${PN} = "dosfstools mtools e2fsprogs" | 38 | RDEPENDS_${PN} = "dosfstools mtools e2fsprogs" |