pkgs/den-http-get-updater: try evaluate urlLocation multiple times
This commit is contained in:
parent
1cda1638c4
commit
80cb27a618
1 changed files with 15 additions and 4 deletions
|
@ -113,10 +113,21 @@ writeScript "den-http-get-updater" (''
|
|||
nixUnpack = lib.optionalString unpack "--unpack";
|
||||
nixName = lib.optionalString (!builtins.isNull name) "--name \"${lib.escapeShellArg name}\"";
|
||||
in ''
|
||||
nixUrlsResult=$(nix-instantiate --eval --json --strict \
|
||||
"${prefetchUrlLocationShellEscape.file}" \
|
||||
-A "${prefetchUrlLocationShellEscape.attrpath}"
|
||||
)
|
||||
for i in {{ 1..30 }}; do
|
||||
nixUrlsResult=$(nix-instantiate --eval --json --strict \
|
||||
"${prefetchUrlLocationShellEscape.file}" \
|
||||
-A "${prefetchUrlLocationShellEscape.attrpath}"
|
||||
)
|
||||
if [[ "$?" == "0" ]]; then
|
||||
break
|
||||
elif [[ "$i" == 30 ]]; then
|
||||
echo "error: prefetchUrlLocation failed - attempts exhausted" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
echo "prefetchUrlLocation failed (attempt $i)" 1>&2
|
||||
sleep 2
|
||||
done
|
||||
|
||||
|
||||
urlsType=$(jq -rc 'type' <<< "$nixUrlsResult")
|
||||
if [ "$urlsType" = "array" ]; then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue