chore: Adds upload scripts.
This commit is contained in:
parent
befbab002a
commit
a2b6441b77
2 changed files with 24 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
mkdir meta > /dev/null 2> /dev/null
|
||||
touch meta/tagged_for_upload
|
||||
|
||||
for FILE in kitteh-node-*/*; do
|
||||
FILE_NO_EXTENSION="${FILE/".nix"/""}"
|
||||
|
@ -12,6 +13,10 @@ for FILE in kitteh-node-*/*; do
|
|||
|
||||
if [ ! -f "meta/$FILE.sha" ] || ! diff -q "/tmp/kt-clusterbuild_sha512sum" "meta/$FILE.sha" > /dev/null; then
|
||||
./build.sh $FILE_NO_EXTENSION
|
||||
|
||||
if ! grep -q "out/$FILE_NO_EXTENSION.vma.zst" meta/tagged_for_upload; then
|
||||
echo "out/$FILE_NO_EXTENSION.vma.zst" >> meta/tagged_for_upload
|
||||
fi
|
||||
else
|
||||
echo "Not building '$FILE_NO_EXTENSION'."
|
||||
fi
|
||||
|
|
19
upload.sh
Executable file
19
upload.sh
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
KITTEH_NODE_1=192.168.0.20
|
||||
KITTEH_NODE_2=192.168.0.21
|
||||
|
||||
while IFS= read -r LINE; do
|
||||
UPLOAD_PATH="/var/lib/vz/dump/$(basename $LINE)"
|
||||
echo "Uploading file '$LINE'..."
|
||||
|
||||
if [ "$(dirname $LINE)" = "out/kitteh-node-1" ]; then
|
||||
rsync --info=progress2 $LINE root@$KITTEH_NODE_1:$UPLOAD_PATH
|
||||
else
|
||||
rsync --info=progress2 $LINE root@$KITTEH_NODE_2:$UPLOAD_PATH
|
||||
fi
|
||||
|
||||
ESCAPED_LINE=$(printf '%s\n' "$LINE" | sed -e 's/[\/&]/\\&/g')
|
||||
sed -i "/$ESCAPED_LINE/d" meta/tagged_for_upload
|
||||
done < meta/tagged_for_upload
|
||||
|
||||
echo "Done."
|
Reference in a new issue