d-utils

simple utils to use docker images without docker
git clone https://git.ce9e.org/d-utils.git

commit
8535398ca0d22cbd24981039c6b3ff09c2e30a80
parent
79c0d0dbf4ba4999ee5f8049189d41c4a98dd479
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-10-19 08:00
try to get auth_url from manifest endpoint

required for ghcr.io

Diffstat

M d-pull 3 +++

1 files changed, 3 insertions, 0 deletions


diff --git a/d-pull b/d-pull

@@ -44,6 +44,9 @@ url="https://$reg/v2/$lib/$img"
   44    44 
   45    45 echo "  fetching token"
   46    46 auth_url=$(curl -s --head "https://$reg/v2/" | grep -i www-authenticate | sed 's/.*realm="\(.*\)",service="\(.*\)".*/\1?service=\2/')
   -1    47 if [ -z "$auth_url" ]; then
   -1    48 	auth_url=$(curl -s --head "$url/manifests/$tag" | grep -i www-authenticate | sed 's/.*realm="\(.*\)",service="\(.*\)".*/\1?service=\2/')
   -1    49 fi
   47    50 auth_token=$(curl -s "$auth_url&scope=repository:$lib/$img:pull" | jq -r '.token')
   48    51 auth="Authorization: Bearer $auth_token"
   49    52