[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
13/23: system: Add `hurd-activation'.
From: |
guix-commits |
Subject: |
13/23: system: Add `hurd-activation'. |
Date: |
Thu, 4 Jun 2020 07:52:13 -0400 (EDT) |
janneke pushed a commit to branch wip-hurd-vm
in repository guix.
commit e3a680469422e72cf09c390cba88adc66ccc43d4
Author: Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
AuthorDate: Sun May 3 16:32:09 2020 +0200
system: Add `hurd-activation'.
* 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 30f5e87..85ff8d8 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 614956f..78f5d15 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."
- 01/23: gnu: hurd: Update to upstream Hurd-reserved xattr index., (continued)
- 01/23: gnu: hurd: Update to upstream Hurd-reserved xattr index., guix-commits, 2020/06/04
- 06/23: system: Add 'hurd' field to <operating-system>., guix-commits, 2020/06/04
- 16/23: services: Add `hurd-console-service-type'., guix-commits, 2020/06/04
- 22/23: system: hurd: Remove 'cross-hurd-image' hack., guix-commits, 2020/06/04
- 10/23: system: Use 'hurd' package in label., guix-commits, 2020/06/04
- 04/23: image: Add Hurd support., guix-commits, 2020/06/04
- 05/23: system: hurd: Add hurd-default-essential-services., guix-commits, 2020/06/04
- 02/23: syscalls: set-thread-name, thread-name: Stub for the Hurd., guix-commits, 2020/06/04
- 09/23: bootloader: grub: Add support for multiboot., guix-commits, 2020/06/04
- 08/23: system: Add 'multiboot-modules' field to <boot-parameters>., guix-commits, 2020/06/04
- 13/23: system: Add `hurd-activation'.,
guix-commits <=
- 19/23: hurd-boot: Further cleanup of "rc"., guix-commits, 2020/06/04
- 15/23: services: hurd: Use activation-service, hurd-etc-service., guix-commits, 2020/06/04
- 17/23: services: Add `hurd-getty-service-type'., guix-commits, 2020/06/04
- 18/23: system: hurd: Populate services., guix-commits, 2020/06/04
- 20/23: hurd-boot: Use setxattr instead of MAKEDEV., guix-commits, 2020/06/04
- 21/23: gnu: services: Add %hurd-startup-service., guix-commits, 2020/06/04
- 23/23: system: bare-hurd.tmpl: Add openssh client and service., guix-commits, 2020/06/04