aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-05-24 15:51:57 +0200
committerLudovic Courtès <ludo@gnu.org>2014-05-24 18:10:05 +0200
commit484a2b3a5ac7337e5d3b8773f6ce8c356b72742b (patch)
tree5410e3a5b6a4706306b9937f5f740598fdaa2c05 /gnu
parenta9f48ff0766cfcd27426be540c7bb755f3093291 (diff)
downloadguix-484a2b3a5ac7337e5d3b8773f6ce8c356b72742b.tar
guix-484a2b3a5ac7337e5d3b8773f6ce8c356b72742b.tar.gz
system: Separate the activation script from the boot script.
* gnu/system.scm (operating-system-activation-script): New procedure, containing most of the former 'operating-system-boot-script'. (operating-system-boot-script): Call it, and 'primitive-load' its result. * guix/build/activation.scm (%booted-system): Remove. (activate-current-system): Remove #:boot? parameter and related code.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/system.scm27
1 files changed, 22 insertions, 5 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 6cb7d303db..1d708179bd 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -348,9 +348,10 @@ alias ll='ls -l'
,#$(user-account-shell account) ; this one is a gexp
#$(user-account-password account)))
-(define (operating-system-boot-script os)
- "Return the boot script for OS---i.e., the code started by the initrd once
-we're running in the final root."
+(define (operating-system-activation-script os)
+ "Return the activation script for OS---i.e., the code that \"activates\" the
+stateful part of OS, including user accounts and groups, special directories,
+etc."
(define %modules
'((guix build activation)
(guix build utils)
@@ -360,7 +361,6 @@ we're running in the final root."
(etc (operating-system-etc-directory os))
(modules (imported-modules %modules))
(compiled (compiled-modules %modules))
- (dmd-conf (dmd-configuration-file services))
(accounts (operating-system-accounts os)))
(define setuid-progs
(operating-system-setuid-programs os))
@@ -399,7 +399,24 @@ we're running in the final root."
(activate-setuid-programs (list #$@setuid-progs))
;; Set up /run/current-system.
- (activate-current-system #:boot? #t)
+ (activate-current-system)))))
+
+(define (operating-system-boot-script os)
+ "Return the boot script for OS---i.e., the code started by the initrd once
+we're running in the final root."
+ (mlet* %store-monad ((services (operating-system-services os))
+ (activate (operating-system-activation-script os))
+ (dmd-conf (dmd-configuration-file services)))
+ (gexp->file "boot"
+ #~(begin
+ ;; Activate the system.
+ ;; TODO: Use 'load-compiled'.
+ (primitive-load #$activate)
+
+ ;; Keep track of the booted system.
+ (false-if-exception (delete-file "/run/booted-system"))
+ (symlink (readlink "/run/current-system")
+ "/run/booted-system")
;; Close any remaining open file descriptors to be on the
;; safe side. This must be the very last thing we do,