From 165de549b7a80a3a93c5ab1cc54b197101ffd2cf Mon Sep 17 00:00:00 2001 From: Andreas Müller Date: Thu, 29 Oct 2015 18:07:20 +0100 Subject: gparted: add polkit support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- .../recipes-extended/gparted/files/gparted_polkit | 10 +++++++++ .../org.yoctoproject.pkexec.run-gparted.policy | 20 ++++++++++++++++++ .../recipes-extended/gparted/gparted_0.24.0.bb | 24 ++++++++++++++++++++-- 3 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 meta-gnome/recipes-extended/gparted/files/gparted_polkit create mode 100644 meta-gnome/recipes-extended/gparted/files/org.yoctoproject.pkexec.run-gparted.policy (limited to 'meta-gnome/recipes-extended') 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 @@ +#!/bin/sh + +# polkit installed? +if [ $(which pkexec) ]; then + pkexec --disable-internal-agent "%sbindir%/gparted" "$@" +else + %sbindir%/gparted "$@" +fi + + 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 @@ + + + + + + Run the GParted program + Authentication is required to run the GParted Partition Editor + gparted + + auth_admin + auth_admin + auth_admin + + /usr/sbin/gparted + true + + + 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" inherit autotools pkgconfig gtk-icon-cache -SRC_URI = "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}/${BPN}-${PV}/${BPN}-${PV}.tar.bz2" +SRC_URI = " \ + ${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}/${BPN}-${PV}/${BPN}-${PV}.tar.bz2 \ + file://org.yoctoproject.pkexec.run-gparted.policy \ + file://gparted_polkit \ +" SRC_URI[md5sum] = "b8480274c68876acff5965d4346710e7" SRC_URI[sha256sum] = "02398ab33894a59b0bd8707e598c46d8bb56f1413cd54de48eed61e2920ecd60" DEPENDS = "glib-2.0 gtkmm parted gnome-doc-utils-native" +do_install_append() { + # Add a script which checks if polkit is installed. + # If yes: a policy is requested from polkit / otherwise start as usual + install ${WORKDIR}/gparted_polkit ${D}${sbindir} + sed -i 's:%sbindir%:${sbindir}:g' ${D}${sbindir}/gparted_polkit + # relink menu entry to use our script + sed -i 's:${sbindir}/gparted:${sbindir}/gparted_polkit:g' ${D}${datadir}/applications/gparted.desktop + + install -d ${D}${datadir}/polkit-1/actions + install ${WORKDIR}/org.yoctoproject.pkexec.run-gparted.policy ${D}${datadir}/polkit-1/actions/org.yoctoproject.pkexec.run-gparted.policy +} + EXTRA_OECONF = "--disable-scrollkeeper --disable-doc" -FILES_${PN} += "${datadir}/icons ${datadir}/appdata" +FILES_${PN} += " \ + ${datadir}/appdata \ + ${datadir}/icons \ + ${datadir}/polkit-1 \ +" RDEPENDS_${PN} = "dosfstools mtools e2fsprogs" -- cgit 1.2.3-korg