fix install script so that it also can update

This commit is contained in:
2025-01-16 21:40:43 +01:00
parent 2d045b758e
commit 98ea0640e2

View File

@ -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