summaryrefslogtreecommitdiff
path: root/guix/scripts
diff options
context:
space:
mode:
authorLudovic Courtès <ludovic.courtes@inria.fr>2019-12-10 15:54:37 +0100
committerLudovic Courtès <ludo@gnu.org>2019-12-10 20:56:05 +0100
commitdc995fcd5a62496721757f4ecb7f9b9d65399b5c (patch)
tree15dd7b379c928ef204c0ef106c7c0f09563cbcbe /guix/scripts
parentfc8131638499d907153473119279cbcd7f029bc7 (diff)
downloadgnu-guix-dc995fcd5a62496721757f4ecb7f9b9d65399b5c.tar
gnu-guix-dc995fcd5a62496721757f4ecb7f9b9d65399b5c.tar.gz
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.
Diffstat (limited to 'guix/scripts')
-rw-r--r--guix/scripts/pack.scm21
1 files changed, 20 insertions, 1 deletions
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