Date: Saturday, January 11, 2014 @ 22:56:20
  Author: bgyorgy
Revision: 103825

upgpkg: gsmartcontrol 0.8.7-4

Make polkit optional

Added:
  gsmartcontrol/trunk/gsmartcontrol_polkit
Modified:
  gsmartcontrol/trunk/PKGBUILD
  gsmartcontrol/trunk/gsmartcontrol.install
  gsmartcontrol/trunk/org.archlinux.pkexec.gsmartcontrol.policy

-----------------------+
 PKGBUILD              |   43 ++++++++++++++++++++++---------------------
 gsmartcontrol.install |    7 ++-----
 gsmartcontrol_polkit  |    6 ++++++
 3 files changed, 30 insertions(+), 26 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2014-01-11 21:33:28 UTC (rev 103824)
+++ PKGBUILD    2014-01-11 21:56:20 UTC (rev 103825)
@@ -2,49 +2,50 @@
 
 pkgname=gsmartcontrol
 pkgver=0.8.7
-pkgrel=3
+pkgrel=4
 pkgdesc="A graphical user interface for the smartctl hard disk drive health 
inspection tool."
 arch=('i686' 'x86_64')
 url="http://gsmartcontrol.berlios.de/home/index.php/en/Home";
 license=('GPL3')
-depends=('smartmontools' 'gtkmm' 'xorg-xmessage' 'hicolor-icon-theme' 'polkit')
-optdepends=('polkit-gnome: to run gsmartcontrol directly from menu')
+depends=('smartmontools' 'gtkmm' 'xorg-xmessage' 'hicolor-icon-theme')
+optdepends=('polkit: to run gsmartcontrol directly from menu')
 install=${pkgname}.install
 source=(http://download.berlios.de/gsmartcontrol/${pkgname}-${pkgver}.tar.bz2
-        org.archlinux.pkexec.gsmartcontrol.policy)
+        org.archlinux.pkexec.gsmartcontrol.policy
+        gsmartcontrol_polkit)
 md5sums=('6d104c2ffc1e693cd1a8052a6d7e3b30'
-         'e403f8e06e6b8a3d1a99da5e584b2257')
+         '503989a7e6a9a287d81e91243d03f162'
+         '33bdda04d8db1525f2507485f3f2a663')
 
+prepare() {
+       cd "${srcdir}/${pkgname}-${pkgver}"
+
+        # Modify desktop file
+        sed -i "s|^Exec=.*|Exec="@prefix@/bin/gsmartcontrol_polkit"|" \
+                data/gsmartcontrol.desktop.in
+}
+
 build() {
-       cd ${srcdir}/${pkgname}-${pkgver}
+       cd "${srcdir}/${pkgname}-${pkgver}"
        ./configure --prefix=/usr
        make 
 }
 
 check() {
-       cd ${srcdir}/${pkgname}-${pkgver}
+       cd "${srcdir}/${pkgname}-${pkgver}"
         make check
 }
 
 package() {
-       cd ${srcdir}/${pkgname}-${pkgver}
+       cd "${srcdir}/${pkgname}-${pkgver}"
 
        make DESTDIR=${pkgdir} install
 
-        # We need rename the original binary
-        mv "${pkgdir}/usr/bin/gsmartcontrol" 
"${pkgdir}/usr/bin/gsmartcontrol.elf"
-
         # Install launcher script
-        echo '#!/bin/sh' > ${pkgdir}/usr/bin/gsmartcontrol
-        echo 'pkexec --disable-internal-agent "/usr/bin/gsmartcontrol.elf" 
"$@"' \
-                >> ${pkgdir}/usr/bin/gsmartcontrol
-        chmod 755 ${pkgdir}/usr/bin/gsmartcontrol
+        install -m755 ${srcdir}/gsmartcontrol_polkit \
+                "${pkgdir}/usr/bin/gsmartcontrol_polkit"
 
-        # Modify desktop file
-        sed -i -e "s|^Exec=.*|Exec=/usr/bin/gsmartcontrol|" \
-                "${pkgdir}/usr/share/applications/gsmartcontrol.desktop"
-
         # Install policy file
-        install -Dm766 $srcdir/org.archlinux.pkexec.gsmartcontrol.policy \
-                
$pkgdir/usr/share/polkit-1/actions/org.archlinux.pkexec.gsmartcontrol.policy
+        install -Dm644 ${srcdir}/org.archlinux.pkexec.gsmartcontrol.policy \
+                
"${pkgdir}/usr/share/polkit-1/actions/org.archlinux.pkexec.gsmartcontrol.policy"
 }

Modified: gsmartcontrol.install
===================================================================
--- gsmartcontrol.install       2014-01-11 21:33:28 UTC (rev 103824)
+++ gsmartcontrol.install       2014-01-11 21:56:20 UTC (rev 103825)
@@ -1,14 +1,11 @@
 post_install() {
   which xdg-icon-resource 1>/dev/null 2>/dev/null && xdg-icon-resource 
forceupdate || true
-  echo 'If you use a lightweight windowmanager, remember to run'
-  echo '/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 to enable'
-  echo 'graphical authentication, which may be needed for pkexec to work.'
 }
 
 post_upgrade() {
-  which xdg-icon-resource 1>/dev/null 2>/dev/null && xdg-icon-resource 
forceupdate || true
+  post_install $1
 }
 
 post_remove() {
-  which xdg-icon-resource 1>/dev/null 2>/dev/null && xdg-icon-resource 
forceupdate || true
+  post_install $1
 }

Added: gsmartcontrol_polkit
===================================================================
--- gsmartcontrol_polkit                                (rev 0)
+++ gsmartcontrol_polkit        2014-01-11 21:56:20 UTC (rev 103825)
@@ -0,0 +1,6 @@
+#!/bin/bash
+if [ $(which pkexec) ]; then
+       pkexec --disable-internal-agent "/usr/bin/gsmartcontrol" "$@"
+else
+       /usr/bin/gsmartcontrol "$@"
+fi

Modified: org.archlinux.pkexec.gsmartcontrol.policy
===================================================================
(Binary files differ)

Reply via email to