Просмотр исходного кода

Merge branch 'staging/fixes' into main

Kristan Kenney 5 лет назад
Родитель
Сommit
4d11e194b6
2 измененных файлов с 12 добавлено и 68 удалено
  1. 6 34
      install/hst-install-debian.sh
  2. 6 34
      install/hst-install-ubuntu.sh

+ 6 - 34
install/hst-install-debian.sh

@@ -64,6 +64,8 @@ elif [ "$release" -eq 10 ]; then
         ipset libapache2-mpm-itk"
 fi
 
+installer_dependencies="apt-transport-https curl dirmngr gnupg wget"
+
 # Defining help function
 help() {
     echo "Usage: $0 [OPTIONS]
@@ -310,40 +312,10 @@ apt-get -qq update
 # Creating backup directory
 mkdir -p $hst_backups
 
-# Checking wget
-if [ ! -e '/usr/bin/wget' ]; then
-    echo "[ * ] Installing wget..."
-    apt-get -y install wget >> $LOG
-    check_result $? "Can't install wget"
-fi
-
-# Checking curl
-if [ ! -e '/usr/bin/curl' ]; then
-    echo "[ * ] Installing curl..."
-    apt-get -y install curl >> $LOG
-    check_result $? "Can't install curl"
-fi
-
-# Checking dirmngr
-if [ ! -e '/usr/bin/dirmngr' ]; then
-    echo "[ * ] Installing dirmngr..."
-    apt-get -y install dirmngr >> $LOG
-    check_result $? "Can't install dirmngr"
-fi
-
-# Check if apt-transport-https is installed
-if [ ! -e '/usr/lib/apt/methods/https' ]; then
-    echo "[ * ] Installing apt-transport-https..."
-    apt-get -y install apt-transport-https >> $LOG
-    check_result $? "Can't install apt-transport-https"
-fi
-
-# Check if gnupg or gnupg2 is installed
-if [ ! -e '/usr/lib/gnupg2' ] || [ ! -e '/usr/lib/gnupg' ]; then
-    echo "[ * ] Installing gnupg2..."
-    apt-get -y install gnupg2 >> $LOG
-    check_result $? "Can't install gnupg2"
-fi
+# Pre-install packages
+echo "[ * ] Installing dependencies..."
+apt-get -y install $installer_dependencies >> $LOG
+check_result $? "Package installation failed, check log file for more details."
 
 # Check if apparmor is installed
 if [ $(dpkg-query -W -f='${Status}' apparmor 2>/dev/null | grep -c "ok installed") -eq 0 ]; then

+ 6 - 34
install/hst-install-ubuntu.sh

@@ -46,6 +46,8 @@ software="apache2 apache2.2-common apache2-suexec-custom apache2-utils
     hestia-nginx hestia-php vim-common vsftpd whois zip acl sysstat setpriv
     ipset libonig5 libzip5"
 
+installer_dependencies="apt-transport-https curl dirmngr gnupg wget"
+
 # Defining help function
 help() {
     echo "Usage: $0 [OPTIONS]
@@ -292,40 +294,10 @@ apt-get -qq update
 # Creating backup directory
 mkdir -p $hst_backups
 
-# Checking wget
-if [ ! -e '/usr/bin/wget' ]; then
-    echo "[ * ] Installing wget..."
-    apt-get -y install wget >> $LOG
-    check_result $? "Can't install wget"
-fi
-
-# Checking curl
-if [ ! -e '/usr/bin/curl' ]; then
-    echo "[ * ] Installing curl..."
-    apt-get -y install curl >> $LOG
-    check_result $? "Can't install curl"
-fi
-
-# Check if apt-transport-https is installed
-if [ ! -e '/usr/lib/apt/methods/https' ]; then
-    echo "[ * ] Installing apt-transport-https..."
-    apt-get -y install apt-transport-https >> $LOG
-    check_result $? "Can't install apt-transport-https"
-fi
-
-# Check if apt-add-repository is installed
-if [ ! -e '/usr/bin/apt-add-repository' ]; then
-    echo "[ * ] Installing apt-add-repository..."
-    apt-get -y install software-properties-common >> $LOG
-    check_result $? "Can't install software-properties-common"
-fi
-
-# Check if gnupg or gnupg2 is installed
-if [ ! -e '/usr/lib/gnupg2' ] || [ ! -e '/usr/lib/gnupg' ]; then
-    echo "[ * ] Installing gnupg2..."
-    apt-get -y install gnupg2 >> $LOG
-    check_result $? "Can't install gnupg2"
-fi
+# Pre-install packages
+echo "[ * ] Installing dependencies..."
+apt-get -y install $installer_dependencies >> $LOG
+check_result $? "Package installation failed, check log file for more details."
 
 # Check repository availability
 wget --quiet "https://$GPG/deb_signing.key" -O /dev/null