[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
36/197: installer: Ensure that all mount-points have a file system.
From: |
Danny Milosavljevic |
Subject: |
36/197: installer: Ensure that all mount-points have a file system. |
Date: |
Mon, 3 Jul 2017 20:36:56 -0400 (EDT) |
dannym pushed a commit to branch wip-installer-2
in repository guix.
commit 6c487279c3dbbbc5a8f4337ebfe15942e29e8471
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
- 47/197: installer: Improve install page., (continued)
- 47/197: installer: Improve install page., Danny Milosavljevic, 2017/07/03
- 29/197: installer: Add a task to actually call guix system init., Danny Milosavljevic, 2017/07/03
- 53/197: installer: Change N_ from a procedure to a macro., Danny Milosavljevic, 2017/07/03
- 50/197: installer: Issue message to user on failure of filesystems task., Danny Milosavljevic, 2017/07/03
- 61/197: installer: Indicate which wireless access points are encrypted., Danny Milosavljevic, 2017/07/03
- 59/197: installer: Format configuration to fix width of window., Danny Milosavljevic, 2017/07/03
- 65/197: installer: Ensure that all mount points are absolute paths., Danny Milosavljevic, 2017/07/03
- 09/197: installer: Use a record instead of a list to contain tasks., Danny Milosavljevic, 2017/07/03
- 23/197: installer: Use a cleaner way of generating the lspci information., Danny Milosavljevic, 2017/07/03
- 35/197: installer: New predicate valid-hostname?, Danny Milosavljevic, 2017/07/03
- 36/197: installer: Ensure that all mount-points have a file system.,
Danny Milosavljevic <=
- 39/197: installer: Replace an instance of cdr with match., Danny Milosavljevic, 2017/07/03
- 46/197: installer: Replace "%temporary-configuration-file-port" with "config-file"., Danny Milosavljevic, 2017/07/03
- 30/197: installer: Write the configuration to a temporary file., Danny Milosavljevic, 2017/07/03
- 24/197: installer: Add a new menu to configure wireless interfaces., Danny Milosavljevic, 2017/07/03
- 49/197: installer: Replace spawned mount command with the mount syscall., Danny Milosavljevic, 2017/07/03
- 44/197: installer: Use consistent window heights., Danny Milosavljevic, 2017/07/03
- 52/197: installer: Prevent the user specifying the same mount point twice., Danny Milosavljevic, 2017/07/03
- 51/197: installer: Allow users to remove mount points during configuration., Danny Milosavljevic, 2017/07/03
- 14/197: installer: Add procedures to replace car/cdr since these are frounded upon by Guile gurus., Danny Milosavljevic, 2017/07/03
- 55/197: installer: Use global variable instead of string literal for "/gnu"., Danny Milosavljevic, 2017/07/03