From df32c8156f1f8127517266c0ed78717a8f357e7b Mon Sep 17 00:00:00 2001 From: yopito Date: Fri, 27 Nov 2015 01:11:43 +0100 Subject: [PATCH] gsmartcontrol: added policykit support for desktop menu launcher. --- srcpkgs/gsmartcontrol/INSTALL.msg | 4 ++++ .../gsmartcontrol/files/gsmartcontrol-pkexec | 4 ++++ .../org.void.pkexec.gsmartcontrol.policy | 19 +++++++++++++++++++ srcpkgs/gsmartcontrol/template | 15 +++++++++++++-- 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/gsmartcontrol/INSTALL.msg create mode 100755 srcpkgs/gsmartcontrol/files/gsmartcontrol-pkexec create mode 100644 srcpkgs/gsmartcontrol/files/org.void.pkexec.gsmartcontrol.policy diff --git a/srcpkgs/gsmartcontrol/INSTALL.msg b/srcpkgs/gsmartcontrol/INSTALL.msg new file mode 100644 index 0000000000..1476b81c0a --- /dev/null +++ b/srcpkgs/gsmartcontrol/INSTALL.msg @@ -0,0 +1,4 @@ +To run gsmartcontrol through a desktop menu, a polkit authentication agent +must be running; for GNOME and KDE users it should be already installed, +otherwise you can install *lxpolkit* which is a lightweight polkit +authentication agent. diff --git a/srcpkgs/gsmartcontrol/files/gsmartcontrol-pkexec b/srcpkgs/gsmartcontrol/files/gsmartcontrol-pkexec new file mode 100755 index 0000000000..7cf8592617 --- /dev/null +++ b/srcpkgs/gsmartcontrol/files/gsmartcontrol-pkexec @@ -0,0 +1,4 @@ +#!/bin/sh + +pkexec --disable-internal-agent "/usr/bin/gsmartcontrol" "$@" + diff --git a/srcpkgs/gsmartcontrol/files/org.void.pkexec.gsmartcontrol.policy b/srcpkgs/gsmartcontrol/files/org.void.pkexec.gsmartcontrol.policy new file mode 100644 index 0000000000..3c266dae5f --- /dev/null +++ b/srcpkgs/gsmartcontrol/files/org.void.pkexec.gsmartcontrol.policy @@ -0,0 +1,19 @@ + + + + + + Authentication is required to run GSmartControl + gsmartcontrol + + auth_admin + auth_admin + auth_admin + + /usr/bin/gsmartcontrol + true + + + diff --git a/srcpkgs/gsmartcontrol/template b/srcpkgs/gsmartcontrol/template index 60443a1a1a..27d28a862e 100644 --- a/srcpkgs/gsmartcontrol/template +++ b/srcpkgs/gsmartcontrol/template @@ -1,7 +1,7 @@ # Template file for 'gsmartcontrol' pkgname=gsmartcontrol version=0.8.7 -revision=1 +revision=2 build_style=gnu-configure hostmakedepends="pkg-config" makedepends="gtkmm2-devel pcre-devel desktop-file-utils" @@ -17,5 +17,16 @@ CXXFLAGS="-std=c++11" post_install() { # license files uneeded - rm -f ${PKGDESTDIR}/usr/share/doc/${pkgname}/LICENSE_* + rm -f ${DESTDIR}/usr/share/doc/${pkgname}/LICENSE_* + + # PolicyKit support + vinstall ${FILESDIR}/org.void.pkexec.gsmartcontrol.policy 644 /usr/share/polkit-1/actions + vbin ${FILESDIR}/gsmartcontrol-pkexec + + sed -i "s|^Exec=.*|Exec="/usr/bin/gsmartcontrol-pkexec"|" \ + ${DESTDIR}/usr/share/applications/gsmartcontrol.desktop + + # no more need of gsmartcontrol-root since polkit + rm -f ${DESTDIR}/usr/bin/${pkgname}-root + rm -f ${DESTDIR}/usr/share/man/man1/gsmartcontrol-root.1 }