summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-09-05 18:48:21 +0200
committerMarius Bakke <marius@gnu.org>2022-09-06 23:43:40 +0200
commit92fdda5a6351dd5246b65165547d50d0b827cef3 (patch)
treee7cef4a9c550445fd37c88621ef37e6a508cf267 /gnu
parentc7032683a5ce8ec3b28c935efb00e238d28a5e19 (diff)
downloadguix-92fdda5a6351dd5246b65165547d50d0b827cef3.tar.gz
gnu: polkit: Look up polkit rules under /etc, and enable session tracking.
This is a follow-up to commit 290ac5cd1e67d99b4d704603c1559dfb72f542c2.

* gnu/packages/polkit.scm (polkit-mozjs)[source](snippet): Add substitutions.
[source](patches): New field.
[arguments]: Pass --sysconfdir and -Dsession_tracking in #:configure-flags.
* gnu/packages/patches/polkit-disable-systemd.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/polkit-disable-systemd.patch30
-rw-r--r--gnu/packages/polkit.scm15
3 files changed, 43 insertions, 3 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index f050a37be6..a9ea72673f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1649,6 +1649,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/plib-CVE-2011-4620.patch		\
   %D%/packages/patches/plib-CVE-2012-4552.patch		\
   %D%/packages/patches/plotutils-spline-test.patch		\
+  %D%/packages/patches/polkit-disable-systemd.patch		\
   %D%/packages/patches/portaudio-audacity-compat.patch		\
   %D%/packages/patches/portmidi-modular-build.patch		\
   %D%/packages/patches/postgresql-disable-resolve_symlinks.patch	\
diff --git a/gnu/packages/patches/polkit-disable-systemd.patch b/gnu/packages/patches/polkit-disable-systemd.patch
new file mode 100644
index 0000000000..551fdf7de8
--- /dev/null
+++ b/gnu/packages/patches/polkit-disable-systemd.patch
@@ -0,0 +1,30 @@
+Don't install systemd units unless using libsystemd session tracking.
+
+Submitted upstream:
+
+  https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/134
+
+diff --git a/data/meson.build b/data/meson.build
+--- a/data/meson.build
++++ b/data/meson.build
+@@ -26,7 +26,7 @@ if enable_pam
+   )
+ endif
+ 
+-if enable_logind
++if session_tracking == 'libsystemd-login'
+   configure_file(
+     input: 'polkit.service.in',
+     output: '@BASENAME@',
+diff --git a/meson.build b/meson.build
+--- a/meson.build
++++ b/meson.build
+@@ -199,7 +199,7 @@ if enable_logind
+ 
+   # systemd unit / service files
+   systemd_systemdsystemunitdir = get_option('systemdsystemunitdir')
+-  if systemd_systemdsystemunitdir == ''
++  if systemd_systemdsystemunitdir == '' and session_tracking == 'libsystemd-login'
+     systemd_dep = dependency('systemd', not_found_message: 'systemd required but not found, please provide a valid systemd user unit dir or disable it')
+     # FIXME: systemd.pc file does not use variables with relative paths, so `define_variable` cannot be used
+     systemd_systemdsystemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir')
diff --git a/gnu/packages/polkit.scm b/gnu/packages/polkit.scm
index 18d299bbd1..a5c1b0dc98 100644
--- a/gnu/packages/polkit.scm
+++ b/gnu/packages/polkit.scm
@@ -63,6 +63,7 @@
              (uri (string-append
                    "https://www.freedesktop.org/software/polkit/releases/"
                    name "-" version ".tar.gz"))
+             (patches (search-patches "polkit-disable-systemd.patch"))
              (sha256
               (base32
                "1apz3bh7nbpmlp1cr00pb8z8wp0c7yb23ninb959jz3r38saxiwx"))
@@ -75,11 +76,17 @@
                  (substitute* "test/meson.build"
                    (("subdir\\('polkitbackend'\\)")
                     ""))
-                 ;; Guix System's polkit
-                 ;; service stores actions under /etc/polkit-1/actions.
+                 ;; Look up actions and rules from /etc/polkit ...
+                 (substitute* "src/polkitbackend/meson.build"
+                   (("'-DPACKAGE_SYSCONF_DIR=.*,")
+                    "'-DPACKAGE_SYSCONF_DIR=\"/etc\"',"))
                  (substitute* "src/polkitbackend/polkitbackendinteractiveauthority.c"
                    (("PACKAGE_DATA_DIR \"/polkit-1/actions\"")
                     "PACKAGE_SYSCONF_DIR \"/polkit-1/actions\""))
+                 ;; ... but install package files below the prefix.
+                 (substitute* "meson.build"
+                   (("pk_sysconfdir = get_option\\('sysconfdir'\\)")
+                    "pk_sysconfdir = get_option('prefix') + '/etc'"))
                  ;; Set the setuid helper's real location.
                  (substitute* "src/polkitagent/polkitagentsession.c"
                    (("PACKAGE_PREFIX \"/lib/polkit-1/polkit-agent-helper-1\"")
@@ -104,7 +111,9 @@
            docbook-xsl))                ;for man page generation
     (arguments
      (list #:configure-flags
-           #~'("-Dman=true"
+           #~'("--sysconfdir=/etc"
+               "-Dsession_tracking=libelogind"
+               "-Dman=true"
                "-Dtests=true"
                "-Djs_engine=mozjs"
                ;; Work around broken gobject-introspection detection when