diff mbox series

[bug#62307,core-updates,15/15] system: pam: Only add linux-pam reference if on Linux.

Message ID 7b96d7bffdcdc7e3afea5c089200c8542ec12400.1679349992.git.dev@jpoiret.xyz
State New
Headers show
Series Update Hurd and fix build failures | expand

Commit Message

Josselin Poiret March 20, 2023, 10:10 p.m. UTC
* gnu/system/pam.scm (pam-root-service-type): Do it.
---
 gnu/system/pam.scm | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Comments

Ludovic Courtès March 22, 2023, 4:30 p.m. UTC | #1
Hi!

Josselin Poiret <dev@jpoiret.xyz> skribis:

> * gnu/system/pam.scm (pam-root-service-type): Do it.

[...]

> +                 (cons (service-extension etc-service-type /etc-entry)
> +                       (if (target-linux? (or (%current-target-system)
> +                                              (%current-system)))

Unfortunately this isn’t quite correct: the value of these two
parameters will be checked at a time when their value could be anything;
it could be different from the actual system.

But hmm… I don’t have a better idea right now, so maybe we can do that
and add a FIXME.

Ludo’.
diff mbox series

Patch

diff --git a/gnu/system/pam.scm b/gnu/system/pam.scm
index b635681642..8408e33c3f 100644
--- a/gnu/system/pam.scm
+++ b/gnu/system/pam.scm
@@ -20,6 +20,7 @@  (define-module (gnu system pam)
   #:use-module (guix records)
   #:use-module (guix derivations)
   #:use-module (guix gexp)
+  #:use-module (guix utils)
   #:use-module (gnu services)
   #:use-module (gnu system setuid)
   #:use-module (ice-9 match)
@@ -377,12 +378,15 @@  (define (extend-configuration initial extensions)
 (define pam-root-service-type
   (service-type (name 'pam)
                 (extensions
-                 (list (service-extension
-                        setuid-program-service-type
-                        (lambda (_)
-                          (list (file-like->setuid-program
-                                 (file-append linux-pam "/sbin/unix_chkpwd")))))
-                       (service-extension etc-service-type /etc-entry)))
+                 (cons (service-extension etc-service-type /etc-entry)
+                       (if (target-linux? (or (%current-target-system)
+                                              (%current-system)))
+                           (list (service-extension
+                                  setuid-program-service-type
+                                  (lambda (_)
+                                    (list (file-like->setuid-program
+                                           (file-append linux-pam "/sbin/unix_chkpwd"))))))
+                           '())))
 
                 ;; Arguments include <pam-service> as well as procedures.
                 (compose concatenate)