summaryrefslogtreecommitdiff
path: root/gnu/installer.scm
diff options
context:
space:
mode:
authorJosselin Poiret <dev@jpoiret.xyz>2022-01-15 14:50:11 +0100
committerMathieu Othacehe <othacehe@gnu.org>2022-02-02 16:46:44 +0100
commitad55ccf9b18000144a4e0f28a0f9e57132f94edc (patch)
tree790d6fda13fb7c0bb88106ce8c944988e5d45afb /gnu/installer.scm
parent112ef30b84744872b3a7617d9e54b3df5db95560 (diff)
installer: Make dump archive creation optional and selective.
* gnu/installer.scm (installer-program): Let the installer customize the dump archive. * gnu/installer/dump.scm (prepare-dump, make-dump): Split make-dump in prepare-dump, which copies the files necessary for the dump, and make-dump which creates the archive. * gnu/installer/record.scm (installer): Add report-page field. Change documented return value of exit-error. * gnu/installer/newt.scm (exit-error): Change arguments to be a string containing the error. Let the user choose between exiting and initiating a dump. (report-page): Add new variable. * gnu/installer/newt/page.scm (run-dump-page): New variable. * gnu/installer/newt/dump.scm: Delete it. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
Diffstat (limited to 'gnu/installer.scm')
-rw-r--r--gnu/installer.scm43
1 files changed, 23 insertions, 20 deletions
diff --git a/gnu/installer.scm b/gnu/installer.scm
index 1cfd9d1bc98..7b2914be980 100644
--- a/gnu/installer.scm
+++ b/gnu/installer.scm
@@ -386,7 +386,8 @@ selected keymap."
386 (guix build utils) 386 (guix build utils)
387 ((system repl debug) 387 ((system repl debug)
388 #:select (terminal-width)) 388 #:select (terminal-width))
389 (ice-9 match)) 389 (ice-9 match)
390 (ice-9 textual-ports))
390 391
391 ;; Initialize gettext support so that installers can use 392 ;; Initialize gettext support so that installers can use
392 ;; (guix i18n) module. 393 ;; (guix i18n) module.
@@ -416,6 +417,7 @@ selected keymap."
416 417
417 (define current-installer newt-installer) 418 (define current-installer newt-installer)
418 (define steps (#$steps current-installer)) 419 (define steps (#$steps current-installer))
420
419 (dynamic-wind 421 (dynamic-wind
420 (installer-init current-installer) 422 (installer-init current-installer)
421 (lambda () 423 (lambda ()
@@ -436,30 +438,31 @@ selected keymap."
436 (sync) 438 (sync)
437 (stop-service 'root)) 439 (stop-service 'root))
438 (_ 440 (_
439 ;; The installation failed, exit so that it is restarted 441 ;; The installation failed, exit so that it is
440 ;; by login. 442 ;; restarted by login.
441 #f))) 443 #f)))
442 (const #f) 444 (const #f)
443 (lambda (key . args) 445 (lambda (key . args)
444 (installer-log-line "crashing due to uncaught exception: ~s ~s" 446 (installer-log-line "crashing due to uncaught exception: ~s ~s"
445 key args) 447 key args)
446 (let ((error-file "/tmp/last-installer-error") 448 (define dump-dir
447 (dump-archive "/tmp/dump.tgz")) 449 (prepare-dump key args #:result %current-result))
448 (call-with-output-file error-file 450 (define action
449 (lambda (port) 451 ((installer-exit-error current-installer)
450 (display-backtrace (make-stack #t) port) 452 (get-string-all
451 (print-exception port 453 (open-input-file
452 (stack-ref (make-stack #t) 1) 454 (string-append dump-dir "/installer-backtrace")))))
453 key args))) 455 (match action
454 (make-dump dump-archive 456 ('dump
455 #:result %current-result 457 (let* ((dump-files
456 #:backtrace error-file) 458 ((installer-dump-page current-installer)
457 (let ((report 459 dump-dir))
458 ((installer-dump-page current-installer) 460 (dump-archive
459 dump-archive))) 461 (make-dump dump-dir dump-files)))
460 ((installer-exit-error current-installer) 462 ((installer-report-page current-installer)
461 error-file report key args))) 463 dump-archive)))
462 (primitive-exit 1))))) 464 (_ #f))
465 (exit 1)))))
463 466
464 (installer-exit current-installer)))))) 467 (installer-exit current-installer))))))
465 468