gsmartcontrol: added policykit support for desktop menu launcher.

This commit is contained in:
yopito 2015-11-27 01:11:43 +01:00
parent 8ca6fec389
commit df32c8156f
4 changed files with 40 additions and 2 deletions

View file

@ -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.

View file

@ -0,0 +1,4 @@
#!/bin/sh
pkexec --disable-internal-agent "/usr/bin/gsmartcontrol" "$@"

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"
"http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
<action id="org.void.pkexec.gsmartcontrol">
<message>Authentication is required to run GSmartControl</message>
<icon_name>gsmartcontrol</icon_name>
<defaults>
<allow_any>auth_admin</allow_any>
<allow_inactive>auth_admin</allow_inactive>
<allow_active>auth_admin</allow_active>
</defaults>
<annotate key="org.freedesktop.policykit.exec.path">/usr/bin/gsmartcontrol</annotate>
<annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>
</action>
</policyconfig>

View file

@ -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
}