guix-commits
[Top][All Lists]
Advanced

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

10/18: installer: Raise condition when mklabel fails.


From: guix-commits
Subject: 10/18: installer: Raise condition when mklabel fails.
Date: Mon, 17 Jan 2022 05:04:53 -0500 (EST)

mothacehe pushed a commit to branch wip-harden-installer
in repository guix.

commit e91ddc728c2aa4d6c3b823f63089060b6c064267
Author: Josselin Poiret <dev@jpoiret.xyz>
AuthorDate: Sat Jan 15 14:50:03 2022 +0100

    installer: Raise condition when mklabel fails.
    
    * gnu/installer/parted.scm (mklabel): Do it.
    
    Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
---
 gnu/installer/parted.scm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index c8bb73ee64..e33ef5f8fd 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -635,8 +635,14 @@ determined by MAX-LENGTH-COLUMN procedure."
 (define (mklabel device type-name)
   "Create a partition table on DEVICE. TYPE-NAME is the type of the partition
 table, \"msdos\" or \"gpt\"."
-  (let ((type (disk-type-get type-name)))
-    (disk-new-fresh device type)))
+  (let* ((type (disk-type-get type-name))
+         (disk (disk-new-fresh device type)))
+    (or disk
+        (raise
+         (condition
+          (&error)
+          (&message (message (format #f "Cannot create partition table of type
+~a on device ~a." type-name (device-path device)))))))))
 
 
 ;;



reply via email to

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