nixpkgs-suyu/pkgs/by-name/lu/lunar-client/update.sh
2024-01-18 11:00:23 +01:00

12 lines
432 B
Bash
Executable file

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl yq
set -eu -o pipefail
target="$(dirname "$(readlink -f "$0")")/package.nix"
host="https://launcherupdates.lunarclientcdn.com"
metadata=$(curl "$host/latest-linux.yml")
version=$(echo "$metadata" | yq .version -r)
hash=$(echo "$metadata" | yq .sha512 -r)
sed -i "s@version = .*;@version = \"$version\";@g" "$target"
sed -i "s@hash.* = .*;@hash = \"sha512-$hash\";@g" "$target"