Files
zen-browser-flake/.github/update-zen-browser.bash
Felix Salcher bcac2202c9 remove specific/generic
specific and generic builds are no longer provided by zen, they rather
provide just one build for linux
2024-12-24 12:11:09 +01:00

44 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
script_dir="$(dirname -- "$0")"
upstream="null"
max_attempts=10
attempts=1
while [ "$upstream" == "null" ]; do
upstream=$("$script_dir/new-version.sh")
if [ "$upstream" != "null" ]; then
break
elif [ $attempts -ge $max_attempts ]; then
echo "Unable to determine new upstream version"
exit 1
fi
echo "[attempt #${attempts}] Unable to determine new upstream version, retrying in 5 seconds..."
attempts=$((attempts + 1))
sleep 5
done
upstream=$("$script_dir/new-version.sh" | cat -)
if [ "$upstream" == "null" ]; then
echo "Unable to determine new upstream version"
return 1
fi
echo "Updating to $upstream"
base_url="https://github.com/zen-browser/desktop/releases/download/$upstream"
# Modify with sed the nix file
sed -i "s/version = \".*\"/version = \"$upstream\"/" ./flake.nix
# Update the hash sha256
hash=$(nix-prefetch-url --type sha256 --unpack "$base_url/zen.linux-x86_64.tar.bz2")
sed -i "s/downloadUrl.sha256 = \".*\"/downloadUrl.sha256 = \"$hash\"/" ./flake.nix
nix flake update
nix build