unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
To: 41541@debbugs.gnu.org
Subject: bug#41541: [PATCH 8/8] system: Add `hurd-activation'.
Date: Thu,  4 Jun 2020 15:59:14 +0200	[thread overview]
Message-ID: <20200604135914.4499-9-janneke@gnu.org> (raw)
In-Reply-To: <20200604135914.4499-1-janneke@gnu.org>

* gnu/build/activation.scm (boot-time-system): Add #:kernel-command-line
parameter.
* gnu/build/activation.scm (activate-current-system): Likewise, and pass it.
Change optional system parameter to #:system.
* gnu/system.scm (gnu/linux-activation-script): Rename from activation-script.
(activation-script, hurd-activation-script): New procedure.
---
 gnu/build/activation.scm |  9 +++--
 gnu/services.scm         | 81 +++++++++++++++++++++++++++-------------
 2 files changed, 60 insertions(+), 30 deletions(-)

diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index 30f5e87d5a..85ff8d8996 100644
--- a/gnu/build/activation.scm
+++ b/gnu/build/activation.scm
@@ -318,13 +318,14 @@ improvement."
   ;; a new system configuration and activate it, without rebooting.
   "/run/current-system")
 
-(define (boot-time-system)
+(define* (boot-time-system #:key (kernel-command-line linux-command-line))
   "Return the '--system' argument passed on the kernel command line."
-  (find-long-option "--system" (linux-command-line)))
+  (find-long-option "--system" (kernel-command-line)))
 
 (define* (activate-current-system
-          #:optional (system (or (getenv "GUIX_NEW_SYSTEM")
-                                 (boot-time-system))))
+          #:key (kernel-command-line linux-command-line)
+          (system (or (getenv "GUIX_NEW_SYSTEM")
+                      (boot-time-system #:kernel-command-line kernel-command-line))))
   "Atomically make SYSTEM the current system."
   ;; The 'GUIX_NEW_SYSTEM' environment variable is used as a way for 'guix
   ;; system reconfigure' to pass the file name of the new system.
diff --git a/gnu/services.scm b/gnu/services.scm
index 614956fbab..78f5d15f06 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -519,35 +519,64 @@ 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")
+
+        ;; Set up /run/current-system.  Among other things this
+        ;; sets up locales, which the activation snippets
+        ;; executed below may expect.
+        (activate-current-system #:kernel-command-line command-line)
+
+        ;; Run the services' activation snippets.
+        ;; TODO: Use 'load-compiled'.
+        (for-each primitive-load '#$actions))))
 
 (define (gexps->activation-gexp gexps)
   "Return a gexp that runs the activation script containing GEXPS."
-- 
2.26.2





  parent reply	other threads:[~2020-06-04 14:00 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26 14:21 bug#41541: merge wip-hurd-vm Jan Nieuwenhuizen
2020-05-27 10:01 ` Mathieu Othacehe
2020-05-27 11:11   ` Jan Nieuwenhuizen
2020-05-30 14:40   ` Jan Nieuwenhuizen
2020-06-02  8:48     ` Mathieu Othacehe
2020-06-02  9:24       ` Jan Nieuwenhuizen
2020-06-02 10:16         ` Mathieu Othacehe
2020-06-02 12:23           ` Jan Nieuwenhuizen
2020-06-02 12:40             ` Ludovic Courtès
2020-06-02 13:39               ` Jan Nieuwenhuizen
2020-06-03  9:18                 ` Ludovic Courtès
2020-06-03 15:22                   ` Jan Nieuwenhuizen
2020-06-03 15:38                     ` Mathieu Othacehe
2020-06-03 20:27                       ` Jan Nieuwenhuizen
2020-06-04  9:32                         ` Ludovic Courtès
2020-06-04 11:33                           ` Jan Nieuwenhuizen
2020-06-05 16:08                             ` Ludovic Courtès
2020-06-05 16:24                               ` Jan Nieuwenhuizen
2020-06-04 13:59 ` bug#41541: [PATCH 0/9] Merge wip-hurd-vm "last review round" Jan (janneke) Nieuwenhuizen
2020-06-04 13:59   ` bug#41541: [PATCH 1/8] system: Add 'hurd' field to <operating-system> Jan (janneke) Nieuwenhuizen
2020-06-06  7:21     ` Mathieu Othacehe
2020-06-06  8:26       ` Jan Nieuwenhuizen
2020-06-04 13:59   ` bug#41541: [PATCH 2/8] bootloader: Extend `<menu-entry>' for multiboot Jan (janneke) Nieuwenhuizen
2020-06-04 13:59   ` bug#41541: [PATCH 3/8] system: Add 'multiboot-modules' field to <boot-parameters> Jan (janneke) Nieuwenhuizen
2020-06-06  7:32     ` Mathieu Othacehe
2020-06-06 10:13       ` Jan Nieuwenhuizen
2020-06-04 13:59   ` bug#41541: [PATCH 4/8] bootloader: grub: Add support for multiboot Jan (janneke) Nieuwenhuizen
2020-06-06  7:47     ` Mathieu Othacehe
2020-06-06  8:46       ` Jan Nieuwenhuizen
2020-06-04 13:59   ` bug#41541: [PATCH 5/8] system: Use 'hurd' package in label Jan (janneke) Nieuwenhuizen
2020-06-04 13:59   ` bug#41541: [PATCH 6/8] system: examples: Add bare-hurd.tmpl Jan (janneke) Nieuwenhuizen
2020-06-06  7:56     ` Mathieu Othacehe
2020-06-04 13:59   ` bug#41541: [PATCH 7/8] services: hurd: Add `hurd-etc-service' Jan (janneke) Nieuwenhuizen
2020-06-04 13:59   ` Jan (janneke) Nieuwenhuizen [this message]
2020-06-06  8:03     ` bug#41541: [PATCH 8/8] system: Add `hurd-activation' Mathieu Othacehe
2020-06-06  8:54       ` Jan Nieuwenhuizen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200604135914.4499-9-janneke@gnu.org \
    --to=janneke@gnu.org \
    --cc=41541@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).