Initial commit
This commit is contained in:
28
scripts/update-pob.sh
Executable file
28
scripts/update-pob.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eo pipefail
|
||||
# set -x
|
||||
|
||||
# TODO: Update pobfrontend as well?
|
||||
|
||||
POB_NIX_FILE="pkgs/path-of-building-beta/default.nix"
|
||||
|
||||
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
|
||||
|
||||
hash=$(jq '.args.hash' <<< "$nurl_output" | sed 's/\//\\\//g')
|
||||
echo "Updating pob to $rev"
|
||||
|
||||
# Find lines to replace
|
||||
rev_line_numbers=$(grep -Fn "rev =" $POB_NIX_FILE| cut -d":" -f1)
|
||||
rev_line_data=$(head -n1 <<< "$rev_line_numbers")
|
||||
sed -i "${rev_line_data}s/.*/ rev = $rev;/" $POB_NIX_FILE
|
||||
|
||||
hash_line_numbers=$(grep -Fn "hash =" $POB_NIX_FILE| cut -d":" -f1)
|
||||
hash_line_data=$(head -n1 <<< "$hash_line_numbers")
|
||||
sed -i "${hash_line_data}s/.*/ hash = $hash;/" $POB_NIX_FILE
|
||||
|
||||
nixfmt $POB_NIX_FILE
|
Reference in New Issue
Block a user