summary refs log tree commit diff
diff options
context:
space:
mode:
-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