Whiptail & MSG alignment, curl flags, debconf-selection

Aligned text for Whiptail and MSG, changed the sizing of some Whiptail windows, added --Silent --Show-Error flags for CURL, removed some unnecessary spaces after lines, added DebConf selection for libssl1.1.
This commit is contained in:
b.waal
2020-03-17 12:29:19 +01:00
parent d41a093233
commit 519b2c760f

View File

@@ -36,6 +36,7 @@ TestMode=0
PKGA="add-apt-repository" PKGA="add-apt-repository"
PKGI="${PKGM} install -y" PKGI="${PKGM} install -y"
OUTPUT='/dev/null' OUTPUT='/dev/null'
debconf-set-selections <<< 'libssl1.1:amd64 libraries/restart-without-asking boolean true'
##-------------## ##-------------##
@@ -110,7 +111,7 @@ password="$passdiatwo"
# Installer-Requirements # # Installer-Requirements #
##--------------------------## ##--------------------------##
msg "Starting installer." 8 78 msg " Starting installer" 8 78
$PKGM update > $OUTPUT 2>&1 $PKGM update > $OUTPUT 2>&1
$PKGI curl > $OUTPUT 2>&1 $PKGI curl > $OUTPUT 2>&1
@@ -123,23 +124,23 @@ if [ $IMODE = n ]; then
if [ $TestMode = 0 ]; then if [ $TestMode = 0 ]; then
domain=$(whiptail --nocancel --inputbox " Enter the domain without WWW " 11 82 --title "Config" 3>&1 1>&2 2>&3) 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=0; fi if (whiptail --title "Config" --yesno " Does www.${domain} exist in DNS" 8 78); then domainwww=1; else domainwww=0; fi
if (whiptail --title "Config" --yesno "Hostname with nxdi.nl" 11 82); then if (whiptail --title "Config" --yesno " Hostname with nxdi.nl" 11 78); then
hostname=$(whiptail --nocancel --inputbox " SystemID (eg: VCH001) without ".nxdi.nl" " 11 82 --title "Config" 3>&1 1>&2 2>&3) hostname=$(whiptail --nocancel --inputbox " SystemID (eg: VCH001) without ".nxdi.nl" " 11 82 --title "Config" 3>&1 1>&2 2>&3)
hostname=$hostname".nxdi.nl" hostname=$hostname".nxdi.nl"
else else
hostname=$(whiptail --nocancel --inputbox " Hostname " 11 82 --title "Config" 3>&1 1>&2 2>&3) hostname=$(whiptail --nocancel --inputbox " Hostname" 11 78 --title "Config" 3>&1 1>&2 2>&3)
fi fi
if (whiptail --title "Config" --yesno "Enable SSL on installation?" 11 82); then if (whiptail --title "Config" --yesno " Enable SSL on installation?" 11 78); then
sslenable=1 sslenable=1
else else
sslenable=0 sslenable=0
fi fi
PasswordQuest 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 78 --title "Config" 3>&1 1>&2 2>&3)
fi 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) 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=$?
[[ "$esws" = 1 ]] && msg "Quiting installer." 8 78 && exit; [[ "$esws" = 1 ]] && msg " Quiting installer" 8 78 && exit;
fi fi
if [ $IMODE = l ]; then if [ $IMODE = l ]; then
@@ -210,11 +211,11 @@ fi
webserv="${webserv//:}" && webserv="${webserv,,}" webserv="${webserv//:}" && webserv="${webserv,,}"
echo "Generating apt list for Generic" echo "Generating apt list for Generic"
curl "$repo"/raw/branch/"$branch"/CoreModules/generic/apt.list >>/tmp/apt.list curl --silent --show-error "$repo"/raw/branch/"$branch"/CoreModules/generic/apt.list >>/tmp/apt.list
printf " " >>/tmp/apt.list printf " " >>/tmp/apt.list
echo "Generating apt list for Webserver" echo "Generating apt list for Webserver"
curl "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/apt.list >>/tmp/apt.list curl --silent --show-error "$repo"/raw/branch/"$branch"/CoreModules/"$webserv"/apt.list >>/tmp/apt.list
printf " " >>/tmp/apt.list printf " " >>/tmp/apt.list
@@ -375,14 +376,12 @@ break;;
"None") "None")
CMS=None: CMS=None:
break;; break;;
*) echo "$REPLY is not a valid option!";; *) echo "$REPLY is not a valid option!";;
esac esac
done done
fi fi
CMS="${CMS//:}" && CMS="${CMS,,}" CMS="${CMS//:}" && CMS="${CMS,,}"
echo "Generating Apt List for CMS" echo "Generating Apt List for CMS"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/apt.list >>/tmp/apt.list; then if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/apt.list >>/tmp/apt.list; then
@@ -401,9 +400,8 @@ fi
# Pre-Requirements # # Pre-Requirements #
##--------------------## ##--------------------##
msg " Preconfiguring"
sed -i '/Port 22/c\Port 4242' /etc/ssh/sshd_config sed -i '/Port 22/c\Port 4242' /etc/ssh/sshd_config
msg "Preconfiguring."
$PKGI software-properties-common gnupg > $OUTPUT 2>&1 $PKGI software-properties-common gnupg > $OUTPUT 2>&1
$PKGA universe -y > $OUTPUT 2>&1 $PKGA universe -y > $OUTPUT 2>&1
$PKGA ppa:ondrej/php -y > $OUTPUT 2>&1 $PKGA ppa:ondrej/php -y > $OUTPUT 2>&1
@@ -450,6 +448,7 @@ for val1 in ${option[*]}; do
fi fi
done done
echo "Running preconf for CMS" echo "Running preconf for CMS"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/preconf.sh; then if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/preconf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/"$CMS"/preconf.sh) source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/"$CMS"/preconf.sh)
@@ -506,6 +505,7 @@ for val1 in ${option[*]}; do
fi fi
done done
echo "Setting up SSL" echo "Setting up SSL"
if [ $sslenable = 1 ]; then if [ $sslenable = 1 ]; then
if [ $domainwww = 1 ]; then if [ $domainwww = 1 ]; then
@@ -522,13 +522,10 @@ sed -i -e 's/DOMAINname/'$domain'/' -e 's/CONFname/'$domain'/' -e 's/DomainWWW/'
wget -q -t7 "$repo"/raw/branch/"$branch"/Scripts/EnableSSL.sh -O ~/activateSSL-Backend.sh wget -q -t7 "$repo"/raw/branch/"$branch"/Scripts/EnableSSL.sh -O ~/activateSSL-Backend.sh
sed -i -e 's/DOMAINname/'$hostname'/' -e 's/CONFname/'Backend'/' -e 's/DomainWWW/'0'/' -e 's/Email/'$email'/' -e 's/WebServer/'$webserv'/' ~/activateSSL-Backend.sh sed -i -e 's/DOMAINname/'$hostname'/' -e 's/CONFname/'Backend'/' -e 's/DomainWWW/'0'/' -e 's/Email/'$email'/' -e 's/WebServer/'$webserv'/' ~/activateSSL-Backend.sh
echo "Running conf for CMS" echo "Running conf for CMS"
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/conf.sh; then if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/"$CMS"/conf.sh) source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/"$CMS"/conf.sh)
fi fi
if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/"$webserv"-conf.sh; then if curl --retry 2 --retry-delay 1 --output /dev/null --silent --head --fail "$repo"/raw/branch/"$branch"/CMS/"$CMS"/"$webserv"-conf.sh; then
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/"$CMS"/"$webserv"-conf.sh) source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/branch/"$branch"/CMS/"$CMS"/"$webserv"-conf.sh)
fi fi