guix-commits
[Top][All Lists]
Advanced

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

06/21: installer: Use a "hard" method of rebooting. Do not rely on sheph


From: John Darrington
Subject: 06/21: installer: Use a "hard" method of rebooting. Do not rely on shepherd.
Date: Sun, 29 Jan 2017 07:35:01 +0000 (UTC)

jmd pushed a commit to branch wip-installer
in repository guix.

commit 5189573ab1eb7c8b53b00c2d59d60e68c6f4a6bf
Author: John Darrington <address@hidden>
Date:   Tue Jan 24 08:13:39 2017 +0100

    installer: Use a "hard" method of rebooting. Do not rely on shepherd.
    
    * gnu/system/installer/install.scm (force-reboot): New procedure.
---
 gnu/system/installer/install.scm |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/gnu/system/installer/install.scm b/gnu/system/installer/install.scm
index 4753ae4..1811701 100644
--- a/gnu/system/installer/install.scm
+++ b/gnu/system/installer/install.scm
@@ -52,6 +52,28 @@
                      (reboot ,(M_ "_Reboot") #t)
                      (cancel ,(M_ "Canc_el") #t)))
 
+
+;; We have to use this "hard" way of rebooting, because
+;; we have instructed the user to remove the device which
+;; contains our root filesystem
+(define (force-reboot)
+  (catch
+   #t
+   (lambda ()
+     (let ((p (open "/proc/sys/kernel/sysrq" O_WRONLY)))
+       (display "1\n" p)
+       (close p))
+
+     (let ((p (open "/proc/sysrq-trigger" O_WRONLY)))
+       (display "b\n" p)
+       (close p)))
+
+   (lambda (key . args)
+     #f)
+   (lambda (key subr message args . rest)
+     #f)))
+
+
 (define (install-page-key-handler page ch)
   (let ((nav  (page-datum page 'navigation))
         (config-window  (page-datum page 'config-window)))
@@ -80,7 +102,7 @@
       (page-leave))
 
      ((buttons-key-matches-symbol? nav ch 'reboot)
-      (system* "reboot"))
+      (force-reboot))
 
      ((buttons-key-matches-symbol? nav ch 'continue)
       (let ((target "/target")



reply via email to

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