From bf6f1b333967ea09c56c57a28d69f8022114f551 Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Thu, 7 Sep 2023 17:37:30 +0200 Subject: [PATCH] Improve build script --- build.sh | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/build.sh b/build.sh index ab097cd..260cd13 100644 --- a/build.sh +++ b/build.sh @@ -1,13 +1,31 @@ +supervisor_name=schafkopf + echo "[1/7] Stopping server..." -sudo supervisorctl stop schafkopf +sudo supervisorctl stop supervisor_name + echo "[2/7] Changing permissions..." -sudo chown -R pi:pi . +if ! sudo chown -R pi:pi .; then + exit 0 +fi + echo "[3/7] Pulling changes..." -git pull +if ! git pull; then + exit 0 +fi + echo "[4/7] Building project..." -swift build -c release +if ! swift build -c release; then + exit 0 +fi + echo "[5/7] Restoring permissions..." -sudo chown -R www-data:www-data . +if ! sudo chown -R www-data:www-data .; then + exit 0 +fi + echo "[6/7] Starting server..." -sudo supervisorctl start schafkopf +if ! sudo supervisorctl start $supervisor_name; then + exit 0 +fi + echo "[7/7] Done"