diff --git a/packages/art/lotte/updater.nix b/packages/art/lotte/updater.nix index 3b3182eb..73d5c4f4 100644 --- a/packages/art/lotte/updater.nix +++ b/packages/art/lotte/updater.nix @@ -2,14 +2,18 @@ nix-prefetch-git, curl, jq, + lib, }: +let + srcInfo = lib.importJSON ./source.json; +in '' echo "lotte-art: Checking for updates" - set CURRENT_COMMIT $(${curl}/bin/curl https://git.chir.rs/api/v1/repos/darkkirb/lotte-art/commits | ${jq}/bin/jq -r '.[0].sha') - set KNOWN_COMMIT $(${jq}/bin/jq -r '.rev' packages/art/lotte/source.json) - if [ $CURRENT_COMMIT != $KNOWN_COMMIT ]; + CURRENT_COMMIT=$(${curl}/bin/curl https://git.chir.rs/api/v1/repos/darkkirb/lotte-art/commits | ${jq}/bin/jq -r '.[0].sha') + KNOWN_COMMIT=${srcInfo.rev} + if [ $CURRENT_COMMIT != $KNOWN_COMMIT ]; then echo "lotte-art: Updating from $KNOWN_COMMIT to $CURRENT_COMMIT" ${nix-prefetch-git}/bin/nix-prefetch-git https://git.chir.rs/darkkirb/lotte-art --fetch-lfs | ${jq}/bin/jq > packages/art/lotte/source.json - end + fi echo "lotte-art: Done" '' diff --git a/packages/updater.nix b/packages/updater.nix index 443f2898..502e5725 100644 --- a/packages/updater.nix +++ b/packages/updater.nix @@ -2,12 +2,13 @@ lib, callPackage, writeScriptBin, - fish, + bash, }: let script = lib.concatMapStringsSep "\n" (f: callPackage "${f}/updater.nix" { }) [ ./art ]; in writeScriptBin "updater" '' - #!${fish}/bin/fish + #!${bash}/bin/bash + set -euxo pipefail ${script} ''