diff --git a/refresh-toolboxes.sh b/refresh-toolboxes.sh index 70711fd..84824f5 100755 --- a/refresh-toolboxes.sh +++ b/refresh-toolboxes.sh @@ -8,7 +8,6 @@ declare -A TOOLBOXES TOOLBOXES["llama-vulkan-amdvlk"]="docker.io/kyuz0/amd-strix-halo-toolboxes:vulkan-amdvlk --device /dev/dri --group-add video --security-opt seccomp=unconfined" TOOLBOXES["llama-vulkan-radv"]="docker.io/kyuz0/amd-strix-halo-toolboxes:vulkan-radv --device /dev/dri --group-add video --security-opt seccomp=unconfined" TOOLBOXES["llama-rocm-6.4.4"]="docker.io/kyuz0/amd-strix-halo-toolboxes:rocm-6.4.4 --device /dev/dri --device /dev/kfd --group-add video --group-add render --group-add sudo --security-opt seccomp=unconfined" - TOOLBOXES["llama-rocm-7.2"]="docker.io/kyuz0/amd-strix-halo-toolboxes:rocm-7.2 --device /dev/dri --device /dev/kfd --group-add video --group-add render --group-add sudo --security-opt seccomp=unconfined" TOOLBOXES["llama-rocm7-nightlies"]="docker.io/kyuz0/amd-strix-halo-toolboxes:rocm7-nightlies --device /dev/dri --device /dev/kfd --group-add video --group-add render --group-add sudo --security-opt seccomp=unconfined" @@ -62,22 +61,13 @@ for name in "${SELECTED_TOOLBOXES[@]}"; do echo "⬇️ Pulling latest image: $image" podman pull "$image" - # Identify current image ID/digest for this tag - new_id="$(podman image inspect --format '{{.Id}}' "$image" 2>/dev/null || true)" - new_digest="$(podman image inspect --format '{{.Digest}}' "$image" 2>/dev/null || true)" + echo "📦 Recreating toolbox: $name" toolbox create "$name" --image "$image" -- $options - # --- Cleanup: keep only the most recent image for this tag --- + # --- Cleanup: remove dangling images --- repo="${image%:*}" - tag="${image##*:}" - - # Remove any other local images still carrying this exact tag but not the newest digest - while read -r id ref dig; do - [[ "$id" != "$new_id" ]] && podman image rm -f "$id" >/dev/null 2>&1 || true - done < <(podman images --digests --format '{{.ID}} {{.Repository}}:{{.Tag}} {{.Digest}}' \ - | awk -v ref="$image" -v ndig="$new_digest" '$2==ref && $3!=ndig') # Remove dangling images from this repository (typically prior pulls of this tag) while read -r id; do