From 384344198dcaa97847e66d3dd82f279ede08d690 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Jan 2017 22:33:46 +0100 Subject: file-systems: 'file-system-needed-for-boot?' is #t for parents of the store. Suggested by John Darrington . * gnu/system/file-systems.scm (%not-slash): New variable. (file-prefix?): New procedure. (file-system-needed-for-boot?): Use it to check whether FS holds the store. * tests/file-systems.scm ("file-system-needed-for-boot?"): New test. * gnu/tests/install.scm (%separate-store-os)[file-systems]: Remove 'needed-for-boot?' field for "/gnu". --- tests/file-systems.scm | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'tests/file-systems.scm') diff --git a/tests/file-systems.scm b/tests/file-systems.scm index aed27e89c2..fd1599e132 100644 --- a/tests/file-systems.scm +++ b/tests/file-systems.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015 Ludovic Courtès +;;; Copyright © 2015, 2017 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -17,6 +17,7 @@ ;;; along with GNU Guix. If not, see . (define-module (test-file-systems) + #:use-module (guix store) #:use-module (gnu system file-systems) #:use-module (srfi srfi-64) #:use-module (rnrs bytevectors)) @@ -50,4 +51,25 @@ (define-module (test-file-systems) (string-contains message "invalid UUID") (equal? form '(uuid "foobar")))))) +(test-assert "file-system-needed-for-boot?" + (let-syntax ((dummy-fs (syntax-rules () + ((_ directory) + (file-system + (device "foo") + (mount-point directory) + (type "ext4")))))) + (parameterize ((%store-prefix "/gnu/guix/store")) + (and (file-system-needed-for-boot? (dummy-fs "/")) + (file-system-needed-for-boot? (dummy-fs "/gnu")) + (file-system-needed-for-boot? (dummy-fs "/gnu/guix")) + (file-system-needed-for-boot? (dummy-fs "/gnu/guix/store")) + (not (file-system-needed-for-boot? + (dummy-fs "/gnu/guix/store/foo"))) + (not (file-system-needed-for-boot? (dummy-fs "/gn"))) + (not (file-system-needed-for-boot? + (file-system + (inherit (dummy-fs (%store-prefix))) + (device "/foo") + (flags '(bind-mount read-only))))))))) + (test-end) -- cgit v1.2.3