mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-19 09:53:02 -04:00
If lockfile found, use cached download
This commit is contained in:
+18
-14
@@ -381,30 +381,34 @@ run_mods() {
|
|||||||
for ((i = 5 ; i < 21 ; i=i*2 )); do
|
for ((i = 5 ; i < 21 ; i=i*2 )); do
|
||||||
sleep $i
|
sleep $i
|
||||||
if [[ ! -f "/modcache/${FILENAME}.lock" ]]; then
|
if [[ ! -f "/modcache/${FILENAME}.lock" ]]; then
|
||||||
|
SKIP_MOD_DOWNLOAD=true
|
||||||
break
|
break
|
||||||
elif [[ $i == 20 ]]; then
|
elif [[ $i == 20 ]]; then
|
||||||
write_mod_error "${DOCKER_MOD} timed out waiting for lock, skipping\n\tIf no other containers are using this mod you may need to delete /modcache/${FILENAME}.lock"
|
write_mod_error "${DOCKER_MOD} timed out waiting for lock, skipping\n\tIf no other containers are using this mod you may need to delete /modcache/${FILENAME}.lock"
|
||||||
SKIP_MOD_DOWNLOAD=true
|
SKIP_MOD=true
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [[ "${SKIP_MOD_DOWNLOAD}" == "true" ]]; then
|
if [[ "${SKIP_MOD}" == "true" ]]; then
|
||||||
continue
|
continue
|
||||||
|
elif [[ "${SKIP_MOD_DOWNLOAD}" != "true" ]]; then
|
||||||
|
# Download and extract layer to /
|
||||||
|
touch "/modcache/${FILENAME}.lock"
|
||||||
|
curl -f --retry 5 --retry-max-time 30 --retry-all-errors \
|
||||||
|
${CURL_NOISE_LEVEL} \
|
||||||
|
--location \
|
||||||
|
--header "Authorization: Bearer ${TOKEN}" \
|
||||||
|
--user-agent "${MOD_UA}" \
|
||||||
|
"${BLOB_URL}${SHALAYER}" -o \
|
||||||
|
"/modcache/${FILENAME}.tar.xz"
|
||||||
fi
|
fi
|
||||||
# Download and extract layer to /
|
fi
|
||||||
touch "/modcache/${FILENAME}.lock"
|
if ! tar -tzf "/modcache/${FILENAME}.tar.xz" >/dev/null 2>&1; then
|
||||||
curl -f --retry 5 --retry-max-time 30 --retry-all-errors \
|
write_mod_error "Invalid tarball for ${DOCKER_MOD}, skipping"
|
||||||
${CURL_NOISE_LEVEL} \
|
if [[ -f "/modcache/${FILENAME}.lock" ]]; then
|
||||||
--location \
|
|
||||||
--header "Authorization: Bearer ${TOKEN}" \
|
|
||||||
--user-agent "${MOD_UA}" \
|
|
||||||
"${BLOB_URL}${SHALAYER}" -o \
|
|
||||||
"/modcache/${FILENAME}.tar.xz"
|
|
||||||
if ! tar -tzf "/modcache/${FILENAME}.tar.xz" >/dev/null 2>&1; then
|
|
||||||
write_mod_error "Invalid tarball, could not download ${DOCKER_MOD} from ${REGISTRY}"
|
|
||||||
rm "/modcache/${FILENAME}.lock" || write_mod_error "Failed to delete lock file /modcache/${FILENAME}.lock"
|
rm "/modcache/${FILENAME}.lock" || write_mod_error "Failed to delete lock file /modcache/${FILENAME}.lock"
|
||||||
continue
|
|
||||||
fi
|
fi
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
write_mod_info "Installing ${DOCKER_MOD}"
|
write_mod_info "Installing ${DOCKER_MOD}"
|
||||||
mkdir -p /tmp/mod
|
mkdir -p /tmp/mod
|
||||||
|
|||||||
Reference in New Issue
Block a user