2021-10-12 21:58:14 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -I nixpkgs=../../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github
|
|
|
|
|
|
|
|
if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then
|
|
|
|
echo "Regenerates packaging data for the element packages."
|
|
|
|
echo "Usage: $0 [git release tag]"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
version="$1"
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
if [ -z "$version" ]; then
|
2023-03-31 18:49:29 +00:00
|
|
|
version="$(wget -q -O- "https://api.github.com/repos/vector-im/element-desktop/releases?per_page=1" | jq -r '.[0].tag_name')"
|
2021-10-12 21:58:14 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# strip leading "v"
|
|
|
|
version="${version#v}"
|
|
|
|
|
2022-05-13 18:48:19 +00:00
|
|
|
# Element Web
|
|
|
|
web_src="https://raw.githubusercontent.com/vector-im/element-web/v$version"
|
2023-07-08 06:02:22 +00:00
|
|
|
web_src_hash=$(nix-prefetch-github vector-im element-web --rev v${version} | jq -r .hash)
|
2022-05-13 18:48:19 +00:00
|
|
|
|
|
|
|
web_tmpdir=$(mktemp -d)
|
|
|
|
trap 'rm -rf "$web_tmpdir"' EXIT
|
|
|
|
|
|
|
|
pushd $web_tmpdir
|
2023-03-31 18:49:29 +00:00
|
|
|
wget -q "$web_src/yarn.lock"
|
2022-05-13 18:48:19 +00:00
|
|
|
web_yarn_hash=$(prefetch-yarn-deps yarn.lock)
|
|
|
|
popd
|
2021-10-12 21:58:14 +00:00
|
|
|
|
2022-05-13 18:48:19 +00:00
|
|
|
# Element Desktop
|
|
|
|
desktop_src="https://raw.githubusercontent.com/vector-im/element-desktop/v$version"
|
2023-07-08 06:02:22 +00:00
|
|
|
desktop_src_hash=$(nix-prefetch-github vector-im element-desktop --rev v${version} | jq -r .hash)
|
2021-10-12 21:58:14 +00:00
|
|
|
|
2022-05-13 18:48:19 +00:00
|
|
|
desktop_tmpdir=$(mktemp -d)
|
|
|
|
trap 'rm -rf "$desktop_tmpdir"' EXIT
|
2021-10-12 21:58:14 +00:00
|
|
|
|
2022-05-13 18:48:19 +00:00
|
|
|
pushd $desktop_tmpdir
|
2023-03-31 18:49:29 +00:00
|
|
|
wget -q "$desktop_src/yarn.lock"
|
2021-10-12 21:58:14 +00:00
|
|
|
desktop_yarn_hash=$(prefetch-yarn-deps yarn.lock)
|
|
|
|
popd
|
|
|
|
|
2023-03-06 10:57:01 +00:00
|
|
|
cat > pin.nix << EOF
|
2021-10-12 21:58:14 +00:00
|
|
|
{
|
2023-03-06 10:57:01 +00:00
|
|
|
"version" = "$version";
|
|
|
|
"hashes" = {
|
|
|
|
"desktopSrcHash" = "$desktop_src_hash";
|
|
|
|
"desktopYarnHash" = "$desktop_yarn_hash";
|
|
|
|
"webSrcHash" = "$web_src_hash";
|
|
|
|
"webYarnHash" = "$web_yarn_hash";
|
|
|
|
};
|
2021-10-12 21:58:14 +00:00
|
|
|
}
|
|
|
|
EOF
|