From dc995fcd5a62496721757f4ecb7f9b9d65399b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 10 Dec 2019 15:54:37 +0100 Subject: pack: Clarify the /bin/sh requirement for Singularity. * guix/scripts/pack.scm (squashfs-image)[symlinks*]: New variable. [build]: Use it instead of SYMLINKS. (guix-pack): Emit a warning and a hint when "bash" and "bash-minimal" are missing and PACK-FORMAT is 'squashfs. * doc/guix.texi (Invoking guix pack): Document the /bin/sh requirement for Singularity. --- guix/scripts/pack.scm | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'guix/scripts/pack.scm') diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index 61d18e2609..bbacc93bc0 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -334,6 +334,16 @@ added to the pack." (define environment (singularity-environment-file profile)) + (define symlinks* + ;; Singularity requires /bin (specifically /bin/sh), so ensure that + ;; symlink is created. + (if (find (match-lambda + (("/bin" . _) #t) + (_ #f)) + symlinks) + symlinks + `(("/bin" -> "bin") ,@symlinks))) + (define build (with-imported-modules (source-module-closure '((guix build utils) @@ -407,7 +417,7 @@ added to the pack." "s" "777" "0" "0" (relative-file-name (dirname source) target))))))) - '#$symlinks) + '#$symlinks*) "-p" "/.singularity.d d 555 0 0" @@ -1049,9 +1059,18 @@ Create a bundle of PACKAGE.\n")) (entry-point (assoc-ref opts 'entry-point)) (profile-name (assoc-ref opts 'profile-name)) (gc-root (assoc-ref opts 'gc-root))) + (define (lookup-package package) + (manifest-lookup manifest (manifest-pattern (name package)))) + (when (null? (manifest-entries manifest)) (warning (G_ "no packages specified; building an empty pack~%"))) + (when (and (eq? pack-format 'squashfs) + (not (any lookup-package '("bash" "bash-minimal")))) + (warning (G_ "Singularity requires you to provide a shell~%")) + (display-hint (G_ "Add @code{bash} or @code{bash-minimal} \ +to your package list."))) + (run-with-store store (mlet* %store-monad ((profile (profile-derivation manifest -- cgit v1.2.3