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

13 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"