[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
19/22: installer: Ensure that all mount-points have a file system.
From: |
John Darrington |
Subject: |
19/22: installer: Ensure that all mount-points have a file system. |
Date: |
Tue, 27 Dec 2016 06:02:09 +0000 (UTC) |
jmd pushed a commit to branch wip-installer
in repository guix.
commit 325beb08ca3c36f02bab9625a62a5c78f34ba0df
Author: John Darrington <address@hidden>
Date: Mon Dec 26 14:38:49 2016 +0100
installer: Ensure that all mount-points have a file system.
* gnu/system/installer/filesystem.scm (filesystem-task-complete?): Add the
condition that all declared mount points must have a file system on the
respective partitions.
---
gnu/system/installer/filesystems.scm | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/gnu/system/installer/filesystems.scm
b/gnu/system/installer/filesystems.scm
index f3242ab..927248b 100644
--- a/gnu/system/installer/filesystems.scm
+++ b/gnu/system/installer/filesystems.scm
@@ -27,6 +27,7 @@
#:use-module (gurses menu)
#:use-module (ncurses curses)
#:use-module (ice-9 format)
+ #:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:export (minimum-store-size)
@@ -36,8 +37,14 @@
(define minimum-store-size 7000)
(define (filesystem-task-complete?)
- (and (find-mount-device "/" mount-points)
- (>= (sizeof-partition (find-mount-device "/gnu" mount-points))
minimum-store-size)))
+ (and (find-mount-device "/" mount-points) ; A device for / must exist
+ (>= (size-of-partition (find-mount-device "/gnu" mount-points))
+ minimum-store-size) ; /gnu must have enough space
+
+ ;; All partitions must have a filesystem
+ (fold (lambda (x prev)
+ (and (string-prefix? "ext" (partition-fs (string->partition
(car x))))
+ prev)) #t mount-points)))
(define (make-filesystem-page parent title)
(make-page (page-surface parent)
@@ -70,12 +77,19 @@
(menu-redraw menu)))
-(define (sizeof-partition device)
- "Return the size of the partition DEVICE"
- (partition-size
- (car (find (lambda (x)
- (equal? (partition-name (car x))
- device)) (partition-volume-pairs)))))
+(define (size-of-partition device)
+ "Return the size of the partition whose name is DEVICE"
+ (partition-size (string->partition device)))
+
+
+(define (string->partition device)
+ (match (find (lambda (x)
+ (equal? (partition-name (car x))
+ device)) (partition-volume-pairs))
+ ((p . _)
+ (when (not (partition? p))
+ (error (format #f "~s is not a partition" p)))
+ p)))
(define (filesystem-page-key-handler page ch)
@@ -139,7 +153,7 @@
(set! page-stack (cons next page-stack))
((page-refresh next) next)))
- ((< (sizeof-partition (find-mount-device "/gnu" mount-points))
minimum-store-size)
+ ((< (size-of-partition (find-mount-device "/gnu" mount-points))
minimum-store-size)
(let ((next
(make-dialog
page
- 20/22: install: Define new procedure pipe-cmd and use it to implement window-pipe., (continued)
- 20/22: install: Define new procedure pipe-cmd and use it to implement window-pipe., John Darrington, 2016/12/27
- 03/22: installer: Make "interfaces" return an alist., John Darrington, 2016/12/27
- 13/22: installer: Add path to mount/umount commands in installer service., John Darrington, 2016/12/27
- 10/22: gnu: Add service to start the installer in installation-os., John Darrington, 2016/12/27
- 11/22: installer: Add a task to actually call guix system init., John Darrington, 2016/12/27
- 18/22: installer: New predicate valid-hostname?, John Darrington, 2016/12/27
- 21/22: installer: Correct bugs generating the configuration., John Darrington, 2016/12/27
- 08/22: installer: Deal with partition tables which are (partially) corrupt., John Darrington, 2016/12/27
- 05/22: installer: Add a new menu to configure wireless interfaces., John Darrington, 2016/12/27
- 07/22: installer: Let the kernel know about (possibly) changed partitions., John Darrington, 2016/12/27
- 19/22: installer: Ensure that all mount-points have a file system.,
John Darrington <=
- 12/22: installer: Write the configuration to a temporary file., John Darrington, 2016/12/27