lol

Merge pull request #176487 from SuperSandro2000/asf-update

authored by

Sandro and committed by
GitHub
81fa7091 6934c043

+63 -58
+1 -1
pkgs/applications/misc/ArchiSteamFarm/default.nix
··· 41 41 ''; 42 42 43 43 passthru = { 44 - updateScript = ./updater.sh; 44 + updateScript = ./update.sh; 45 45 ui = callPackage ./web-ui { }; 46 46 }; 47 47
+53
pkgs/applications/misc/ArchiSteamFarm/update.sh
··· 1 + #!/usr/bin/env nix-shell 2 + #!nix-shell -I nixpkgs=../../../.. -i bash -p curl gnused jq common-updater-scripts nuget-to-nix 3 + set -euox pipefail 4 + cd "$(dirname "${BASH_SOURCE[0]}")" 5 + 6 + deps_file="$(realpath ./deps)" 7 + 8 + new_version="$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https://api.github.com/repos/JustArchiNET/ArchiSteamFarm/releases" | jq -r 'map(select(.prerelease == false)) | .[0].tag_name')" 9 + old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)" 10 + 11 + if [[ "$new_version" == "$old_version" ]]; then 12 + echo "Already up to date!" 13 + if [[ "$1" != "--deps-only" ]]; then 14 + exit 0 15 + fi 16 + fi 17 + 18 + asf_path=$(pwd) 19 + cd ../../../.. 20 + 21 + nixpkgs_path=$(pwd) 22 + if [[ "${1:-}" != "--deps-only" ]]; then 23 + update-source-version ArchiSteamFarm "$new_version" 24 + fi 25 + store_src="$(nix-build -A ArchiSteamFarm.src --no-out-link)" 26 + platforms="$(nix-instantiate --strict --eval --json -A ArchiSteamFarm.meta.platforms | jq -r .[])" 27 + src="$(mktemp -d /tmp/ArchiSteamFarm-src.XXX)" 28 + 29 + trap ' 30 + rm -r "$src" 31 + ' EXIT 32 + 33 + cp -rT "$store_src" "$src" 34 + chmod -R +w "$src" 35 + 36 + pushd "$src" 37 + 38 + export DOTNET_NOLOGO=1 39 + export DOTNET_CLI_TELEMETRY_OPTOUT=1 40 + 41 + for i in $platforms; do 42 + nix-shell -I nixpkgs="$nixpkgs_path" -p dotnet-sdk_6 --argstr system $i --run " 43 + mkdir ./nuget_pkgs-$i 44 + for project in ArchiSteamFarm/ArchiSteamFarm.csproj ArchiSteamFarm.Tests/ArchiSteamFarm.Tests.csproj; do 45 + dotnet restore \$project --packages ./nuget_pkgs-$i 46 + done; 47 + 48 + nuget-to-nix ./nuget_pkgs-$i > $deps_file-$i.nix" \ 49 + || echo "Did you set up binformat for $i?"; 50 + done; 51 + 52 + cd "$asf_path" 53 + ./web-ui/update.sh
-50
pkgs/applications/misc/ArchiSteamFarm/updater.sh
··· 1 - #!/usr/bin/env nix-shell 2 - #!nix-shell -I nixpkgs=../../../.. -i bash -p curl gnused jq common-updater-scripts nuget-to-nix 3 - set -exo pipefail 4 - cd "$(dirname "${BASH_SOURCE[0]}")" 5 - 6 - deps_file="$(realpath ./deps)" 7 - 8 - new_version="$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} -s "https://api.github.com/repos/JustArchiNET/ArchiSteamFarm/releases" | jq -r 'map(select(.prerelease == false)) | .[0].tag_name')" 9 - old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)" 10 - 11 - if [[ "$new_version" == "$old_version" ]]; then 12 - echo "Already up to date!" 13 - if [[ "$1" != "--deps-only" ]]; then 14 - exit 0 15 - fi 16 - fi 17 - 18 - cd ../../../.. 19 - 20 - nixpkgs_path=$(pwd) 21 - if [[ "$1" != "--deps-only" ]]; then 22 - update-source-version ArchiSteamFarm "$new_version" 23 - fi 24 - store_src="$(nix-build -A ArchiSteamFarm.src --no-out-link)" 25 - platforms="$(nix-instantiate --strict --eval --json -A ArchiSteamFarm.meta.platforms | jq -r .[])" 26 - src="$(mktemp -d /tmp/ArchiSteamFarm-src.XXX)" 27 - cp -rT "$store_src" "$src" 28 - chmod -R +w "$src" 29 - 30 - pushd "$src" 31 - 32 - export DOTNET_NOLOGO=1 33 - export DOTNET_CLI_TELEMETRY_OPTOUT=1 34 - 35 - for i in $platforms; do 36 - nix-shell -I nixpkgs="$nixpkgs_path" -p dotnet-sdk_6 --argstr system $i --run " 37 - mkdir ./nuget_pkgs-$i 38 - for project in ArchiSteamFarm/ArchiSteamFarm.csproj ArchiSteamFarm.Tests/ArchiSteamFarm.Tests.csproj; do 39 - dotnet restore $project --packages ./nuget_pkgs-$i 40 - done; 41 - 42 - nuget-to-nix ./nuget_pkgs-$i > $deps_file-$i.nix" \ 43 - || echo "Did you set up binformat for $i?"; 44 - 45 - done; 46 - 47 - trap ' 48 - popd 49 - rm -r "$src" 50 - ' EXIT
+9 -7
pkgs/applications/misc/ArchiSteamFarm/web-ui/update.sh
··· 1 1 #!/usr/bin/env nix-shell 2 - #! nix-shell -i bash -p nodePackages.node2nix gnused jq curl 2 + #! nix-shell -I nixpkgs=../../../.. -i bash -p nodePackages.node2nix gnused jq curl 3 + set -eoux pipefail 3 4 5 + pushd ../../../.. 4 6 version=$(nix-instantiate --strict --eval -A ArchiSteamFarm.version | jq -r) 5 - ui=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} https://api.github.com/repos/JustArchiNET/ArchiSteamFarm/contents/ASF-ui?ref=${version} | jq -r .sha) 6 - 7 - pushd $(dirname "$0") 7 + popd 8 + pushd "$(dirname "$0")" 9 + ui=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/JustArchiNET/ArchiSteamFarm/contents/ASF-ui?ref=$version" | jq -r .sha) 8 10 9 - curl https://raw.githubusercontent.com/JustArchiNET/ASF-ui/${ui}/package-lock.json -o package-lock.json 10 - curl https://raw.githubusercontent.com/JustArchiNET/ASF-ui/${ui}/package.json -o package.json 11 + curl "https://raw.githubusercontent.com/JustArchiNET/ASF-ui/$ui/package-lock.json" -o package-lock.json 12 + curl "https://raw.githubusercontent.com/JustArchiNET/ASF-ui/$ui/package.json" -o package.json 11 13 12 14 # update-source-version doesn't work for some reason 13 15 sed -i "s/rev\\s*=\\s*.*/rev = \"$ui\";/" default.nix 14 - sed -i "s/sha256\\s*=\\s*.*/sha256 = \"$(nix-prefetch-url --unpack https://github.com/JustArchiNET/ASF-ui/archive/$ui.tar.gz)\";/" default.nix 16 + sed -i "s/sha256\\s*=\\s*.*/sha256 = \"$(nix-prefetch-url --unpack "https://github.com/JustArchiNET/ASF-ui/archive/$ui.tar.gz")\";/" default.nix 15 17 16 18 node2nix \ 17 19 --nodejs-14 \