Skip to content
Snippets Groups Projects
Commit ece7564d authored by Eric Nemchik's avatar Eric Nemchik Committed by Ryan Kuba
Browse files

Adjust handling of docker-mods

Use expansion instead of subshells
Use latest tag if tag is not set
parent 370cde9b
No related branches found
No related tags found
No related merge requests found
...@@ -53,21 +53,28 @@ DOCKER_MODS=(${DOCKER_MODS}) ...@@ -53,21 +53,28 @@ DOCKER_MODS=(${DOCKER_MODS})
for DOCKER_MOD in "${DOCKER_MODS[@]}"; do for DOCKER_MOD in "${DOCKER_MODS[@]}"; do
# Support alternative endpoints # Support alternative endpoints
if [[ ${DOCKER_MOD} == ghcr.io/* ]] || [[ ${DOCKER_MOD} == linuxserver/* ]]; then if [[ ${DOCKER_MOD} == ghcr.io/* ]] || [[ ${DOCKER_MOD} == linuxserver/* ]]; then
DOCKER_MOD=$(echo ${DOCKER_MOD} | sed 's/ghcr.io\///g') DOCKER_MOD="${DOCKER_MOD#ghcr.io/*}"
FILENAME=$(echo ${DOCKER_MOD} | sed 's/[:\/]/./g') ENDPOINT="${DOCKER_MOD%%:*}"
REPO=$(echo ${DOCKER_MOD} | awk -F'(/|:)' '{print $2}') USERNAME="${DOCKER_MOD%%/*}"
ENDPOINT=$(echo ${DOCKER_MOD} | awk -F: '{print $1}') REPO="${ENDPOINT#*/}"
USERNAME=$(echo ${ENDPOINT} | awk -F/ '{print $1}') TAG="${DOCKER_MOD#*:}"
TAG=$(echo ${DOCKER_MOD} | awk -F: '{print $2}') if [[ ${TAG} == "${DOCKER_MOD}" ]]; then
TAG="latest"
fi
FILENAME="${USERNAME}.${REPO}.${TAG}"
AUTH_URL="https://ghcr.io/token?scope=repository%3A${USERNAME}%2F${REPO}%3Apull" AUTH_URL="https://ghcr.io/token?scope=repository%3A${USERNAME}%2F${REPO}%3Apull"
MANIFEST_URL="https://ghcr.io/v2/${ENDPOINT}/manifests/${TAG}" MANIFEST_URL="https://ghcr.io/v2/${ENDPOINT}/manifests/${TAG}"
BLOB_URL="https://ghcr.io/v2/${ENDPOINT}/blobs/" BLOB_URL="https://ghcr.io/v2/${ENDPOINT}/blobs/"
MODE="ghcr" MODE="ghcr"
else else
FILENAME=$(echo ${DOCKER_MOD} | sed 's/[:\/]/./g') ENDPOINT="${DOCKER_MOD%%:*}"
ENDPOINT=$(echo ${DOCKER_MOD} | awk -F: '{print $1}') USERNAME="${DOCKER_MOD%%/*}"
USERNAME=$(echo ${ENDPOINT} | awk -F/ '{print $1}') REPO="${ENDPOINT#*/}"
TAG=$(echo ${DOCKER_MOD} | awk -F: '{print $2}') TAG="${DOCKER_MOD#*:}"
if [[ ${TAG} == "${DOCKER_MOD}" ]]; then
TAG="latest"
fi
FILENAME="${USERNAME}.${REPO}.${TAG}"
AUTH_URL="https://auth.docker.io/token?service=registry.docker.io&scope=repository:${ENDPOINT}:pull" AUTH_URL="https://auth.docker.io/token?service=registry.docker.io&scope=repository:${ENDPOINT}:pull"
MANIFEST_URL="https://registry-1.docker.io/v2/${ENDPOINT}/manifests/${TAG}" MANIFEST_URL="https://registry-1.docker.io/v2/${ENDPOINT}/manifests/${TAG}"
BLOB_URL="https://registry-1.docker.io/v2/${ENDPOINT}/blobs/" BLOB_URL="https://registry-1.docker.io/v2/${ENDPOINT}/blobs/"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment