legends-of-equestria: 2025.02.001 -> 2025.04.001

This commit is contained in:
Ulysses Zhan
2025-09-13 16:26:22 -07:00
parent 6d7ec06d68
commit 5864b5683a
2 changed files with 23 additions and 14 deletions
@@ -33,21 +33,21 @@
let
pname = "legends-of-equestria";
version = "2025.02.001";
version = "2025.04.001";
description = "Free-to-play MMORPG";
srcOptions = {
x86_64-linux = {
url = "https://mega.nz/file/w6pxUQJS#5r_oxsCqLyIUya8fbIATPtKAbsacXkD-bVArjjOBu3w";
outputHash = "k5kASgZwCoKVtHDEFjegAl31KZlrkNse4Baph1l/SUc=";
url = "https://mega.nz/file/w7BQTCAD#zW1atRLzSd1-V8GV7s7yj_HVZwB4v8zuX3aWIjA0ztc";
outputHash = "YYPxS/qNl/DvNmiGZorRGoONbtAI3nJslqCRzctwoz8=";
};
x86_64-darwin = {
url = "https://mega.nz/file/wyoHSZTK#ig1laiSWijTxnN_tS2m5di1Mdly8zDHP1euLVFqG_ug";
outputHash = "pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=";
url = "https://mega.nz/file/IqgBEJTD#aUd6LgigncoQ8o3owSkadYRp7GkfIOWl4B1Hwzti1qk";
outputHash = "XdcHM6zCDNFU5VJo3/QISuhtYnBKm1f6IEDfy6Fjnp8=";
};
aarch64-darwin = {
url = "https://mega.nz/file/EihRWKgb#KDtmmzLWVKW5uxkKkBEVE0yJioYPkOqutWwwMLhbedA";
outputHash = "pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=";
url = "https://mega.nz/file/QyZnkYYB#EtAZrVdHgqX10ag09M9nhJVEboG0J_5f_nVKxCHskYg";
outputHash = "GA0Zin+vlgYfBFC1ZbkkgX1eSn/NVBYuxuv8fayXMLU=";
};
};
+16 -7
View File
@@ -4,8 +4,9 @@
set -eu -o pipefail
ATTR=legends-of-equestria
DOWNLOADS_PAGE=https://www.legendsofequestria.com/downloads
OLD_VERSION=$(nix-instantiate --eval -A $ATTR.version | tr -d '"')
DOWNLOADS_PAGE="$(curl -s "$(nix-instantiate --eval -A "$ATTR.meta.downloadPage" | tr -d '"')")"
OLD_VERSION="$(nix-instantiate --eval -A "$ATTR.version" | tr -d '"')"
NIX_FILE="$(nix-instantiate --eval -A "$ATTR.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/')"
TMP=$(mktemp -d)
findHash() {
@@ -30,24 +31,32 @@ applyUpdate() {
system=$1
echo "checking for updates for $system..." >&2
systemText="$2"
regex='<a href="(https.+)">'"$systemText"'</a>.+v(([0-9]+\.)+[0-9]+)'
regex='<a href="(https[^"]+)">'"$systemText"'</a>.+v(([0-9]+\.)+[0-9]+)'
if [[ "$(curl -s $DOWNLOADS_PAGE | grep -Fi "$systemText")" =~ $regex ]]; then
mapfile -t matches < <(echo "$DOWNLOADS_PAGE" | grep -Fi "$systemText")
for ((i=${#matches[@]}-1; i>=0; i--)); do
if [[ ${matches[i]} =~ $regex ]]; then
url="${BASH_REMATCH[1]}"
version="${BASH_REMATCH[2]}"
echo "$version $url" >&2
else
break
fi
done
if [[ -z $url || -z $version ]]; then
echo "cannot find the latest version for $system" >&2
exit 1
fi
if [[ $OLD_VERSION == $version ]]; then
echo "already up-to-date at version $version" >&2
exit 1
exit 0
fi
hash="$(findHash $system "$url" | sed -E 's/sha256-(.+)/\1/')"
echo "output hash: $hash" >&2
update-source-version $ATTR $version "$hash" "$url" --system=$system --ignore-same-version --ignore-same-hash
oldUrl="$(nix-instantiate --system $system --eval -A $ATTR.src.url | tr -d '"')"
oldHash="$(nix-instantiate --system $system --eval -A $ATTR.src.outputHash | tr -d '"')"
sed -i "s|$OLD_VERSION|$version|; s|$oldUrl|$url|; s|$oldHash|$hash|" "$NIX_FILE"
}
applyUpdate x86_64-linux Linux