Skip to content

Commit d438ee2

Browse files
authored
fix(installer): do not fail if the app folder does not exist (#30)
* fix: ensure existing application is stopped before updating during installation * fix: update installation completion message for clarity
1 parent 11b8c2d commit d438ee2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

install.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@ echo "Downloading: $ZIP_NAME"
1919
cd /tmp
2020
curl -sL "$ZIP_URL" -o app.zip
2121

22-
# before deleting the folder, stop it
23-
arduino-app-cli app stop user:scratch-arduino-app
22+
# Check if app exists and stop it before updating
23+
if [ -d "$HOME/ArduinoApps/scratch-arduino-app" ]; then
24+
echo "Stopping existing application..."
25+
arduino-app-cli app stop user:scratch-arduino-app || echo "Warning: Failed to stop app (may not be running)"
26+
rm -rf $HOME/ArduinoApps/scratch-arduino-app
27+
fi
2428

2529
unzip -q app.zip
26-
rm -rf $HOME/ArduinoApps/scratch-arduino-app
2730
mv -f scratch-arduino-app $HOME/ArduinoApps/
2831
rm -f app.zip
2932

30-
echo "Installation completed: $ZIP_NAME installed at $HOME/ArduinoApps/scratch-arduino-app"
33+
echo "Installed $ZIP_NAME at $HOME/ArduinoApps/scratch-arduino-app"
3134

3235
arduino-app-cli app start user:scratch-arduino-app
3336
arduino-app-cli properties set default user:scratch-arduino-app

0 commit comments

Comments
 (0)