guix-commits
[Top][All Lists]
Advanced

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

05/07: installer: Actually reboot when the user presses "Reboot."


From: guix-commits
Subject: 05/07: installer: Actually reboot when the user presses "Reboot."
Date: Fri, 26 Apr 2019 08:19:46 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 98f035482fcb32683429a474f4071bd530c3c1b8
Author: Ludovic Courtès <address@hidden>
Date:   Fri Apr 26 14:08:39 2019 +0200

    installer: Actually reboot when the user presses "Reboot."
    
    * gnu/installer/newt/final.scm (run-install-success-page): Return
    'success.
    * gnu/installer.scm (installer-program): Check the result of the 'final
    step and reboot upon success.
---
 gnu/installer.scm            | 19 +++++++++++++++----
 gnu/installer/newt/final.scm |  5 ++++-
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/gnu/installer.scm b/gnu/installer.scm
index dfb0c9d..fe28413 100644
--- a/gnu/installer.scm
+++ b/gnu/installer.scm
@@ -314,6 +314,7 @@ selected keymap."
                            guile-json guile-git guix)
       (with-imported-modules `(,@(source-module-closure
                                   `(,@modules
+                                    (gnu services herd)
                                     (guix build utils))
                                   #:select? module-to-import?)
                                ((guix config) => ,(make-config.scm)))
@@ -363,10 +364,20 @@ selected keymap."
 
               (catch #t
                 (lambda ()
-                  (run-installer-steps
-                   #:rewind-strategy 'menu
-                   #:menu-proc (installer-menu-page current-installer)
-                   #:steps steps))
+                  (define results
+                    (run-installer-steps
+                     #:rewind-strategy 'menu
+                     #:menu-proc (installer-menu-page current-installer)
+                     #:steps steps))
+
+                  (match (result-step results 'final)
+                    ('success
+                     ;; We did it!  Let's reboot!
+                     (sync)
+                     (stop-service 'root))
+                    (_                            ;installation failed
+                     ;; TODO: Honor the result of 'run-install-failed-page'.
+                     #f)))
                 (const #f)
                 (lambda (key . args)
                   (let ((error-file "/tmp/last-installer-error"))
diff --git a/gnu/installer/newt/final.scm b/gnu/installer/newt/final.scm
index f470a90..e8d3c48 100644
--- a/gnu/installer/newt/final.scm
+++ b/gnu/installer/newt/final.scm
@@ -56,7 +56,10 @@ This will take a few minutes.")
    (G_ "Reboot")
    (G_ "Congratulations!  Installation is now complete.  \
 You may remove the device containing the installation image and \
-press the button to reboot.")))
+press the button to reboot."))
+
+  ;; Return success so that the installer happily reboots.
+  'success)
 
 (define (run-install-failed-page)
   (choice-window



reply via email to

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