summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-09-01 13:30:31 +0200
committerAndy Wingo <wingo@pobox.com>2015-09-02 22:34:49 +0200
commit3f130e42e0237451503a19293fe60daa27853af0 (patch)
treeea6d907ae93a3241eaf4efd9b52f9f85187debbd
parent7b6c5c5d74fcb69b04929e7f5b2988adbeebcf2f (diff)
downloadguix-3f130e42e0237451503a19293fe60daa27853af0.tar.gz
gnu: polkit: Look for rules in /run/current-system/profile.
* gnu/packages/polkit.scm (polkit): Configure to look for actions and
  rules in the system profile.  Arrange to look for the setuid helper in
  /run/setuid-programs.  Fix introspection installation.

Based on a patch by Mark H Weaver <mhw@netris.org>.
-rw-r--r--gnu/packages/polkit.scm62
1 files changed, 52 insertions, 10 deletions
diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm
index 06afdf1330..13db7b6e65 100644
--- a/gnu/packages/polkit.scm
+++ b/gnu/packages/polkit.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
+;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,20 +63,61 @@
                  (substitute* "src/polkitbackend/polkitbackendsessionmonitor-systemd.c"
                    (("systemd") "elogind"))
                  (substitute* "src/polkitbackend/polkitbackendjsauthority.c"
-                   (("systemd") "elogind"))))))
+                   (("systemd") "elogind"))
+
+                 (substitute* "src/polkitagent/polkitagentsession.c"
+                   (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"")
+                    "\"/run/setuid-programs/polkit-agent-helper-1\""))
+                 (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c"
+                   (("PACKAGE_DATA_DIR \"/polkit-1/actions\"")
+                    "\"/run/current-system/profile/share/polkit-1/actions\""))
+                 (substitute* "src/polkitbackend/polkitbackendjsauthority.c"
+                   (("PACKAGE_SYSCONF_DIR \"/polkit-1/rules.d\"")
+                    "\"/run/current-system/profile/etc/polkit-1/rules.d\""))
+                 (substitute* "src/polkitbackend/polkitbackendjsauthority.c"
+                   (("PACKAGE_DATA_DIR \"/polkit-1/rules.d\"")
+                    "\"/run/current-system/profile/share/polkit-1/rules.d\""))))))
     (build-system gnu-build-system)
     (inputs
-      `(("expat" ,expat)
-        ("glib:bin" ,glib "bin") ; for glib-mkenums
-        ("elogind" ,elogind)
-        ("intltool" ,intltool)
-        ("linux-pam" ,linux-pam)
-        ("mozjs" ,mozjs)
-        ("nspr" ,nspr)))
+     `(("expat" ,expat)
+       ("linux-pam" ,linux-pam)
+       ("elogind" ,elogind)
+       ("mozjs" ,mozjs)
+       ("nspr" ,nspr)))
     (propagated-inputs
-      `(("glib" ,glib))) ; required by polkit-gobject-1.pc
+     `(("glib" ,glib))) ; required by polkit-gobject-1.pc
     (native-inputs
-      `(("pkg-config", pkg-config)))
+     `(("pkg-config" ,pkg-config)
+       ("glib:bin" ,glib "bin") ; for glib-mkenums
+       ("intltool" ,intltool)
+       ("gobject-introspection" ,gobject-introspection)))
+    (arguments
+     `(#:configure-flags '("--sysconfdir=/etc"
+                           "--enable-man-pages")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after
+          'unpack 'fix-introspection-install-dir
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let ((out (assoc-ref outputs "out")))
+              (substitute* (find-files "." "Makefile.in")
+                (("@INTROSPECTION_GIRDIR@")
+                 (string-append out "/share/gir-1.0/"))
+                (("@INTROSPECTION_TYPELIBDIR@")
+                 (string-append out "/lib/girepository-1.0/"))))))
+         (replace
+          'install
+          (lambda* (#:key outputs (make-flags '()) #:allow-other-keys)
+            ;; Override sysconfdir during "make install", to avoid attempting
+            ;; to install in /etc, and to instead install the skeletons in the
+            ;; output directory.
+            (let ((out (assoc-ref outputs "out")))
+             (zero? (apply system*
+                           "make" "install"
+                           (string-append "sysconfdir=" out "/etc")
+                           (string-append "polkit_actiondir="
+                                          out "/share/polkit-1/actions")
+                           make-flags))))))))
     (home-page "http://www.freedesktop.org/wiki/Software/polkit/")
     (synopsis "Authorization API for privilege management")
     (description "Polkit is an application-level toolkit for defining and