1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-28 00:22:13 +00:00
nixpkgs/pkgs/servers/gotify/update.sh
Doron Behar fbb9bcaef4 gotify-server: 2.0.4 -> 2.0.5
Improved update script / procedure by getting all versions and shas
needed to build it.
2020-04-27 16:56:50 +03:00

41 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p wget yarn2nix-moretea.yarn2nix nix-prefetch-git jq
set -euo pipefail
dirname="$(dirname "$0")"
latest_release=$(curl --silent https://api.github.com/repos/gotify/server/releases/latest)
version=$(jq -r '.tag_name' <<<"$latest_release")
echo got version $version
echo \""${version#v}"\" > "$dirname/version.nix"
printf '%s' $(nix-prefetch-git --quiet --rev ${version} https://github.com/gotify/server | jq .sha256) > $dirname/source-sha.nix
tput setaf 1
echo zeroing modSha256 in $dirname/mod-sha.nix
tput sgr0
printf '"%s"' "0000000000000000000000000000000000000000000000000000" > $dirname/mod-sha.nix
GOTIFY_WEB_SRC="https://raw.githubusercontent.com/gotify/server/$version"
curl --silent "$GOTIFY_WEB_SRC/ui/package.json" -o $dirname/package.json
echo downloaded package.json
curl --silent "$GOTIFY_WEB_SRC/ui/yarn.lock" -o $dirname/yarn.lock
echo downloaded yarndeps.nix
echo running yarn2nix
yarn2nix --lockfile=$dirname/yarn.lock > $dirname/yarndeps.nix
rm $dirname/yarn.lock
echo removed yarn.lock
echo running nix-build for ui
nix-build -A gotify-server.ui
echo running nix-build for gotify itself in order to get modSha256
set +e
modSha256="$(nix-build -A gotify-server 2>&1 | grep "got:" | cut -d':' -f3)"
set -e
printf '"%s"' "$modSha256" > $dirname/mod-sha.nix
tput setaf 2
echo got modSha256 of: $modSha256
tput sgr0
echo running nix-build -A gotify-server which should build gotify-server normally
nix-build -A gotify-server