From 905af151dbfdd13ebe898612b046abf4ba50291d Mon Sep 17 00:00:00 2001 From: Mathias Date: Tue, 9 Aug 2022 01:38:55 +0200 Subject: [PATCH] Added the option to use a custom installation path --- install.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 67e12563..5a683d7c 100755 --- a/install.sh +++ b/install.sh @@ -8,9 +8,15 @@ RED='\033[1;31m' NORMAL='\033[0;39m' PURPLE='\033[0;35m' - INSTALLATION_PATH="/opt/myspeed" +while getopts "d:" o; do + # shellcheck disable=SC2220 + case "${o}" in + d) INSTALLATION_PATH=${OPTARG} ;; + esac +done + # Root check if [ $EUID -ne 0 ]; then echo -e "$RED✗ Fehler bei der Installation:$NORMAL Du benötigst Root-Rechte, um die Installation zu starten." @@ -24,6 +30,7 @@ if [ "$1" == "--beta" ]; then else echo -e "$YELLOW Version:$BLUE MySpeed Release" fi +echo -e "$YELLOW Ort:$BLUE $INSTALLATION_PATH" echo -e "$YELLOW Es wird die Speedtest API von Ookla verwendet." echo -e "$YELLOW Wenn du damit$RED nicht$YELLOW einverstanden bist," echo -e "$YELLOW kannst du die Installation mit$RED STRG + C$YELLOW abbrechen. " @@ -33,7 +40,7 @@ sleep 5 clear # Check if installed -if [ -d $INSTALLATION_PATH ]; then +if [ -d "$INSTALLATION_PATH" ]; then echo -e "$YELLOW⚠ Warnung: $NORMAL MySpeed ist bereits auf diesem System installiert." echo -e "$GREENℹ Info:$NORMAL Es wird nun der aktuelle Release installiert..." sleep 5 @@ -173,7 +180,7 @@ if command -v systemctl &> /dev/null && ! systemctl --all --type service | grep Restart=always User=root Environment=NODE_ENV=production - WorkingDirectory=/opt/myspeed + WorkingDirectory=$INSTALLATION_PATH [Install] WantedBy=multi-user.target