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.
This commit is contained in:
parent
fc81316384
commit
dc995fcd5a
2 changed files with 36 additions and 2 deletions
|
@ -5053,7 +5053,7 @@ Yet another option is to produce a SquashFS image with the following
|
||||||
command:
|
command:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
guix pack -f squashfs guile emacs geiser
|
guix pack -f squashfs bash guile emacs geiser
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
|
@ -5088,6 +5088,21 @@ package names passed on the command line or in the manifest file.
|
||||||
This produces a SquashFS image containing all the specified binaries and
|
This produces a SquashFS image containing all the specified binaries and
|
||||||
symlinks, as well as empty mount points for virtual file systems like
|
symlinks, as well as empty mount points for virtual file systems like
|
||||||
procfs.
|
procfs.
|
||||||
|
|
||||||
|
@quotation Note
|
||||||
|
Singularity @emph{requires} you to provide @file{/bin/sh} in the image.
|
||||||
|
For that reason, @command{guix pack -f squashfs} always implies @code{-S
|
||||||
|
/bin=bin}. Thus, your @command{guix pack} invocation must always start
|
||||||
|
with something like:
|
||||||
|
|
||||||
|
@example
|
||||||
|
guix pack -f squashfs bash @dots{}
|
||||||
|
@end example
|
||||||
|
|
||||||
|
If you forget the @code{bash} (or similar) package, @command{singularity
|
||||||
|
run} and @command{singularity exec} will fail with an unhelpful ``no
|
||||||
|
such file or directory'' message.
|
||||||
|
@end quotation
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@cindex relocatable binaries
|
@cindex relocatable binaries
|
||||||
|
|
|
@ -334,6 +334,16 @@ added to the pack."
|
||||||
(define environment
|
(define environment
|
||||||
(singularity-environment-file profile))
|
(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
|
(define build
|
||||||
(with-imported-modules (source-module-closure
|
(with-imported-modules (source-module-closure
|
||||||
'((guix build utils)
|
'((guix build utils)
|
||||||
|
@ -407,7 +417,7 @@ added to the pack."
|
||||||
"s" "777" "0" "0"
|
"s" "777" "0" "0"
|
||||||
(relative-file-name (dirname source)
|
(relative-file-name (dirname source)
|
||||||
target)))))))
|
target)))))))
|
||||||
'#$symlinks)
|
'#$symlinks*)
|
||||||
|
|
||||||
"-p" "/.singularity.d d 555 0 0"
|
"-p" "/.singularity.d d 555 0 0"
|
||||||
|
|
||||||
|
@ -1049,9 +1059,18 @@ Create a bundle of PACKAGE.\n"))
|
||||||
(entry-point (assoc-ref opts 'entry-point))
|
(entry-point (assoc-ref opts 'entry-point))
|
||||||
(profile-name (assoc-ref opts 'profile-name))
|
(profile-name (assoc-ref opts 'profile-name))
|
||||||
(gc-root (assoc-ref opts 'gc-root)))
|
(gc-root (assoc-ref opts 'gc-root)))
|
||||||
|
(define (lookup-package package)
|
||||||
|
(manifest-lookup manifest (manifest-pattern (name package))))
|
||||||
|
|
||||||
(when (null? (manifest-entries manifest))
|
(when (null? (manifest-entries manifest))
|
||||||
(warning (G_ "no packages specified; building an empty pack~%")))
|
(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
|
(run-with-store store
|
||||||
(mlet* %store-monad ((profile (profile-derivation
|
(mlet* %store-monad ((profile (profile-derivation
|
||||||
manifest
|
manifest
|
||||||
|
|
Reference in a new issue