mirror of
https://codefloe.com/Jonas8272/scoop-bucket.git
synced 2026-12-01 00:19:36 +00:00
added arm
This commit is contained in:
1 parent
b2d18e04ae
commit
efc5d988a9
1 file changed
+29
-11
+29
-11
@@ -12,17 +12,17 @@ fi
|
|||||||
rels=$(curl -fsSL ${auth[@]+"${auth[@]}"} "https://api.github.com/repos/$REPO/releases?per_page=50")
|
rels=$(curl -fsSL ${auth[@]+"${auth[@]}"} "https://api.github.com/repos/$REPO/releases?per_page=50")
|
||||||
|
|
||||||
# Highest versioned tag (vA.B.C.D) that is not a draft, pre-release or "Beta" title.
|
# Highest versioned tag (vA.B.C.D) that is not a draft, pre-release or "Beta" title.
|
||||||
tag=$(jq -r '
|
rel=$(jq -c '
|
||||||
[ .[]
|
[ .[]
|
||||||
| select(.draft == false and .prerelease == false)
|
| select(.draft == false and .prerelease == false)
|
||||||
| select(.tag_name | test("^v[0-9]+(\\.[0-9]+){3}$"))
|
| select(.tag_name | test("^v[0-9]+(\\.[0-9]+){3}$"))
|
||||||
| select((.name // "") | test("beta"; "i") | not)
|
| select((.name // "") | test("beta"; "i") | not) ]
|
||||||
| .tag_name ]
|
| sort_by(.tag_name | ltrimstr("v") | split(".") | map(tonumber))
|
||||||
| sort_by(ltrimstr("v") | split(".") | map(tonumber))
|
|
||||||
| last // empty' <<<"$rels")
|
| last // empty' <<<"$rels")
|
||||||
|
|
||||||
[ -n "$tag" ] || { echo "no stable versioned release found" >&2; exit 1; }
|
[ -n "$rel" ] || { echo "no stable versioned release found" >&2; exit 1; }
|
||||||
|
|
||||||
|
tag=$(jq -r .tag_name <<<"$rel")
|
||||||
ver=${tag#v}
|
ver=${tag#v}
|
||||||
cur=$(jq -r .version "$M")
|
cur=$(jq -r .version "$M")
|
||||||
|
|
||||||
@@ -31,13 +31,31 @@ if [ "$ver" = "$cur" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
url="https://raw.githubusercontent.com/$REPO/$tag/release/fxsound_setup.exe"
|
# Print "<url> <sha256>" for an exact asset name; use GitHub's digest if present,
|
||||||
curl -fsSL -o /tmp/fxsound_setup.exe "$url"
|
# otherwise download the file and hash it.
|
||||||
[ "$(head -c2 /tmp/fxsound_setup.exe)" = "MZ" ] || { echo "download is not an exe" >&2; exit 1; }
|
asset_info() {
|
||||||
hash=$(sha256sum /tmp/fxsound_setup.exe | cut -d' ' -f1)
|
local name=$1 url hash
|
||||||
|
url=$(jq -r --arg n "$name" '.assets[] | select(.name==$n) | .browser_download_url' <<<"$rel")
|
||||||
|
[ -n "$url" ] || { echo "asset $name not found in $tag" >&2; exit 1; }
|
||||||
|
hash=$(jq -r --arg n "$name" '.assets[] | select(.name==$n) | .digest // empty' <<<"$rel" | sed 's/^sha256://')
|
||||||
|
if ! [[ $hash =~ ^[0-9a-f]{64}$ ]]; then
|
||||||
|
echo "no API digest for $name, downloading to hash it" >&2
|
||||||
|
curl -fsSL -o "/tmp/$name" "$url"
|
||||||
|
[ "$(head -c2 "/tmp/$name")" = "MZ" ] || { echo "$name is not an exe" >&2; exit 1; }
|
||||||
|
hash=$(sha256sum "/tmp/$name" | cut -d' ' -f1)
|
||||||
|
fi
|
||||||
|
echo "$url $hash"
|
||||||
|
}
|
||||||
|
|
||||||
jq --indent 4 --arg v "$ver" --arg u "$url" --arg h "$hash" \
|
x64=$(asset_info fxsound_setup.exe)
|
||||||
'.version=$v | .architecture["64bit"].url=$u | .architecture["64bit"].hash=$h' \
|
arm=$(asset_info fxsound_setup.arm64.exe)
|
||||||
|
|
||||||
|
jq --indent 4 --arg v "$ver" \
|
||||||
|
--arg xu "${x64%% *}" --arg xh "${x64##* }" \
|
||||||
|
--arg au "${arm%% *}" --arg ah "${arm##* }" \
|
||||||
|
'.version=$v
|
||||||
|
| .architecture["64bit"].url=$xu | .architecture["64bit"].hash=$xh
|
||||||
|
| .architecture.arm64.url=$au | .architecture.arm64.hash=$ah' \
|
||||||
"$M" > "$M.tmp" && mv "$M.tmp" "$M"
|
"$M" > "$M.tmp" && mv "$M.tmp" "$M"
|
||||||
|
|
||||||
echo "updated $cur -> $ver"
|
echo "updated $cur -> $ver"
|
||||||
Reference in new issue
Block a user