[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/01: file-systems: Factorize file-system-packages.
From: |
Danny Milosavljevic |
Subject: |
01/01: file-systems: Factorize file-system-packages. |
Date: |
Sat, 18 Mar 2017 05:41:24 -0400 (EDT) |
dannym pushed a commit to branch master
in repository guix.
commit 7208995426714c9fc3ad59cadc3cc0f52df0f018
Author: Danny Milosavljevic <address@hidden>
Date: Sat Mar 18 10:38:51 2017 +0100
file-systems: Factorize file-system-packages.
* gnu/system/linux-initrd.scm (base-initrd): Move helper-packages body to
...
* gnu/system/file-systems.scm (file-system-packages): ... here. New
variable.
Also export it.
---
gnu/system/file-systems.scm | 26 ++++++++++++++++++++++++++
gnu/system/linux-initrd.scm | 18 +-----------------
2 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 7011a27..8107722 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -22,6 +22,8 @@
#:use-module (guix records)
#:use-module ((gnu build file-systems)
#:select (string->uuid uuid->string))
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages disk)
#:re-export (string->uuid
uuid->string)
#:export (<file-system>
@@ -65,6 +67,8 @@
file-system-mapping->bind-mount
+ file-system-packages
+
%store-mapping
%network-configuration-files
%network-file-mappings))
@@ -411,4 +415,26 @@ a bind mount."
(writable? (string=? file "/etc/resolv.conf"))))
%network-configuration-files))
+(define (file-system-type-predicate type)
+ (lambda (fs)
+ (string=? (file-system-type fs) type)))
+
+(define* (file-system-packages file-systems #:key (volatile-root? #f))
+ `(,@(if (find (lambda (fs)
+ (string-prefix? "ext" (file-system-type fs)))
+ file-systems)
+ (list e2fsck/static)
+ '())
+ ,@(if (find (lambda (fs)
+ (string-suffix? "fat" (file-system-type fs)))
+ file-systems)
+ (list fatfsck/static)
+ '())
+ ,@(if (find (file-system-type-predicate "btrfs") file-systems)
+ (list btrfs-progs/static)
+ '())
+ ,@(if volatile-root?
+ (list unionfs-fuse/static)
+ '())))
+
;;; file-systems.scm ends here
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 81c1278..1f1c306 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -272,23 +272,7 @@ loaded at boot time in the order in which they appear."
,@extra-modules))
(define helper-packages
- ;; Packages to be copied on the initrd.
- `(,@(if (find (lambda (fs)
- (string-prefix? "ext" (file-system-type fs)))
- file-systems)
- (list e2fsck/static)
- '())
- ,@(if (find (lambda (fs)
- (string-suffix? "fat" (file-system-type fs)))
- file-systems)
- (list fatfsck/static)
- '())
- ,@(if (find (file-system-type-predicate "btrfs") file-systems)
- (list btrfs-progs/static)
- '())
- ,@(if volatile-root?
- (list unionfs-fuse/static)
- '())))
+ (file-system-packages file-systems #:volatile-root? volatile-root?))
(raw-initrd file-systems
#:linux linux