Skip to content

Commit

Permalink
Preserve any already existing APPTAINER_BINDPATH
Browse files Browse the repository at this point in the history
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
  • Loading branch information
afbjorklund committed Oct 23, 2022
1 parent 6700a5e commit decc8de
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/apptainer.lima
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#!/bin/sh
set -eu
: "${LIMA_INSTANCE:=apptainer}"
: "${APPTAINER_BINDPATH:=}"

if [ "$(limactl ls -q "$LIMA_INSTANCE" 2>/dev/null)" != "$LIMA_INSTANCE" ]; then
echo "instance \"$LIMA_INSTANCE\" does not exist, run \`limactl start --name=$LIMA_INSTANCE template://apptainer\` to create a new instance" >&2
exit 1
fi
export LIMA_INSTANCE
exec lima APPTAINER_BINDPATH="$HOME" apptainer "$@"
if [ "$APPTAINER_BINDPATH" != "$HOME" ]; then
if [ -n "$APPTAINER_BINDPATH" ]; then
APPTAINER_BINDPATH="$APPTAINER_BINDPATH,"
fi
APPTAINER_BINDPATH="$APPTAINER_BINDPATH$HOME"
fi
exec lima APPTAINER_BINDPATH="$APPTAINER_BINDPATH" apptainer "$@"

0 comments on commit decc8de

Please sign in to comment.