singularity-tools: string-interpolate and and quote members in contents

String-interpolation converts path objects inside `contents` into store
paths to ensure they are properly included in the result image.

See tests.trivial-builders.references for the necessity of
string-interpolation.

Quote each string-interpolated content member to accomodates spaces
inside.
This commit is contained in:
Yueh-Shun Li 2024-08-11 10:58:06 +08:00
parent 7487a6207d
commit 5396a84b1d

View File

@ -120,7 +120,12 @@ lib.makeExtensible (final: {
cp -ar "$f" "./$f"
done
for c in ${toString contents} ; do
# TODO(@ShamrockLee):
# Once vmTools.runInLinuxVMm works with `__structuredAttrs = true` (#334705),
# set __structuredAttrs = true and pass contents as an attribute
# so that we could loop with `for c in ''${contents[@]}`
# instead of expanding all the paths in contents into the Bash string.
for c in ${lib.escapeShellArgs contents} ; do
for f in "$c"/bin/* ; do
if [ ! -e "bin/$(basename "$f")" ] ; then
ln -s "$f" bin/