[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
16/18: installer: Use dynamic-wind to setup installer.
From: |
guix-commits |
Subject: |
16/18: installer: Use dynamic-wind to setup installer. |
Date: |
Mon, 17 Jan 2022 05:04:54 -0500 (EST) |
mothacehe pushed a commit to branch wip-harden-installer
in repository guix.
commit 16b2bd9d04f25d35b36b687ca8d488f59e8ca1c3
Author: Josselin Poiret <dev@jpoiret.xyz>
AuthorDate: Sat Jan 15 14:50:09 2022 +0100
installer: Use dynamic-wind to setup installer.
* gnu/installer.scm (installer-program): Use dynamic-wind, so that
completely uncaught exceptions can be printed properly.
Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
gnu/installer.scm | 91 ++++++++++++++++++++++++++++---------------------------
1 file changed, 46 insertions(+), 45 deletions(-)
diff --git a/gnu/installer.scm b/gnu/installer.scm
index c7e0921a19..1cfd9d1bc9 100644
--- a/gnu/installer.scm
+++ b/gnu/installer.scm
@@ -416,51 +416,52 @@ selected keymap."
(define current-installer newt-installer)
(define steps (#$steps current-installer))
- ((installer-init current-installer))
-
- (parameterize
- ((run-command-in-installer
- (installer-run-command current-installer)))
- (catch #t
- (lambda ()
- (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))
- (_
- ;; The installation failed, exit so that it is restarted
- ;; by login.
- #f)))
- (const #f)
- (lambda (key . args)
- (installer-log-line "crashing due to uncaught exception: ~s
~s"
- key args)
- (let ((error-file "/tmp/last-installer-error")
- (dump-archive "/tmp/dump.tgz"))
- (call-with-output-file error-file
- (lambda (port)
- (display-backtrace (make-stack #t) port)
- (print-exception port
- (stack-ref (make-stack #t) 1)
- key args)))
- (make-dump dump-archive
- #:result %current-result
- #:backtrace error-file)
- (let ((report
- ((installer-dump-page current-installer)
- dump-archive)))
- ((installer-exit-error current-installer)
- error-file report key args)))
- (primitive-exit 1))))
-
- ((installer-exit current-installer))))))
+ (dynamic-wind
+ (installer-init current-installer)
+ (lambda ()
+ (parameterize
+ ((run-command-in-installer
+ (installer-run-command current-installer)))
+ (catch #t
+ (lambda ()
+ (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))
+ (_
+ ;; The installation failed, exit so that it is
restarted
+ ;; by login.
+ #f)))
+ (const #f)
+ (lambda (key . args)
+ (installer-log-line "crashing due to uncaught exception:
~s ~s"
+ key args)
+ (let ((error-file "/tmp/last-installer-error")
+ (dump-archive "/tmp/dump.tgz"))
+ (call-with-output-file error-file
+ (lambda (port)
+ (display-backtrace (make-stack #t) port)
+ (print-exception port
+ (stack-ref (make-stack #t) 1)
+ key args)))
+ (make-dump dump-archive
+ #:result %current-result
+ #:backtrace error-file)
+ (let ((report
+ ((installer-dump-page current-installer)
+ dump-archive)))
+ ((installer-exit-error current-installer)
+ error-file report key args)))
+ (primitive-exit 1)))))
+
+ (installer-exit current-installer))))))
(program-file
"installer"
- 08/18: installer: Add installer-specific run command process., (continued)
- 08/18: installer: Add installer-specific run command process., guix-commits, 2022/01/17
- 09/18: installer: Use run-command-in-installer in (gnu installer parted)., guix-commits, 2022/01/17
- 10/18: installer: Raise condition when mklabel fails., guix-commits, 2022/01/17
- 14/18: installer: Use named prompt to abort or break installer steps., guix-commits, 2022/01/17
- 15/18: installer: Add error page when running external commands., guix-commits, 2022/01/17
- 17/18: installer: Turn passwords into opaque records., guix-commits, 2022/01/17
- 02/18: installer: Generalize logging facility., guix-commits, 2022/01/17
- 11/18: installer: Fix run-file-textbox-page when edit-button is #f., guix-commits, 2022/01/17
- 12/18: installer: Replace run-command by invoke in newt/page.scm., guix-commits, 2022/01/17
- 13/18: installer: Add nano to PATH., guix-commits, 2022/01/17
- 16/18: installer: Use dynamic-wind to setup installer.,
guix-commits <=