mirror of
https://github.com/gufo-org/toolboxes.git
synced 2026-11-07 10:46:07 -10:00
67 lines
1.5 KiB
Bash
Executable File
67 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Pull the published Gufo OCI images with Podman (preferred) or Docker.
|
|
|
|
declare -A IMAGES
|
|
IMAGES["gufo-runtime"]="ghcr.io/gufo-org/toolboxes/gufo-runtime"
|
|
IMAGES["gufo-dev"]="ghcr.io/gufo-org/toolboxes/gufo-dev"
|
|
|
|
usage() {
|
|
cat <<EOF
|
|
Usage: $0 [all|gufo-runtime|gufo-dev] [latest|edge]
|
|
|
|
Pull rolling Gufo edge images by default or select the stable latest channel.
|
|
This repository does not support Toolbx or Distrobox; run images directly with
|
|
your container engine.
|
|
EOF
|
|
}
|
|
|
|
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
|
usage >&2
|
|
exit 2
|
|
fi
|
|
|
|
case "$1" in
|
|
-h|--help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
target="$1"
|
|
channel="${2:-edge}"
|
|
if [[ "$channel" != "latest" && "$channel" != "edge" ]]; then
|
|
echo "Unknown channel: $channel" >&2
|
|
usage >&2
|
|
exit 2
|
|
fi
|
|
|
|
selected_images=()
|
|
if [[ "$target" == "all" ]]; then
|
|
selected_images=("gufo-runtime" "gufo-dev")
|
|
elif [[ -v IMAGES["$target"] ]]; then
|
|
selected_images=("$target")
|
|
else
|
|
echo "Unknown image: $target" >&2
|
|
usage >&2
|
|
exit 2
|
|
fi
|
|
|
|
if command -v podman >/dev/null 2>&1; then
|
|
container_engine="podman"
|
|
elif command -v docker >/dev/null 2>&1; then
|
|
container_engine="docker"
|
|
else
|
|
echo "Neither Podman nor Docker is installed." >&2
|
|
exit 1
|
|
fi
|
|
|
|
for image_name in "${selected_images[@]}"; do
|
|
image_ref="${IMAGES[$image_name]}:${channel}"
|
|
echo "Pulling $image_ref with $container_engine..."
|
|
"$container_engine" pull "$image_ref"
|
|
done
|
|
|
|
echo "Pulled ${#selected_images[@]} image(s). See README.md for run commands."
|