Ver Fonte

Implement ability to install from local packages (#293)

Installer accepts path to Hestia deb packages using -D or --with-debs flag
Zollner Robert há 6 anos atrás
pai
commit
4da3c3100c
3 ficheiros alterados com 46 adições e 4 exclusões
  1. 2 0
      .gitignore
  2. 22 2
      install/hst-install-debian.sh
  3. 22 2
      install/hst-install-ubuntu.sh

+ 2 - 0
.gitignore

@@ -3,5 +3,7 @@
 *.gzip
 *.gz
 *.bz2
+*.deb
+
 .vscode
 .DS_Store

+ 22 - 2
install/hst-install-debian.sh

@@ -79,6 +79,7 @@ help() {
   -s, --hostname          Set hostname
   -e, --email             Set admin email
   -p, --password          Set admin password
+  -D, --with-debs         Path to Hestia debs
   -f, --force             Force installation
   -h, --help              Print this help
 
@@ -179,6 +180,7 @@ for arg; do
         --email)                args="${args}-e " ;;
         --password)             args="${args}-p " ;;
         --force)                args="${args}-f " ;;
+        --with-debs)            args="${args}-D " ;;
         --help)                 args="${args}-h " ;;
         *)                      [[ "${arg:0:1}" == "-" ]] || delim="\""
                                 args="${args}${delim}${arg}${delim} ";;
@@ -187,7 +189,7 @@ done
 eval set -- "$args"
 
 # Parsing arguments
-while getopts "a:n:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:fh" Option; do
+while getopts "a:n:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:D:fh" Option; do
     case $Option in
         a) apache=$OPTARG ;;            # Apache
         n) nginx=$OPTARG ;;             # Nginx
@@ -212,6 +214,7 @@ while getopts "a:n:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:fh" Option; do
         s) servername=$OPTARG ;;        # Hostname
         e) email=$OPTARG ;;             # Admin email
         p) vpass=$OPTARG ;;             # Admin password
+        D) withdebs=$OPTARG ;;          # Hestia debs path
         f) force='yes' ;;               # Force install
         h) help ;;                      # Help
         *) help ;;                      # Print help (default)
@@ -281,6 +284,11 @@ fi
 # Clear the screen once launch permissions have been verified
 clear
 
+# Configure apt to retry downloading on error
+if [ ! -f /etc/apt/apt.conf.d/80-retries ]; then
+    echo "APT::Acquire::Retries \"3\";" > /etc/apt/apt.conf.d/80-retries
+fi
+
 # Update apt repository
 echo "Please wait a moment while we update your systems APT repositories..."
 apt-get -qq update
@@ -819,6 +827,11 @@ if [ "$multiphp" = 'yes' ]; then
     software=$(echo "$software" | sed -e 's/php-phpseclib//')
     software=$(echo "$software" | sed -e 's/php-pgsql//')
 fi
+if [ -d "$withdebs" ]; then
+    software=$(echo "$software" | sed -e 's/hestia-nginx//')
+    software=$(echo "$software" | sed -e 's/hestia-php//')
+    software=$(echo "$software" | sed -e 's/hestia//')
+fi
 
 #----------------------------------------------------------#
 #                     Install packages                     #
@@ -850,6 +863,13 @@ echo
 # Check Installation result
 check_result $? "apt-get install failed"
 
+# Install Hestia packages from local folder
+if [ ! -z "$withdebs" ] && [ -d "$withdebs" ]; then
+    dpkg -i $withdebs/hestia_*.deb
+    dpkg -i $withdebs/hestia-php_*.deb
+    dpkg -i $withdebs/hestia-nginx_*.deb
+fi
+
 # Restoring autostart policy
 rm -f /usr/sbin/policy-rc.d
 
@@ -1776,7 +1796,7 @@ echo "(!) IMPORTANT: You must logout or restart the server before continuing."
 echo -n " Do you want to logout now? [Y/N] "
 read resetshell
 
-if [ $resetshell = "Y" ] || [ $resetshell = "y" ]; then
+if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
     logout
 fi
 

+ 22 - 2
install/hst-install-ubuntu.sh

@@ -64,6 +64,7 @@ help() {
   -s, --hostname          Set hostname
   -e, --email             Set admin email
   -p, --password          Set admin password
+  -D, --with-debs         Path to Hestia debs
   -f, --force             Force installation
   -h, --help              Print this help
 
@@ -164,6 +165,7 @@ for arg; do
         --email)                args="${args}-e " ;;
         --password)             args="${args}-p " ;;
         --force)                args="${args}-f " ;;
+        --with-debs)            args="${args}-D " ;;
         --help)                 args="${args}-h " ;;
         *)                      [[ "${arg:0:1}" == "-" ]] || delim="\""
                                 args="${args}${delim}${arg}${delim} ";;
@@ -172,7 +174,7 @@ done
 eval set -- "$args"
 
 # Parsing arguments
-while getopts "a:n:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:fh" Option; do
+while getopts "a:n:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:D:fh" Option; do
     case $Option in
         a) apache=$OPTARG ;;            # Apache
         n) nginx=$OPTARG ;;             # Nginx
@@ -197,6 +199,7 @@ while getopts "a:n:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:fh" Option; do
         s) servername=$OPTARG ;;        # Hostname
         e) email=$OPTARG ;;             # Admin email
         p) vpass=$OPTARG ;;             # Admin password
+        D) withdebs=$OPTARG ;;          # Hestia debs path
         f) force='yes' ;;               # Force install
         h) help ;;                      # Help
         *) help ;;                      # Print help (default)
@@ -266,6 +269,11 @@ fi
 # Clear the screen once launch permissions have been verified
 clear
 
+# Configure apt to retry downloading on error
+if [ ! -f /etc/apt/apt.conf.d/80-retries ]; then
+    echo "APT::Acquire::Retries \"3\";" > /etc/apt/apt.conf.d/80-retries
+fi
+
 # Update apt repository
 echo "Please wait a moment while we update your systems APT repositories..."
 apt-get -qq update
@@ -781,6 +789,11 @@ if [ "$multiphp" = 'yes' ]; then
     software=$(echo "$software" | sed -e 's/php-phpseclib//')
     software=$(echo "$software" | sed -e 's/php-pgsql//')
 fi
+if [ -d "$withdebs" ]; then
+    software=$(echo "$software" | sed -e 's/hestia-nginx//')
+    software=$(echo "$software" | sed -e 's/hestia-php//')
+    software=$(echo "$software" | sed -e 's/hestia//')
+fi
 
 #----------------------------------------------------------#
 #                 Disable Apparmor on LXC                  #
@@ -824,6 +837,13 @@ echo
 # Check Installation result
 check_result $? "apt-get install failed"
 
+# Install Hestia packages from local folder
+if [ ! -z "$withdebs" ] && [ -d "$withdebs" ]; then
+    dpkg -i $withdebs/hestia_*.deb
+    dpkg -i $withdebs/hestia-php_*.deb
+    dpkg -i $withdebs/hestia-nginx_*.deb
+fi
+
 # Restoring autostart policy
 rm -f /usr/sbin/policy-rc.d
 
@@ -1682,7 +1702,7 @@ echo "(!) IMPORTANT: You must logout or restart the server before continuing."
 echo -n " Do you want to logout now? [Y/N] "
 read resetshell
 
-if [ $resetshell = "Y" ] || [ $resetshell = "y" ]; then
+if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
     logout
 fi