use bash for updater

This commit is contained in:
Charlotte 🦝 Delenk 2024-11-11 10:26:19 +01:00
parent 2ed51d604a
commit 0238865a16
2 changed files with 11 additions and 6 deletions

View file

@ -2,14 +2,18 @@
nix-prefetch-git, nix-prefetch-git,
curl, curl,
jq, jq,
lib,
}: }:
let
srcInfo = lib.importJSON ./source.json;
in
'' ''
echo "lotte-art: Checking for updates" 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') 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) KNOWN_COMMIT=${srcInfo.rev}
if [ $CURRENT_COMMIT != $KNOWN_COMMIT ]; if [ $CURRENT_COMMIT != $KNOWN_COMMIT ]; then
echo "lotte-art: Updating from $KNOWN_COMMIT to $CURRENT_COMMIT" 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 ${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" echo "lotte-art: Done"
'' ''

View file

@ -2,12 +2,13 @@
lib, lib,
callPackage, callPackage,
writeScriptBin, writeScriptBin,
fish, bash,
}: }:
let let
script = lib.concatMapStringsSep "\n" (f: callPackage "${f}/updater.nix" { }) [ ./art ]; script = lib.concatMapStringsSep "\n" (f: callPackage "${f}/updater.nix" { }) [ ./art ];
in in
writeScriptBin "updater" '' writeScriptBin "updater" ''
#!${fish}/bin/fish #!${bash}/bin/bash
set -euxo pipefail
${script} ${script}
'' ''