Files
lima/cmd/apptainer.lima
Jan Dubois 677fa1f097 Switch to RFC compliant opaque template:name URLs
The old style template://name URLs are malformed because they do not
contain a valid AUTHORITY (host name), but treat the host name as part
of the path. They are still fully supported, but will emit a warning.

Signed-off-by: Jan Dubois <jan.dubois@suse.com>
2025-09-28 23:42:07 -07:00

19 lines
762 B
Bash
Executable File

#!/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 create --name=$LIMA_INSTANCE template:apptainer\` to create a new instance" >&2
exit 1
elif [ "$(limactl ls -f '{{ .Status }}' "$LIMA_INSTANCE" 2>/dev/null)" != "Running" ]; then
echo "instance \"$LIMA_INSTANCE\" is not running, run \`limactl start $LIMA_INSTANCE\` to start the existing instance" >&2
exit 1
fi
export LIMA_INSTANCE
if [ -n "$APPTAINER_BINDPATH" ]; then
APPTAINER_BINDPATH="$APPTAINER_BINDPATH,"
fi
APPTAINER_BINDPATH="$APPTAINER_BINDPATH$HOME"
exec lima APPTAINER_BINDPATH="$APPTAINER_BINDPATH" apptainer "$@"