* 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