diff --git a/README.md b/README.md index 4558e5f..a474510 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ These files are used by Linuxserver build processes to handle mods in our images. Not for end-user consumption. +* **31.12.24:** - Support pulling mods using manifest hash. * **22.12.24:** - Add modcache support. * **26.06.24:** - Add RO and User handlers. * **10.06.24:** - Move lsiown to its own file. Remove support for legacy v2 and hybrid mods. diff --git a/docker-mods.v3 b/docker-mods.v3 index 721e791..8da3c1f 100755 --- a/docker-mods.v3 +++ b/docker-mods.v3 @@ -5,7 +5,7 @@ # Version 3 # 2022-09-25 - Initial Release -MOD_SCRIPT_VER="3.20241223" +MOD_SCRIPT_VER="3.20241231" # Define custom folder paths SCRIPTS_DIR="/custom-cont-init.d" @@ -298,15 +298,20 @@ run_mods() { ENDPOINT="${DOCKER_MOD%%:*}" USERNAME="${DOCKER_MOD%%/*}" REPO="${ENDPOINT#*/}" - TAG="${DOCKER_MOD#*:}" + FULLTAG="${DOCKER_MOD#*:}" + TAG="${FULLTAG%@*}" + TAGSHA="${DOCKER_MOD#*@}" + if [[ ! "${TAGSHA}" =~ sha256 ]]; then + unset TAGSHA + fi if [[ "${TAG}" == "${DOCKER_MOD}" ]]; then TAG="latest" fi - FILENAME="${USERNAME}.${REPO}.${TAG}" + FILENAME="${USERNAME}.${REPO}.${TAG}${TAGSHA:+.${TAGSHA#*:}}" MANIFEST_URL="https://${REGISTRY}/v2/${ENDPOINT}/manifests" BLOB_URL="https://${REGISTRY}/v2/${ENDPOINT}/blobs/" - MOD_UA="Mozilla/5.0 (Linux $(uname -m)) linuxserver.io ${REGISTRY}/${ENDPOINT}:${TAG}" - write_mod_debug "Registry='${REGISTRY}', Repository='${USERNAME}', Image='${ENDPOINT}', Tag='${TAG}'" + MOD_UA="Mozilla/5.0 (Linux $(uname -m)) linuxserver.io ${REGISTRY}/${ENDPOINT}:${TAG}${TAGSHA:+@$TAGSHA}" + write_mod_debug "Registry='${REGISTRY}', Repository='${USERNAME}', Image='${ENDPOINT}', Tag='${TAG}', TagSHA='${TAGSHA:-N/A}'" case "${REGISTRY}" in "lscr.io") AUTH_URL="https://ghcr.io/token?scope=repository%3A${USERNAME}%2F${REPO}%3Apull";; "ghcr.io") AUTH_URL="https://ghcr.io/token?scope=repository%3A${USERNAME}%2F${REPO}%3Apull";; @@ -360,7 +365,7 @@ run_mods() { MOD_OFFLINE="true" else # Determine first and only layer of image - SHALAYER=$(get_blob_sha "${TOKEN}" "${MANIFEST_URL}" "${TAG}" "${ARCH:--amd64}") + SHALAYER=$(get_blob_sha "${TOKEN}" "${MANIFEST_URL}" "${TAGSHA:-$TAG}" "${ARCH:--amd64}") if [[ $? -eq 1 ]]; then write_mod_error "No manifest available for arch ${ARCH:--amd64}, cannot fetch mod" continue