fork
Configure Feed
Select the types of activity you want to include in your feed.
nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
fork
Configure Feed
Select the types of activity you want to include in your feed.
1#!/usr/bin/env nix-shell
2#!nix-shell -I ./. -i bash -p common-updater-scripts jq
3
4set -eEuo pipefail
5test ${DEBUG:-0} -eq 1 && set -x
6
7# Current version.
8LATEST_NIXPKGS_VERSION=$(nix eval --raw .#geoserver.version 2>/dev/null)
9UPDATE_NIX_OLD_VERSION=${UPDATE_NIX_OLD_VERSION:-$LATEST_NIXPKGS_VERSION}
10
11# Maybe future version.
12LATEST_GITHUB_VERSION=$(curl -s "https://api.github.com/repos/geoserver/geoserver/releases/latest" | jq -r '.tag_name')
13UPDATE_NIX_NEW_VERSION=${UPDATE_NIX_NEW_VERSION:-$LATEST_GITHUB_VERSION}
14
15SMALLEST_VERSION=$(printf "$UPDATE_NIX_OLD_VERSION\n$UPDATE_NIX_NEW_VERSION" | sort --version-sort | head -n 1)
16
17if [[ "$SMALLEST_VERSION" == "$UPDATE_NIX_NEW_VERSION" ]]; then
18 echo "geoserver is up-to-date: $SMALLEST_VERSION"
19 exit 0
20fi
21
22echo "Updating geoserver..."
23update-source-version geoserver "$UPDATE_NIX_NEW_VERSION"
24
25cd "$(dirname "$(readlink -f "$0")")"
26
27EXT_NAMES=($(grep -o -E "hash = .*?; # .*$" ./extensions.nix | sed 's/.* # //' | sort))
28
29if [[ $# -gt 0 ]] ; then
30 EXT_NAMES=(${@:1})
31fi
32
33for EXT_NAME in "${EXT_NAMES[@]}" ; do
34 echo "Updating extension $EXT_NAME..."
35 URL="mirror://sourceforge/geoserver/GeoServer/${UPDATE_NIX_NEW_VERSION}/extensions/geoserver-${UPDATE_NIX_NEW_VERSION}-${EXT_NAME}-plugin.zip"
36 HASH=$(nix-hash --to-sri --type sha256 $(nix-prefetch-url --unpack "$URL"))
37 sed -i "s@version = \".*\"; # $EXT_NAME@version = \"$UPDATE_NIX_NEW_VERSION\"; # $EXT_NAME@" ./extensions.nix
38 sed -i "s@hash = \".*\"; # $EXT_NAME@hash = \"$HASH\"; # $EXT_NAME@" ./extensions.nix
39done
40
41cd -