diff --git a/install.sh b/install.sh index 5a683d7c..6fd48386 100755 --- a/install.sh +++ b/install.sh @@ -58,48 +58,21 @@ apt-get update -y clear echo -e "$GREENℹ Info:$NORMAL Die Installation wird jetzt vorbereitet. Das kann einen Augenblick dauern..." sleep 5 -# Check for wget -clear -echo -e "$BLUE🔎 Status:$NORMAL Überprüfe, ob wget vorhanden ist..." -if ! command -v wget &> /dev/null -then - echo -e "$YELLOWℹ \"wget\" ist nicht installiert.$NORMAL Die Installation wurde gestartet..." - sleep 2 - apt-get install wget -y -fi -# Check for unzip -clear -echo -e "$BLUE🔎 Status:$NORMAL Überprüfe, ob unzip vorhanden ist..." -if ! command -v unzip &> /dev/null -then - echo -e "$YELLOWℹ \"unzip\" ist nicht installiert.$NORMAL Die Installation wurde gestartet..." - sleep 2 - apt-get install unzip -y -fi - -# Check for build essential -clear -if [ "$1" == "--beta" ]; then - echo -e "$BLUE🔎 Status:$NORMAL Überprüfe, ob build-essential vorhanden ist..." - if ! dpkg-query -l build-essential | grep build-essential &> /dev/null +function check() { + clear + echo -e "$BLUE🔎 Status:$NORMAL Überprüfe, ob $1 vorhanden ist..." + if ! command -v "$1" &> /dev/null then - echo -e "$YELLOWℹ \"build-essential\" ist nicht installiert.$NORMAL Die Installation wurde gestartet..." + echo -e "$YELLOWℹ \"$1\" ist nicht installiert.$NORMAL Die Installation wurde gestartet..." sleep 2 - apt-get install build-essential -y + apt-get install "$1" -y fi -fi +} - -# Check for curl -clear -echo -e "$BLUE🔎 Status:$NORMAL Überprüfe, ob curl vorhanden ist..." -if ! command -v curl &> /dev/null -then - echo -e "$YELLOWℹ \"curl\" ist nicht installiert.$NORMAL Die Installation wurde gestartet..." - sleep 2 - apt-get install curl -y -fi +check "wget" +check "unzip" +check "curl" # Check for node clear @@ -125,14 +98,14 @@ echo -e "$GREEN✓ Vorbereitung abgeschlossen:$NORMAL Die Installation von MySpe sleep 3 clear -if [ ! -d $INSTALLATION_PATH ] +if [ ! -d "$INSTALLATION_PATH" ] then echo -e "$BLUEℹ Info: $NORMAL MySpeed wird unter dem Verzeichnis $INSTALLATION_PATH installiert. Der Ordner wird nun erstellt." sleep 2 - mkdir $INSTALLATION_PATH + mkdir "$INSTALLATION_PATH" fi -cd $INSTALLATION_PATH +cd "$INSTALLATION_PATH" echo -e "$BLUEℹ Info: $NORMAL Die aktuelle MySpeed-Instanz wird heruntergeladen. Einen Moment..." sleep 2