diff --git a/Makefile b/Makefile index 763a2a2..0403456 100644 --- a/Makefile +++ b/Makefile @@ -170,14 +170,20 @@ spirilink-software: # Set up web app service .PHONY: setup-webapp-service setup-webapp-service: - @echo "Setting up web app service..." + @echo "\nSetting up web app service..." @if [ -d ~/tmp/spiri-base ]; then \ - cd ~/tmp/spiri-base && git pull; \ + cd ~/tmp/spiri-base && git pull || (echo "Error updating repository. Check network and repository access." && exit 1); \ else \ - git clone --depth=1 --filter=blob:none --sparse https://git.spirirobotics.com/aepko/Spiri-Base.git ~/tmp/spiri-base && \ + git clone https://git.spirirobotics.com/aepko/Spiri-Base.git ~/tmp/spiri-base || (echo "Error cloning repository. Check network and repository access." && exit 1); \ cd ~/tmp/spiri-base && git sparse-checkout init --cone && git sparse-checkout set .output; \ fi; - $(SUDO) cp -r ~/tmp/spiri-base/.output/* /var/www/webapp/ + @if [ -d ~/tmp/spiri-base/.output ]; then \ + $(SUDO) mkdir -p /var/www/webapp; \ + $(SUDO) cp -r ~/tmp/spiri-base/.output/* /var/www/webapp/; \ + else \ + echo "Error: .output folder not found. Ensure the repository contains the necessary files."; \ + exit 1; \ + fi; @if [ -f $(CURDIR)/webapp.service ]; then \ $(SUDO) cp $(CURDIR)/webapp.service /etc/systemd/system/webapp.service; \ $(SUDO) systemctl enable webapp.service; \ @@ -185,7 +191,7 @@ setup-webapp-service: else \ echo "Error: webapp.service not found in deployment folder."; \ fi; - @echo "Web app service set up and running." + @echo "\nWeb app service set up and running." # Uninstall all installed components .PHONY: uninstall