Skip to content

Commit 0f84061

Browse files
author
Kristan Kenney
committed
Fixes to hst_autocompile.sh
- Do not remove files from existing instanlltion - Enable parallel compiling for shorter build time Thanks @Lupul re: hestiacp#260
1 parent f7571e5 commit 0f84061

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/hst_autocompile.sh

100644100755
Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ if [ ! -e /usr/local/include/curl ]; then
5454
ln -s /usr/include/x86_64-linux-gnu/curl /usr/local/include/curl
5555
fi
5656

57+
# Get system cpu cores
58+
NUM_CPUS=$(grep "^cpu cores" /proc/cpuinfo | uniq | awk '{print $4}')
59+
5760
# Set packages to compile
5861
for arg; do
5962
case "$1" in
@@ -113,6 +116,8 @@ PHP='http://de2.php.net/distributions/php-'$PHP_V'.tar.gz'
113116
#################################################################################
114117

115118
if [ "$NGINX_B" = true ] ; then
119+
120+
echo "Building hestia-nginx package..."
116121
# Change to build directory
117122
cd $BUILD_DIR
118123

@@ -146,14 +151,13 @@ if [ "$NGINX_B" = true ] ; then
146151
--with-pcre-jit \
147152
--with-zlib=../zlib-$ZLIB_V
148153

149-
# Check install directory and move if exists
150-
if [ -d $INSTALL_DIR ]; then
151-
#mv $INSTALL_DIR $INSTALL_DIR$(timestamp)
152-
rm -r $INSTALL_DIR
154+
# Check install directory and remove if exists
155+
if [ -d "$BUILD_DIR$INSTALL_DIR" ]; then
156+
rm -r "$BUILD_DIR$INSTALL_DIR"
153157
fi
154158

155159
# Create the files and install them
156-
make && make install
160+
make -j $NUM_CPUS && make DESTDIR=$BUILD_DIR install
157161

158162
# Cleare up unused files
159163
cd $BUILD_DIR
@@ -175,7 +179,7 @@ if [ "$NGINX_B" = true ] ; then
175179

176180
# Move nginx directory
177181
cd ..
178-
mv /usr/local/hestia/nginx usr/local/hestia/
182+
mv $BUILD_DIR/usr/local/hestia/nginx usr/local/hestia/
179183

180184
# Get Service File
181185
cd etc/init.d
@@ -208,6 +212,7 @@ fi
208212
#################################################################################
209213

210214
if [ "$PHP_B" = true ] ; then
215+
echo "Building hestia-php package..."
211216
# Change to build directory
212217
cd $BUILD_DIR
213218

@@ -218,7 +223,7 @@ if [ "$PHP_B" = true ] ; then
218223
fi
219224

220225
# Create directory
221-
mkdir $BUILD_DIR/hestia-php_$PHP_V
226+
mkdir ${BUILD_DIR}/hestia-php_$PHP_V
222227

223228
# Download and unpack source files
224229
wget -qO- $PHP | tar xz
@@ -237,7 +242,7 @@ if [ "$PHP_B" = true ] ; then
237242
--enable-mbstring
238243

239244
# Create the files and install them
240-
make && make install
245+
make -j $NUM_CPUS && make INSTALL_ROOT=$BUILD_DIR install
241246

242247
# Cleare up unused files
243248
cd $BUILD_DIR
@@ -254,7 +259,7 @@ if [ "$PHP_B" = true ] ; then
254259

255260
# Move php directory
256261
cd ..
257-
mv /usr/local/hestia/php usr/local/hestia/
262+
mv ${BUILD_DIR}/usr/local/hestia/php usr/local/hestia/
258263

259264
# Get php-fpm.conf
260265
wget $GIT_REP/php/php-fpm.conf -O usr/local/hestia/php/etc/php-fpm.conf
@@ -283,6 +288,7 @@ fi
283288
#################################################################################
284289

285290
if [ "$HESTIA_B" = true ] ; then
291+
echo "Building Hestia Control Panel package..."
286292
# Change to build directory
287293
cd $BUILD_DIR
288294

@@ -339,7 +345,8 @@ fi
339345
#
340346
#################################################################################
341347

342-
if [ "$install" = 'yes' ] || [ "$install" = 'YES' ] || [ "$install" = 'y' ] || [ "$install" = 'Y' ]; then
348+
if [ "$install" = 'yes' ] || [ "$install" = 'y' ]; then
349+
echo "Installing packages..."
343350
for i in $DEB_DIR/*.deb; do
344351
# Install all available packages
345352
dpkg -i $i

0 commit comments

Comments
 (0)