From 98ea0640e26392a322d0451941662e33355208b7 Mon Sep 17 00:00:00 2001 From: Felix Mumme Date: Thu, 16 Jan 2025 21:40:43 +0100 Subject: [PATCH] fix install script so that it also can update --- installation/install-openems.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/installation/install-openems.sh b/installation/install-openems.sh index ad92b92..e6926a8 100755 --- a/installation/install-openems.sh +++ b/installation/install-openems.sh @@ -7,6 +7,26 @@ CYAN='\033[0;36m' GREEN='\033[0;32m' NC='\033[0m' # No Color +# Check if OpenEMS is already installed +if [ -f "/usr/lib/openems/openems.jar" ] || [ -d "/var/www/openems/html" ]; then + echo -e "${YELLOW}Existing OpenEMS installation detected. Performing update...${NC}" + + echo -e "${GREEN}Updating OpenEMS JAR...${NC}" + # Update JAR file + sudo wget -O /usr/lib/openems/openems.jar https://git.mumme-it.de/Mumme-IT/openems-build/raw/branch/main/build/latest/openems-edge.jar + + echo -e "${GREEN}Updating UI files...${NC}" + # Update UI files + wget -O ~/openems-ui.zip https://git.mumme-it.de/Mumme-IT/openems-build/raw/main/build/latest/ui.zip + sudo unzip -o ~/openems-ui.zip -d /var/www/openems/html + sudo rm ~/openems-ui.zip + + sudo systemctl restart openems + echo -e "${GREEN}Update completed successfully!${NC}" + exit 0 +fi + +# Original installation code continues below for new installations host=$(hostname) read -p "Please enter the host (default: $host): " host_input