updated the deploy function and some minimal styling stuff

This commit is contained in:
2026-03-11 23:23:04 -05:00
parent 7732196059
commit 41024f1fb6
3 changed files with 25 additions and 15 deletions
+14 -11
View File
@@ -1,19 +1,22 @@
!#bin/bash
#!/bin/bash
BUILD_DIR="/root"
# move sludge.db sqlite file
mv $BUILD_DIR/build/sludge.db $BUILD_DIR/sludge.db
# find newest zip file and extract version
NEWEST_ZIP="$(find "$BUILD_DIR" -maxdepth 1 -name "*.zip" -type f -printf '%T@ %p\n' | sort -rn | head -n 1 | cut -d' ' -f2)"
VERSION="$(basename -s .zip "$NEWEST_ZIP" | cut -d' ' -f2)"
# move sludge.db sqlite file with versioned backup name
cp "$BUILD_DIR/build/sludge.db" "$BUILD_DIR/sludge.db.$VERSION"
# remove build folder
rm -rf $BUILD_DIR/build/
rm -rf "$BUILD_DIR/build/"
# remove old build zip
rm -- "$(ls -rt $BUILD_DIR/*.zip | head -n 1)"
# unzip new build zip
unzip *.zip
# unzip newest zip file
unzip "$NEWEST_ZIP"
# move db file back
mv $BUILD_DIR/sludge.db $BUILD_DIR/build/sludge.db
cp "$BUILD_DIR/sludge.db.$VERSION" "$BUILD_DIR/build/sludge.db"
# restart sludge webserver
sudo systemctl restart sludge-info
sudo systemctl restart sludge-info