feature: Changes build script to only rebuild upon changes.

This commit is contained in:
greysoh 2024-07-13 18:45:54 -04:00
parent abb2f82682
commit befbab002a
Signed by: imterah
GPG key ID: 8FA7DD57BA6CEA37
3 changed files with 14 additions and 3 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
out
build.log
secrets.nix
secrets.nix
meta

View file

@ -10,6 +10,6 @@ echo "Copying file to the output directory..."
# Hack!
# TODO: Fix this mess later
mkdir -p out/$1
rm -rf out/$1
rm -rf out/$1 out/$1.vma.zst
OUT_FILE="$(sed -n '$p' build.log)"
cp -r $OUT_FILE out/$1.vma.zst

View file

@ -1,12 +1,22 @@
#!/usr/bin/env bash
mkdir meta > /dev/null 2> /dev/null
for FILE in kitteh-node-*/*; do
FILE_NO_EXTENSION="${FILE/".nix"/""}"
if [ ! -f "out/$FILE_NO_EXTENSION.vma.zst" ] || git diff --exit-code $FILE; then
# Hacky!
mkdir -p meta/$FILE
rm -rf meta/$FILE
sha512sum $FILE > /tmp/kt-clusterbuild_sha512sum
if [ ! -f "meta/$FILE.sha" ] || ! diff -q "/tmp/kt-clusterbuild_sha512sum" "meta/$FILE.sha" > /dev/null; then
./build.sh $FILE_NO_EXTENSION
else
echo "Not building '$FILE_NO_EXTENSION'."
fi
mv "/tmp/kt-clusterbuild_sha512sum" "meta/$FILE.sha"
done
echo "Done building."