Shellcheck

This commit is contained in:
TheSpad
2024-01-03 17:54:55 +00:00
parent c2e6856ec2
commit b6cf5a3569
+9 -5
View File
@@ -190,7 +190,7 @@ curl_check() {
} }
write_debug() { write_debug() {
local MSG=$@ local MSG=$*
if [[ ${DOCKER_MODS_DEBUG,,} = "true" ]]; then echo "[mod-init] (DEBUG) $MSG"; fi if [[ ${DOCKER_MODS_DEBUG,,} = "true" ]]; then echo "[mod-init] (DEBUG) $MSG"; fi
} }
@@ -233,13 +233,17 @@ get_blob_sha() {
} }
get_auth_url() { get_auth_url() {
local auth_header
local realm_url
local service
local scope
# Call to get manifests and extract www-authenticate header # Call to get manifests and extract www-authenticate header
local auth_header=$(curl -sLI ${CURL_NOISE_LEVEL} "${1}/${2}" | grep -i www-authenticate | tr -d '\r') auth_header=$(curl -sLI ${CURL_NOISE_LEVEL} "${1}/${2}" | grep -i www-authenticate | tr -d '\r')
if [[ -n "${auth_header}" ]]; then if [[ -n "${auth_header}" ]]; then
# Extract realm URL from www-authenticate header # Extract realm URL from www-authenticate header
local realm_url=$(echo "$auth_header" | grep -oP 'realm="\K[^"]+') realm_url=$(echo "$auth_header" | grep -oP 'realm="\K[^"]+')
local service=$(echo "$auth_header" | grep -oP 'service="\K[^"]+') service=$(echo "$auth_header" | grep -oP 'service="\K[^"]+')
local scope=$(echo "$auth_header" | grep -oP 'scope="\K[^"]+') scope=$(echo "$auth_header" | grep -oP 'scope="\K[^"]+')
echo "$realm_url?service=$service&scope=$scope" echo "$realm_url?service=$service&scope=$scope"
else else
exit 1 exit 1