Skip to content

Commit 4da3c31

Browse files
LupulKristan Kenney
authored andcommitted
Implement ability to install from local packages (hestiacp#293)
Installer accepts path to Hestia deb packages using -D or --with-debs flag
1 parent 6b1a20c commit 4da3c31

File tree

3 files changed

+46
-4
lines changed

3 files changed

+46
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
*.gzip
44
*.gz
55
*.bz2
6+
*.deb
7+
68
.vscode
79
.DS_Store

install/hst-install-debian.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ help() {
7979
-s, --hostname Set hostname
8080
-e, --email Set admin email
8181
-p, --password Set admin password
82+
-D, --with-debs Path to Hestia debs
8283
-f, --force Force installation
8384
-h, --help Print this help
8485
@@ -179,6 +180,7 @@ for arg; do
179180
--email) args="${args}-e " ;;
180181
--password) args="${args}-p " ;;
181182
--force) args="${args}-f " ;;
183+
--with-debs) args="${args}-D " ;;
182184
--help) args="${args}-h " ;;
183185
*) [[ "${arg:0:1}" == "-" ]] || delim="\""
184186
args="${args}${delim}${arg}${delim} ";;
@@ -187,7 +189,7 @@ done
187189
eval set -- "$args"
188190

189191
# Parsing arguments
190-
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
192+
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
191193
case $Option in
192194
a) apache=$OPTARG ;; # Apache
193195
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
212214
s) servername=$OPTARG ;; # Hostname
213215
e) email=$OPTARG ;; # Admin email
214216
p) vpass=$OPTARG ;; # Admin password
217+
D) withdebs=$OPTARG ;; # Hestia debs path
215218
f) force='yes' ;; # Force install
216219
h) help ;; # Help
217220
*) help ;; # Print help (default)
@@ -281,6 +284,11 @@ fi
281284
# Clear the screen once launch permissions have been verified
282285
clear
283286

287+
# Configure apt to retry downloading on error
288+
if [ ! -f /etc/apt/apt.conf.d/80-retries ]; then
289+
echo "APT::Acquire::Retries \"3\";" > /etc/apt/apt.conf.d/80-retries
290+
fi
291+
284292
# Update apt repository
285293
echo "Please wait a moment while we update your systems APT repositories..."
286294
apt-get -qq update
@@ -819,6 +827,11 @@ if [ "$multiphp" = 'yes' ]; then
819827
software=$(echo "$software" | sed -e 's/php-phpseclib//')
820828
software=$(echo "$software" | sed -e 's/php-pgsql//')
821829
fi
830+
if [ -d "$withdebs" ]; then
831+
software=$(echo "$software" | sed -e 's/hestia-nginx//')
832+
software=$(echo "$software" | sed -e 's/hestia-php//')
833+
software=$(echo "$software" | sed -e 's/hestia//')
834+
fi
822835

823836
#----------------------------------------------------------#
824837
# Install packages #
@@ -850,6 +863,13 @@ echo
850863
# Check Installation result
851864
check_result $? "apt-get install failed"
852865

866+
# Install Hestia packages from local folder
867+
if [ ! -z "$withdebs" ] && [ -d "$withdebs" ]; then
868+
dpkg -i $withdebs/hestia_*.deb
869+
dpkg -i $withdebs/hestia-php_*.deb
870+
dpkg -i $withdebs/hestia-nginx_*.deb
871+
fi
872+
853873
# Restoring autostart policy
854874
rm -f /usr/sbin/policy-rc.d
855875

@@ -1776,7 +1796,7 @@ echo "(!) IMPORTANT: You must logout or restart the server before continuing."
17761796
echo -n " Do you want to logout now? [Y/N] "
17771797
read resetshell
17781798

1779-
if [ $resetshell = "Y" ] || [ $resetshell = "y" ]; then
1799+
if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
17801800
logout
17811801
fi
17821802

install/hst-install-ubuntu.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ help() {
6464
-s, --hostname Set hostname
6565
-e, --email Set admin email
6666
-p, --password Set admin password
67+
-D, --with-debs Path to Hestia debs
6768
-f, --force Force installation
6869
-h, --help Print this help
6970
@@ -164,6 +165,7 @@ for arg; do
164165
--email) args="${args}-e " ;;
165166
--password) args="${args}-p " ;;
166167
--force) args="${args}-f " ;;
168+
--with-debs) args="${args}-D " ;;
167169
--help) args="${args}-h " ;;
168170
*) [[ "${arg:0:1}" == "-" ]] || delim="\""
169171
args="${args}${delim}${arg}${delim} ";;
@@ -172,7 +174,7 @@ done
172174
eval set -- "$args"
173175

174176
# Parsing arguments
175-
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
177+
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
176178
case $Option in
177179
a) apache=$OPTARG ;; # Apache
178180
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
197199
s) servername=$OPTARG ;; # Hostname
198200
e) email=$OPTARG ;; # Admin email
199201
p) vpass=$OPTARG ;; # Admin password
202+
D) withdebs=$OPTARG ;; # Hestia debs path
200203
f) force='yes' ;; # Force install
201204
h) help ;; # Help
202205
*) help ;; # Print help (default)
@@ -266,6 +269,11 @@ fi
266269
# Clear the screen once launch permissions have been verified
267270
clear
268271

272+
# Configure apt to retry downloading on error
273+
if [ ! -f /etc/apt/apt.conf.d/80-retries ]; then
274+
echo "APT::Acquire::Retries \"3\";" > /etc/apt/apt.conf.d/80-retries
275+
fi
276+
269277
# Update apt repository
270278
echo "Please wait a moment while we update your systems APT repositories..."
271279
apt-get -qq update
@@ -781,6 +789,11 @@ if [ "$multiphp" = 'yes' ]; then
781789
software=$(echo "$software" | sed -e 's/php-phpseclib//')
782790
software=$(echo "$software" | sed -e 's/php-pgsql//')
783791
fi
792+
if [ -d "$withdebs" ]; then
793+
software=$(echo "$software" | sed -e 's/hestia-nginx//')
794+
software=$(echo "$software" | sed -e 's/hestia-php//')
795+
software=$(echo "$software" | sed -e 's/hestia//')
796+
fi
784797

785798
#----------------------------------------------------------#
786799
# Disable Apparmor on LXC #
@@ -824,6 +837,13 @@ echo
824837
# Check Installation result
825838
check_result $? "apt-get install failed"
826839

840+
# Install Hestia packages from local folder
841+
if [ ! -z "$withdebs" ] && [ -d "$withdebs" ]; then
842+
dpkg -i $withdebs/hestia_*.deb
843+
dpkg -i $withdebs/hestia-php_*.deb
844+
dpkg -i $withdebs/hestia-nginx_*.deb
845+
fi
846+
827847
# Restoring autostart policy
828848
rm -f /usr/sbin/policy-rc.d
829849

@@ -1682,7 +1702,7 @@ echo "(!) IMPORTANT: You must logout or restart the server before continuing."
16821702
echo -n " Do you want to logout now? [Y/N] "
16831703
read resetshell
16841704

1685-
if [ $resetshell = "Y" ] || [ $resetshell = "y" ]; then
1705+
if [ "$resetshell" = "Y" ] || [ "$resetshell" = "y" ]; then
16861706
logout
16871707
fi
16881708

0 commit comments

Comments
 (0)