2024-07-19 16:38:31 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -eo pipefail
|
2024-07-20 05:24:44 +00:00
|
|
|
# set -x
|
2024-07-19 16:38:31 +00:00
|
|
|
|
|
|
|
# TODO: Update pobfrontend as well?
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
nurl_output=$(nurl -j https://github.com/PathOfBuildingCommunity/PathOfBuilding 2>/dev/null)
|
|
|
|
rev=$(jq '.args.rev' <<< "$nurl_output")
|
|
|
|
else
|
|
|
|
nurl_output=$(nurl -j https://github.com/PathOfBuildingCommunity/PathOfBuilding "$1" 2>/dev/null)
|
|
|
|
fi
|
|
|
|
|
2024-07-20 05:24:44 +00:00
|
|
|
hash=$(jq '.args.hash' <<< "$nurl_output" | sed 's/\//\\\//g')
|
2024-07-19 16:38:31 +00:00
|
|
|
echo "Updating pob to $rev"
|
|
|
|
|
|
|
|
# Find lines to replace
|
2024-07-19 18:44:07 +00:00
|
|
|
rev_line_numbers=$(grep -Fn "rev =" packages/pob.nix| cut -d":" -f1)
|
|
|
|
rev_line_data=$(head -n1 <<< "$rev_line_numbers")
|
|
|
|
sed -i "${rev_line_data}s/.*/ rev = $rev;/" packages/pob.nix
|
|
|
|
|
|
|
|
hash_line_numbers=$(grep -Fn "hash =" packages/pob.nix| cut -d":" -f1)
|
|
|
|
hash_line_data=$(head -n1 <<< "$hash_line_numbers")
|
|
|
|
sed -i "${hash_line_data}s/.*/ hash = $hash;/" packages/pob.nix
|
2024-07-19 16:38:31 +00:00
|
|
|
|
|
|
|
nixfmt packages/pob.nix
|