[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
135/197: installer: Use a "hard" method of rebooting. Do not rely on she
From: |
Danny Milosavljevic |
Subject: |
135/197: installer: Use a "hard" method of rebooting. Do not rely on shepherd. |
Date: |
Mon, 3 Jul 2017 20:37:13 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 2f136798a3731603e4a0130c61c59190ad35b4e5
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")
- 117/197: installer: Remove unnecessary "begin"., (continued)
- 117/197: installer: Remove unnecessary "begin"., Danny Milosavljevic, 2017/07/03
- 113/197: installer: Explicitly set the #:panel parameter for window creation procedures., Danny Milosavljevic, 2017/07/03
- 122/197: gurses: Populate the choices box in forms., Danny Milosavljevic, 2017/07/03
- 128/197: installer: Remove redundant list of file system types., Danny Milosavljevic, 2017/07/03
- 115/197: installer: New procedure refresh*., Danny Milosavljevic, 2017/07/03
- 153/197: installer: Add optional arguments to addstr*., Danny Milosavljevic, 2017/07/03
- 97/197: installer: Whitespace changes only, Danny Milosavljevic, 2017/07/03
- 139/197: installer: Allow file system specifications to be removed., Danny Milosavljevic, 2017/07/03
- 136/197: installer: No passphrase is needed for clear networks., Danny Milosavljevic, 2017/07/03
- 138/197: installer: Clear the mount point field for swap file systems., Danny Milosavljevic, 2017/07/03
- 135/197: installer: Use a "hard" method of rebooting. Do not rely on shepherd.,
Danny Milosavljevic <=
- 148/197: installer: Support WEP encrypted wireless., Danny Milosavljevic, 2017/07/03
- 176/197: installer: Fix incorrect symbol in generated config file., Danny Milosavljevic, 2017/07/03
- 177/197: installer: Remove non-existant supplementary group., Danny Milosavljevic, 2017/07/03
- 182/197: installer: Kill old dhclient instance before starting new one., Danny Milosavljevic, 2017/07/03
- 189/197: installer: Fix buglet where keys were sometimes ignored in users page., Danny Milosavljevic, 2017/07/03
- 179/197: installer: Mount all partitions instead of just the root., Danny Milosavljevic, 2017/07/03
- 190/197: gurses: forms: Minor refactor., Danny Milosavljevic, 2017/07/03
- 194/197: guix system: Remove outdated (gnu system grub) import., Danny Milosavljevic, 2017/07/03
- 197/197: installer: Use "G_" instead of "_"., Danny Milosavljevic, 2017/07/03
- 188/197: installer: Go back to main menu after "cancel", Danny Milosavljevic, 2017/07/03