From 8b46b3c28baab0070ac1a5b6476c9a6f78319b0e Mon Sep 17 00:00:00 2001 From: "b.waal" Date: Wed, 11 Mar 2020 12:35:41 +0100 Subject: [PATCH] Implemented TestVar Moved static-vars up, set TestMode to 1 (enabled) or 0 (disabled). TestMode skips basic questions for easier script testing. --- installer.sh | 61 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/installer.sh b/installer.sh index eaaff3f..9aac62c 100644 --- a/installer.sh +++ b/installer.sh @@ -1,4 +1,5 @@ #!/bin/bash + ##--------------------## # Legacy/Main Menu # ##--------------------## @@ -18,9 +19,44 @@ if [ "$1" = "-l" ]; then fi +##---------------## +# Static-Vars # +##---------------## + +#Git-repo +repo=https://git.ictmaatwerk.com/bprieshof/UBU-Web-V2 +branch=master +#Installer-config +phpver=7.4 +sqlver=8.0 +cockpit=1 +PHPMyadmin=1 +TestMode=0 +#PackageManager-config +PKGA="add-apt-repository" +PKGI="${PKGM} install -y" +OUTPUT='/dev/null' + + +##-------------## +# Test-Vars # +##-------------## + +if [ $TestMode = 1 ]; then +domain=ict-dagbesteding.nl +email=b.prieshof@ictmaatwerk.com +password=MeiFerrieSekureTESTp@ssw0rd4213 +hostname=vdh001.nxdi.nl +sslenable=0 +domainwww=0 +fi + + + ##---------------## # Functions # ##---------------## + msg () { if [ $IMODE = n ]; then TERM=ansi whiptail --title "Info" --infobox "$1" 8 52 @@ -70,24 +106,6 @@ password="$passdiatwo" } -##---------------## -# Static-Vars # -##---------------## - -#Git-repo -repo=https://git.ictmaatwerk.com/bprieshof/UBU-Web-V2 -branch=master -#Installer-config -phpver=7.4 -sqlver=8.0 -cockpit=1 -PHPMyadmin=1 -#PackageManager-config -PKGA="add-apt-repository" -PKGI="${PKGM} install -y" -OUTPUT='/dev/null' - - ##--------------------------## # Installer-Requirements # ##--------------------------## @@ -100,7 +118,9 @@ $PKGI curl > $OUTPUT 2>&1 ##--------## # Menu # ##--------## + if [ $IMODE = n ]; then +if [ $TestMode = 0 ]; then domain=$(whiptail --nocancel --inputbox " Enter the domain without WWW " 11 82 --title "Config" 3>&1 1>&2 2>&3) if (whiptail --title "Config" --yesno "Does www.${domain} exist in DNS" 8 78); then domainwww=1; else domainwww=1; fi if (whiptail --title "Config" --yesno "Hostname with nxdi.nl" 11 82); then @@ -115,7 +135,8 @@ else sslenable=0 fi PasswordQuest -email=$(whiptail --nocancel --inputbox " Enter the administrator e-mail" 11 82 --title "Config" 3>&1 1>&2 2>&3) +email=$(whiptail --nocancel --inputbox " Enter the administrator e-mail" 11 82 --title "Config" 3>&1 1>&2 2>&3) +fi webserv=$(whiptail --title "Select Webserver" --radiolist "WebServer" 11 53 5 "Nginx:" "Will install NGINX Webserver." ON "Apache:" "Will install Apache Webserver." OFF 3>&1 1>&2 2>&3) esws=$? [[ "$esws" = 1 ]] && msg "Quiting installer." 8 78 && exit; @@ -123,6 +144,7 @@ fi if [ $IMODE = l ]; then echo "" >/dev/null +if [ $TestMode = 0 ]; then echo "Enter the domain without WWW:" read domain while true; do @@ -163,6 +185,7 @@ done LegacyPasswordQuest echo "Administrator E-mail:" read email +fi echo "Select Webserver:" PS3='Selected:'