From d2de0b1d6fca6f983222df2564aa1906270a93d3 Mon Sep 17 00:00:00 2001 From: OMGeeky Date: Sat, 17 May 2025 17:20:24 +0200 Subject: [PATCH] only move to last_upload dir if upload was successful --- deploy/deploy.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/deploy/deploy.sh b/deploy/deploy.sh index 4802831..9e64e2d 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -10,9 +10,6 @@ UPLOAD_TARGET_DIR= echo "preparing for deployment" mkdir -p "$UPLOAD_SOURCE_DIR" -# move the last upload directory to a backup to be able to compare the changes and only upload the changes -rm -rf "$LAST_UPLOAD_DIR" -mv "$UPLOAD_SOURCE_DIR" "$LAST_UPLOAD_DIR" mkdir -p "$UPLOAD_SOURCE_DIR" mkdir -p "$LAST_UPLOAD_DIR" @@ -64,3 +61,10 @@ fi echo "Deploying to ESP32 on port '$ESP_PORT'" # TODO: clear storage, if -f flag is passed in? ampy --port "$ESP_PORT" put "$ACTUAL_UPLOAD_SOURCE_DIR"/ "$UPLOAD_TARGET_DIR"/ +if [ $? -ne 0 ]; then + echo "Error: Deployment failed. Please check the connection and try again." + exit 1 +fi +# move the the current upload directory to a backup to be able to compare the changes and only upload the changes +rm -rf "$LAST_UPLOAD_DIR" +mv "$UPLOAD_SOURCE_DIR" "$LAST_UPLOAD_DIR" \ No newline at end of file