* gnu/system/linux-initrd.scm (base-initrd): Move helper-packages body to ... * gnu/system/file-systems.scm (file-system-packages): ... here. Also export it. * gnu/services/base.scm (file-system-shepherd-service): Set PATH by using file-system-packages. --- gnu/services/base.scm | 12 ++++++------ gnu/system/file-systems.scm | 26 ++++++++++++++++++++++++++ gnu/system/linux-initrd.scm | 18 +----------------- 3 files changed, 33 insertions(+), 23 deletions(-)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 5298a11f6..f3224aae1 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -274,7 +274,9 @@ FILE-SYSTEM." (options (file-system-options file-system)) (check? (file-system-check? file-system)) (create? (file-system-create-mount-point? file-system)) - (dependencies (file-system-dependencies file-system))) + (needed-for-boot? (file-system-needed-for-boot? file-system)) + (dependencies (file-system-dependencies file-system)) + (packages (file-system-packages (list file-system)))) (and (file-system-mount? file-system) (with-imported-modules '((gnu build file-systems) (guix build bournish)) @@ -292,11 +294,9 @@ FILE-SYSTEM." ;; Make sure fsck.ext2 & co. can be found. (dynamic-wind (lambda () - (setenv "PATH" - (string-append - #$e2fsprogs "/sbin:" - "/run/current-system/profile/sbin:" - $PATH))) + (set-path-environment-variable "PATH" + '("bin" "sbin") + '#$packages)) (lambda () (mount-file-system `(#$device #$title #$target #$type #$flags diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 7011a279d..8107722c7 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 81c1278c0..1f1c30682 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