guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20/28: system: Add `hurd-activation'.


From: guix-commits
Subject: 20/28: system: Add `hurd-activation'.
Date: Sat, 30 May 2020 11:20:17 -0400 (EDT)

janneke pushed a commit to branch wip-hurd-vm
in repository guix.

commit 6ed827c2815e3bca65e0ba4951b339c669cb82cc
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Sun May 3 16:32:09 2020 +0200

    system: Add `hurd-activation'.
    
    * gnu/system.scm (gnu/linux-activation-script): Rename from 
activation-script.
    (activation-script, hurd-activation-script): New procedure.
---
 gnu/services.scm | 76 +++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 50 insertions(+), 26 deletions(-)

diff --git a/gnu/services.scm b/gnu/services.scm
index 614956f..4e0bbc0 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -519,35 +519,59 @@ ACTIVATION-SCRIPT-TYPE."
 
 (define (activation-script gexps)
   "Return the system's activation script, which evaluates GEXPS."
+  (program-file "activate.scm" (if (hurd-target?)
+                                   (hurd-activation-script gexps)
+                                   (gnu/linux-activation-script gexps))))
+
+(define (gnu/linux-activation-script gexps)
+  "Return a GNU/Linux system activation script, which evaluates GEXPS."
+
   (define actions
     (map (cut program-file "activate-service.scm" <>) gexps))
 
-  (program-file "activate.scm"
-                (with-imported-modules (source-module-closure
-                                        '((gnu build activation)
-                                          (guix build utils)))
-                  #~(begin
-                      (use-modules (gnu build activation)
-                                   (guix build utils))
-
-                      ;; Make sure the user accounting database exists.  If it
-                      ;; does not exist, 'setutxent' does not create it and
-                      ;; thus there is no accounting at all.
-                      (close-port (open-file "/var/run/utmpx" "a0"))
-
-                      ;; Same for 'wtmp', which is populated by mingetty et
-                      ;; al.
-                      (mkdir-p "/var/log")
-                      (close-port (open-file "/var/log/wtmp" "a0"))
-
-                      ;; Set up /run/current-system.  Among other things this
-                      ;; sets up locales, which the activation snippets
-                      ;; executed below may expect.
-                      (activate-current-system)
-
-                      ;; Run the services' activation snippets.
-                      ;; TODO: Use 'load-compiled'.
-                      (for-each primitive-load '#$actions)))))
+  (with-imported-modules (source-module-closure
+                          '((gnu build activation)
+                            (guix build utils)))
+    #~(begin
+        (use-modules (gnu build activation)
+                     (guix build utils))
+
+        ;; Make sure the user accounting database exists.  If it
+        ;; does not exist, 'setutxent' does not create it and
+        ;; thus there is no accounting at all.
+        (close-port (open-file "/var/run/utmpx" "a0"))
+
+        ;; Same for 'wtmp', which is populated by mingetty et
+        ;; al.
+        (close-port (open-file "/var/log/wtmp" "a0"))
+
+        ;; Set up /run/current-system.  Among other things this
+        ;; sets up locales, which the activation snippets
+        ;; executed below may expect.
+        (activate-current-system)
+
+        ;; Run the services' activation snippets.
+        ;; TODO: Use 'load-compiled'.
+        (for-each primitive-load '#$actions))))
+
+(define (hurd-activation-script gexps)
+  "Return the Hurd activation script, which evaluates GEXPS."
+  (define actions
+    (map (cut program-file "activate-service.scm" <>) gexps))
+
+  (with-imported-modules (source-module-closure
+                          '((gnu build activation)
+                            (guix build utils)))
+    #~(begin
+        (use-modules (gnu build activation)
+                     (guix build utils))
+
+        (mkdir-p "/var/run")            ;for the PID files
+        (mkdir-p "/var/log")
+
+        ;; XXX TODO
+        ;; (activate-hurd-system)
+        (for-each primitive-load '#$actions))))
 
 (define (gexps->activation-gexp gexps)
   "Return a gexp that runs the activation script containing GEXPS."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]