summary refs log tree commit diff
path: root/gnu/installer.scm
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-12-29 13:45:26 +0100
committerMathieu Othacehe <othacehe@gnu.org>2022-02-02 16:46:42 +0100
commit0d37a5df7e709cadca97cfbbf9c680dfe54b8302 (patch)
treef9b5877771fe70c92d7b7db327419dc2c6fd7c76 /gnu/installer.scm
parent8f585083277e64ea1e9a0848ef3c49f12327618c (diff)
downloadguix-0d37a5df7e709cadca97cfbbf9c680dfe54b8302.tar.gz
installer: Add crash dump upload support.
Suggested-by: Josselin Poiret <dev@jpoiret.xyz>

* gnu/installer/dump.scm: New file.
* gnu/installer/newt/dump.scm: New file.
* gnu/local.mk (INSTALLER_MODULES): Add them.
* gnu/installer/record.scm (<installer>)[dump-page]: New field.
* gnu/installer/steps.scm (%current-result): New variable.
(run-installer-steps): Update it.
* gnu/installer.scm (installer-program): Add tar and gip to the installer
path. Add guile-webutils and gnutls to the Guile extensions. Generate and send
the crash dump report.
* gnu/installer/newt.scm (exit-error): Add a report argument. Display the
report id.
(dump-page): New procedure.
(newt-installer): Update it.
Diffstat (limited to 'gnu/installer.scm')
-rw-r--r--gnu/installer.scm20
1 files changed, 16 insertions, 4 deletions
diff --git a/gnu/installer.scm b/gnu/installer.scm
index c8b7a66cfc..d57b1d673a 100644
--- a/gnu/installer.scm
+++ b/gnu/installer.scm
@@ -33,6 +33,7 @@
   #:use-module (gnu packages admin)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages compression)
   #:use-module (gnu packages connman)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages disk)
@@ -336,6 +337,8 @@ selected keymap."
                        guix ;guix system init call
                        util-linux ;mkwap
                        shadow
+                       tar ;dump
+                       gzip ;dump
                        coreutils)))
         (with-output-to-port (%make-void-port "w")
           (lambda ()
@@ -352,7 +355,8 @@ selected keymap."
     ;; packages …), etc. modules.
     (with-extensions (list guile-gcrypt guile-newt
                            guile-parted guile-bytestructures
-                           guile-json-3 guile-git guix gnutls)
+                           guile-json-3 guile-git guile-webutils
+                           guix gnutls)
       (with-imported-modules `(,@(source-module-closure
                                   `(,@modules
                                     (gnu services herd)
@@ -363,6 +367,7 @@ selected keymap."
             (use-modules (gnu installer record)
                          (gnu installer keymap)
                          (gnu installer steps)
+                         (gnu installer dump)
                          (gnu installer final)
                          (gnu installer hostname)
                          (gnu installer locale)
@@ -432,15 +437,22 @@ selected keymap."
                 (lambda (key . args)
                   (syslog "crashing due to uncaught exception: ~s ~s~%"
                           key args)
-                  (let ((error-file "/tmp/last-installer-error"))
+                  (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)))
-                    ((installer-exit-error current-installer)
-                     error-file 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)))))))