tradingview: fix updateScript
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p curl jq git gnused gnugrep
|
||||
#! nix-shell -i bash -p curl jq gitMinimal gnused gnugrep
|
||||
|
||||
#
|
||||
# Get latest version of TradingView from Snapcraft.
|
||||
#
|
||||
|
||||
snap_info=($(
|
||||
curl -s -H 'X-Ubuntu-Series: 16' \
|
||||
'https://api.snapcraft.io/api/v1/snaps/details/tradingview' \
|
||||
| jq --raw-output \
|
||||
'.revision,.download_sha512,.version,.last_updated'
|
||||
curl --silent --header 'X-Ubuntu-Series: 16' \
|
||||
'https://api.snapcraft.io/api/v1/snaps/details/tradingview' |
|
||||
jq --raw-output \
|
||||
'.revision,.download_sha512,.version,.last_updated'
|
||||
))
|
||||
|
||||
# "revision" is the actual version identifier; "version" is for human consumption.
|
||||
@@ -27,10 +27,7 @@ echo "Latest release is $upstream_version from $last_updated."
|
||||
|
||||
nixpkgs="$(git rev-parse --show-toplevel)"
|
||||
tradingview_nix="$nixpkgs/pkgs/by-name/tr/tradingview/package.nix"
|
||||
current_nix_version=$(
|
||||
grep 'version\s*=' "$tradingview_nix" \
|
||||
| sed -Ene 's/.*"(.*)".*/\1/p'
|
||||
)
|
||||
current_nix_version=$(nix eval --raw --file . tradingview.version)
|
||||
|
||||
echo "Current nix version: $current_nix_version"
|
||||
|
||||
@@ -50,21 +47,3 @@ sed --regexp-extended \
|
||||
-e 's#hash\s*=\s*"[^"]*"\s*;#hash = "'"${sri}"'";#' \
|
||||
-e 's/version\s*=\s*".*"\s*;/version = "'"${upstream_version}"'";/' \
|
||||
-i "$tradingview_nix"
|
||||
|
||||
#
|
||||
# Attempt a build.
|
||||
#
|
||||
|
||||
export NIXPKGS_ALLOW_UNFREE=1
|
||||
|
||||
if ! nix-build -A tradingview "$nixpkgs"; then
|
||||
echo "The updated TradingView failed to build."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Commit changes.
|
||||
#
|
||||
git add "$tradingview_nix"
|
||||
git commit -m "tradingview: ${current_nix_version} -> ${upstream_version}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user