11# Autocompile Script for HestiaCP deb Files.
22
33# Set compiling directory
4- BUILD_DIR=' /root'
4+ BUILD_DIR=' /tmp/hestiacp-src/'
5+ DEB_DIR=" $BUILD_DIR /debs/"
56INSTALL_DIR=' /usr/local/hestia'
67
78# Set Version for compiling
@@ -12,6 +13,10 @@ PCRE_V='8.42'
1213ZLIB_V=' 1.2.11'
1314PHP_V=' 7.3.4'
1415
16+ # Create build directories
17+ rm -rf $BUILD_DIR
18+ mkdir -p $DEB_DIR
19+
1520# Set package dependencies for compiling
1621SOFTWARE=' build-essential libxml2-dev libz-dev libcurl4-gnutls-dev unzip openssl libssl-dev pkg-config'
1722
@@ -20,6 +25,24 @@ timestamp() {
2025 date +%s
2126}
2227
28+ branch=$2
29+ install=$3
30+
31+ # Set install flags
32+ if [ ! -z " $2 " ]; then
33+ branch=$2
34+ else
35+ echo -n " Please enter the name of the branch to build from (e.g. master): "
36+ read branch
37+ fi
38+
39+ if [ ! -z " $3 " ]; then
40+ install=$3
41+ else
42+ echo -n ' Would you like to install the compiled packages? [y/N] '
43+ read install
44+ fi
45+
2346# Install needed software
2447echo " Updating system APT repositories..."
2548apt-get -qq update > /dev/null 2>&1
@@ -55,22 +78,22 @@ for arg; do
5578done
5679
5780if [[ $# -eq 0 ]] ; then
58- echo " (!) Invalid compilation flag specified. Valid flags:"
59- echo " --all"
60- echo " --hestia"
61- echo " --nginx"
62- echo " --php"
81+ echo " ERROR: Invalid compilation flag specified. Valid flags include:"
82+ echo " --all: Build all hestia packages."
83+ echo " --hestia: Build only the Control Panel package."
84+ echo " --nginx: Build only the backend nginx engine package."
85+ echo " --php: Build only the backend php engine package"
86+ echo " "
87+ echo " For automated builds and installatioms, you may specify the branch"
88+ echo " after one of the above flags. To install the packages, specify 'Y'"
89+ echo " following the branch name."
90+ echo " "
91+ echo " Example: bash hst_autocompile.sh --hestia develop Y"
92+ echo " This would install a Hestia Control Panel package compiled with the"
93+ echo " develop branch code."
6394 exit 1
6495fi
6596
66- # Ask for branch
67- echo -n " Please enter the name of the branch to build from (e.g. master): "
68- read branch
69-
70- # Ask if package should be installed after compilation
71- echo -n ' Would you like to install the compiled packages? [y/N] '
72- read INSTALL
73-
7497# Set git repository raw path
7598GIT_REP=' https://raw.githubusercontent.com/hestiacp/hestiacp/' $branch ' /src/deb'
7699
@@ -171,6 +194,7 @@ if [ "$NGINX_B" = true ] ; then
171194 cd $BUILD_DIR
172195 chown -R root:root hestia-nginx_$NGINX_V
173196 dpkg-deb --build hestia-nginx_$NGINX_V
197+ mv * .deb $DEB_DIR
174198
175199 # clear up the source folder
176200 rm -r hestia-nginx_$NGINX_V
@@ -245,6 +269,7 @@ if [ "$PHP_B" = true ] ; then
245269 cd $BUILD_DIR
246270 chown -R root:root hestia-php_$PHP_V
247271 dpkg-deb --build hestia-php_$PHP_V
272+ mv * .deb $DEB_DIR
248273
249274 # clear up the source folder
250275 rm -r hestia-php_$PHP_V
@@ -300,6 +325,7 @@ if [ "$HESTIA_B" = true ] ; then
300325 cd $BUILD_DIR
301326 chown -R root:root hestia_$HESTIA_V
302327 dpkg-deb --build hestia_$HESTIA_V
328+ mv * .deb $DEB_DIR
303329
304330 # clear up the source folder
305331 rm -r hestia_$HESTIA_V
313339#
314340# ################################################################################
315341
316- if [ " $INSTALL " = ' y' ] || [ " $INSTALL " = ' Y' ]; then
317- for i in $BUILD_DIR / * hestia * .deb; do
342+ if [ " $install " = ' yes ' ] || [ " $install " = ' YES ' ] || [ " $install " = ' y' ] || [ " $install " = ' Y' ]; then
343+ for i in $DEB_DIR / * .deb; do
318344 # Install all available packages
319345 dpkg -i $i
320346 done
0 commit comments