guix-commits
[Top][All Lists]
Advanced

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

04/12: installer: Log important bits to syslog.


From: guix-commits
Subject: 04/12: installer: Log important bits to syslog.
Date: Fri, 21 Feb 2020 17:08:37 -0500 (EST)

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

commit f50634cf515e5d61d6b09da1b154a303d5388a01
Author: Ludovic Courtès <address@hidden>
AuthorDate: Wed Feb 19 12:08:40 2020 +0100

    installer: Log important bits to syslog.
    
    * gnu/installer.scm (installer-program): Log crashes with 'syslog'.
    * gnu/installer/parted.scm (luks-format-and-open, luks-close)
    (mount-user-partitions, umount-user-partitions): Add 'syslog' calls.
    * gnu/installer/steps.scm (run-installer-steps): Log the running step
    with 'syslog'.
    * gnu/installer/utils.scm (run-shell-command): Add calls to 'syslog'.
---
 gnu/installer.scm        | 5 ++++-
 gnu/installer/parted.scm | 7 ++++++-
 gnu/installer/steps.scm  | 1 +
 gnu/installer/utils.scm  | 4 ++++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/gnu/installer.scm b/gnu/installer.scm
index 3f4ae4b..edef3fd 100644
--- a/gnu/installer.scm
+++ b/gnu/installer.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018, 2020 Mathieu Othacehe <address@hidden>
-;;; Copyright © 2019 Ludovic Courtès <address@hidden>
+;;; Copyright © 2019, 2020 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2019, 2020 Tobias Geerinckx-Rice <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -26,6 +26,7 @@
   #:use-module (guix utils)
   #:use-module (guix ui)
   #:use-module ((guix self) #:select (make-config.scm))
+  #:use-module (gnu installer utils)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
@@ -395,6 +396,8 @@ selected keymap."
                      #f)))
                 (const #f)
                 (lambda (key . args)
+                  (syslog "crashing due to uncaught exception: ~s ~s~%"
+                          key args)
                   (let ((error-file "/tmp/last-installer-error"))
                     (call-with-output-file error-file
                       (lambda (port)
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index c2b02c9..6c805cc 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2018, 2019 Mathieu Othacehe <address@hidden>
-;;; Copyright © 2019 Ludovic Courtès <address@hidden>
+;;; Copyright © 2019, 2020 Ludovic Courtès <address@hidden>
 ;;; Copyright © 2020 Tobias Geerinckx-Rice <address@hidden>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -1070,6 +1070,8 @@ USER-PARTITION if it is encrypted, or the plain file-name 
otherwise."
     (call-with-luks-key-file
      password
      (lambda (key-file)
+       (syslog "formatting and opening LUKS entry ~s at ~s~%"
+               label file-name)
        (system* "cryptsetup" "-q" "luksFormat" file-name key-file)
        (system* "cryptsetup" "open" "--type" "luks"
                 "--key-file" key-file file-name label)))))
@@ -1077,6 +1079,7 @@ USER-PARTITION if it is encrypted, or the plain file-name 
otherwise."
 (define (luks-close user-partition)
   "Close the encrypted partition pointed by USER-PARTITION."
   (let ((label (user-partition-crypt-label user-partition)))
+    (syslog "closing LUKS entry ~s~%" label)
     (system* "cryptsetup" "close" label)))
 
 (define (format-user-partitions user-partitions)
@@ -1150,6 +1153,7 @@ respective mount-points."
                        (file-name
                         (user-partition-upper-file-name user-partition)))
                   (mkdir-p target)
+                  (syslog "mounting ~s on ~s~%" file-name target)
                   (mount file-name target mount-type)))
               sorted-partitions)))
 
@@ -1165,6 +1169,7 @@ respective mount-points."
                        (target
                         (string-append (%installer-target-dir)
                                        mount-point)))
+                  (syslog "unmounting ~s~%" target)
                   (umount target)
                   (when crypt-label
                     (luks-close user-partition))))
diff --git a/gnu/installer/steps.scm b/gnu/installer/steps.scm
index 4e90f32..b2fc819 100644
--- a/gnu/installer/steps.scm
+++ b/gnu/installer/steps.scm
@@ -177,6 +177,7 @@ return the accumalated result so far."
                               #:done-steps '())))))
                  ((installer-step-break? c)
                   (reverse result)))
+         (syslog "running step '~a'~%" (installer-step-id step))
          (let* ((id (installer-step-id step))
                 (compute (installer-step-compute step))
                 (res (compute result done-steps)))
diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm
index a5f390e..842bd02 100644
--- a/gnu/installer/utils.scm
+++ b/gnu/installer/utils.scm
@@ -89,9 +89,13 @@ COMMAND exited successfully, #f otherwise."
                 (format (current-error-port)
                         (G_ "Command failed with exit code ~a.~%")
                         (invoke-error-exit-status c))
+                (syslog "command ~s failed with exit code ~a"
+                        command (invoke-error-exit-status c))
                 (pause)
                 #f))
+       (syslog "running command ~s~%" command)
        (invoke "bash" "--init-file" file)
+       (syslog "command ~s succeeded~%" command)
        (newline)
        (pause)
        #t))))



reply via email to

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