From e0080b481ae5786e0fb843303b622a3ca951e6c4 Mon Sep 17 00:00:00 2001 From: Felix Mumme Date: Thu, 16 Jan 2025 21:50:45 +0100 Subject: [PATCH] allow user to choose version --- installation/install-openems.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/installation/install-openems.sh b/installation/install-openems.sh index e6926a8..3af83e2 100755 --- a/installation/install-openems.sh +++ b/installation/install-openems.sh @@ -7,17 +7,28 @@ CYAN='\033[0;36m' GREEN='\033[0;32m' NC='\033[0m' # No Color +# Ask for version +read -p "Do you want to install the latest version? (yes/no): " latest_choice + +if [[ "$latest_choice" =~ ^[Yy][Ee][Ss]$ ]]; then + version="latest" +else + read -p "Enter version number: " version +fi + +echo -e "${GREEN}Selected version: $version${NC}" + # 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 + sudo wget -O /usr/lib/openems/openems.jar https://git.mumme-it.de/Mumme-IT/openems-build/raw/branch/main/build/$version/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 + wget -O ~/openems-ui.zip https://git.mumme-it.de/Mumme-IT/openems-build/raw/main/build/$version/ui.zip sudo unzip -o ~/openems-ui.zip -d /var/www/openems/html sudo rm ~/openems-ui.zip @@ -71,7 +82,7 @@ sudo mkdir -p /etc/openems.d #fetch openems jar sudo mkdir -p /usr/lib/openems -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 +sudo wget -O /usr/lib/openems/openems.jar https://git.mumme-it.de/Mumme-IT/openems-build/raw/branch/main/build/$version/openems-edge.jar # reload systemd and start service sudo systemctl daemon-reload @@ -84,7 +95,7 @@ echo -e "${GREEN}setting up ui as default nginx site...${NC}" sudo mkdir -p /var/www/openems/html -wget -O ~/openems-ui.zip https://git.mumme-it.de/Mumme-IT/openems-build/raw/main/build/latest/ui.zip +wget -O ~/openems-ui.zip https://git.mumme-it.de/Mumme-IT/openems-build/raw/main/build/$version/ui.zip sudo unzip -o ~/openems-ui.zip -d /var/www/openems/html sudo rm ~/openems-ui.zip