|
@@ -89,6 +89,7 @@ usage() {
|
|
|
echo " Options:"
|
|
echo " Options:"
|
|
|
echo " --install Install generated packages"
|
|
echo " --install Install generated packages"
|
|
|
echo " --keepbuild Don't delete downloaded source and build folders"
|
|
echo " --keepbuild Don't delete downloaded source and build folders"
|
|
|
|
|
+ echo " --cross Compile hestia package for both AMD64 and ARM64"
|
|
|
echo " --debug Debug mode"
|
|
echo " --debug Debug mode"
|
|
|
echo ""
|
|
echo ""
|
|
|
echo "For automated builds and installations, you may specify the branch"
|
|
echo "For automated builds and installations, you may specify the branch"
|
|
@@ -153,6 +154,9 @@ for i in $*; do
|
|
|
--keepbuild)
|
|
--keepbuild)
|
|
|
KEEPBUILD='true'
|
|
KEEPBUILD='true'
|
|
|
;;
|
|
;;
|
|
|
|
|
+ --cross)
|
|
|
|
|
+ CROSS='true'
|
|
|
|
|
+ ;;
|
|
|
--help|-h)
|
|
--help|-h)
|
|
|
usage
|
|
usage
|
|
|
exit 1
|
|
exit 1
|
|
@@ -303,6 +307,10 @@ branch_dash=$(echo "$branch" |sed 's/\//-/g');
|
|
|
|
|
|
|
|
if [ "$NGINX_B" = true ] ; then
|
|
if [ "$NGINX_B" = true ] ; then
|
|
|
echo "Building hestia-nginx package..."
|
|
echo "Building hestia-nginx package..."
|
|
|
|
|
+ if [ "$CROSS" = "true" ]; then
|
|
|
|
|
+ echo "Cross compile not supported for hestia-nginx or hestia-php"
|
|
|
|
|
+ exit 1;
|
|
|
|
|
+ fi
|
|
|
# Change to build directory
|
|
# Change to build directory
|
|
|
cd $BUILD_DIR
|
|
cd $BUILD_DIR
|
|
|
|
|
|
|
@@ -442,6 +450,11 @@ fi
|
|
|
#################################################################################
|
|
#################################################################################
|
|
|
|
|
|
|
|
if [ "$PHP_B" = true ] ; then
|
|
if [ "$PHP_B" = true ] ; then
|
|
|
|
|
+ if [ "$CROSS" = "true" ]; then
|
|
|
|
|
+ echo "Cross compile not supported for hestia-nginx or hestia-php"
|
|
|
|
|
+ exit 1;
|
|
|
|
|
+ fi
|
|
|
|
|
+
|
|
|
echo "Building hestia-php package..."
|
|
echo "Building hestia-php package..."
|
|
|
|
|
|
|
|
BUILD_DIR_HESTIAPHP=$BUILD_DIR/hestia-php_$PHP_V
|
|
BUILD_DIR_HESTIAPHP=$BUILD_DIR/hestia-php_$PHP_V
|
|
@@ -581,87 +594,96 @@ fi
|
|
|
#
|
|
#
|
|
|
#################################################################################
|
|
#################################################################################
|
|
|
|
|
|
|
|
-if [ "$HESTIA_B" = true ]; then
|
|
|
|
|
- echo "Building Hestia Control Panel package..."
|
|
|
|
|
-
|
|
|
|
|
- BUILD_DIR_HESTIA=$BUILD_DIR/hestia_$HESTIA_V
|
|
|
|
|
-
|
|
|
|
|
- # Change to build directory
|
|
|
|
|
- cd $BUILD_DIR
|
|
|
|
|
-
|
|
|
|
|
- if [ "$KEEPBUILD" != 'true' ] || [ ! -d "$BUILD_DIR_HESTIA" ]; then
|
|
|
|
|
- # Check if target directory exist
|
|
|
|
|
- if [ -d $BUILD_DIR_HESTIA ]; then
|
|
|
|
|
- rm -r $BUILD_DIR_HESTIA
|
|
|
|
|
- fi
|
|
|
|
|
-
|
|
|
|
|
- # Create directory
|
|
|
|
|
- mkdir -p $BUILD_DIR_HESTIA
|
|
|
|
|
- fi
|
|
|
|
|
-
|
|
|
|
|
- cd $BUILD_DIR
|
|
|
|
|
- rm -rf $BUILD_DIR/hestiacp-$branch_dash
|
|
|
|
|
- # Download and unpack source files
|
|
|
|
|
- if [ "$use_src_folder" == 'true' ]; then
|
|
|
|
|
- [ "$HESTIA_DEBUG" ] && echo DEBUG: cp -rf "$SRC_DIR/" $BUILD_DIR/hestiacp-$branch_dash
|
|
|
|
|
- cp -rf "$SRC_DIR/" $BUILD_DIR/hestiacp-$branch_dash
|
|
|
|
|
- elif [ -d $SRC_DIR ]; then
|
|
|
|
|
- download_file $HESTIA_ARCHIVE_LINK '-' 'fresh' | tar xz
|
|
|
|
|
- fi
|
|
|
|
|
-
|
|
|
|
|
- mkdir -p $BUILD_DIR_HESTIA/usr/local/hestia
|
|
|
|
|
|
|
+arch="$BUILD_ARCH"
|
|
|
|
|
|
|
|
- # Move needed directories
|
|
|
|
|
- cd $BUILD_DIR/hestiacp-$branch_dash
|
|
|
|
|
- cp -rf bin func install web $BUILD_DIR_HESTIA/usr/local/hestia/
|
|
|
|
|
-
|
|
|
|
|
- # Set permissions
|
|
|
|
|
- find $BUILD_DIR_HESTIA/usr/local/hestia/ -type f -exec chmod -x {} \;
|
|
|
|
|
-
|
|
|
|
|
- # Allow send email via /usr/local/hestia/web/inc/mail-wrapper.php via cli
|
|
|
|
|
- chmod +x $BUILD_DIR_HESTIA/usr/local/hestia/web/inc/mail-wrapper.php
|
|
|
|
|
- # Allow the executable to be executed
|
|
|
|
|
- chmod +x $BUILD_DIR_HESTIA/usr/local/hestia/bin/*
|
|
|
|
|
- find $BUILD_DIR_HESTIA/usr/local/hestia/install/ \( -name '*.sh' \) -exec chmod +x {} \;
|
|
|
|
|
- chmod -x $BUILD_DIR_HESTIA/usr/local/hestia/install/*
|
|
|
|
|
- chown -R root:root $BUILD_DIR_HESTIA
|
|
|
|
|
-
|
|
|
|
|
- if [ "$BUILD_DEB" = true ]; then
|
|
|
|
|
- # Get Debian package files
|
|
|
|
|
- mkdir -p $BUILD_DIR_HESTIA/DEBIAN
|
|
|
|
|
- get_branch_file 'src/deb/hestia/control' "$BUILD_DIR_HESTIA/DEBIAN/control"
|
|
|
|
|
- if [ "$BUILD_ARCH" != "amd64" ]; then
|
|
|
|
|
- sed -i "s/amd64/${BUILD_ARCH}/g" "$BUILD_DIR_HESTIA/DEBIAN/control"
|
|
|
|
|
- fi
|
|
|
|
|
- get_branch_file 'src/deb/hestia/copyright' "$BUILD_DIR_HESTIA/DEBIAN/copyright"
|
|
|
|
|
- get_branch_file 'src/deb/hestia/postinst' "$BUILD_DIR_HESTIA/DEBIAN/postinst"
|
|
|
|
|
- chmod +x $BUILD_DIR_HESTIA/DEBIAN/postinst
|
|
|
|
|
-
|
|
|
|
|
- echo Building Hestia DEB
|
|
|
|
|
- dpkg-deb --build $BUILD_DIR_HESTIA $DEB_DIR
|
|
|
|
|
- fi
|
|
|
|
|
-
|
|
|
|
|
- if [ "$BUILD_RPM" = true ]; then
|
|
|
|
|
- # Get RHEL package files
|
|
|
|
|
- get_branch_file 'src/rpm/hestia/hestia.spec' "${BUILD_DIR_HESTIA}/hestia.spec"
|
|
|
|
|
- sed -i "s/%HESTIA-VERSION%/${HESTIA_V}/g" "${BUILD_DIR_HESTIA}/hestia.spec"
|
|
|
|
|
- get_branch_file 'src/rpm/hestia/hestia.service' "${BUILD_DIR_HESTIA}/hestia.service"
|
|
|
|
|
-
|
|
|
|
|
- # Build RPM package
|
|
|
|
|
- mkdir -p $BUILD_DIR/rpmbuild
|
|
|
|
|
- echo Building Hestia RPM
|
|
|
|
|
- rpmbuild -bb --define "sourcedir $BUILD_DIR_HESTIA" --buildroot=$BUILD_DIR/rpmbuild/ ${BUILD_DIR_HESTIA}/hestia.spec > ${BUILD_DIR_HESTIA}.rpm.log
|
|
|
|
|
- cp ~/rpmbuild/RPMS/x86_64/hestia-*.rpm $RPM_DIR
|
|
|
|
|
- rm ~/rpmbuild/RPMS/x86_64/hestia-*.rpm
|
|
|
|
|
- rm -rf $BUILD_DIR/rpmbuild
|
|
|
|
|
- fi
|
|
|
|
|
-
|
|
|
|
|
- # clear up the source folder
|
|
|
|
|
- if [ "$KEEPBUILD" != 'true' ]; then
|
|
|
|
|
- rm -r $BUILD_DIR_HESTIA
|
|
|
|
|
- rm -rf hestiacp-$branch_dash
|
|
|
|
|
- fi
|
|
|
|
|
- cd $BUILD_DIR/hestiacp-$branch_dash
|
|
|
|
|
|
|
+if [ "$HESTIA_B" = true ]; then
|
|
|
|
|
+ if [ "$CROSS" = "true" ]; then
|
|
|
|
|
+ arch="amd64 arm64"
|
|
|
|
|
+ fi
|
|
|
|
|
+ for BUILD_ARCH in $arch; do
|
|
|
|
|
+ echo "Building Hestia Control Panel package..."
|
|
|
|
|
+
|
|
|
|
|
+ BUILD_DIR_HESTIA=$BUILD_DIR/hestia_$HESTIA_V
|
|
|
|
|
+
|
|
|
|
|
+ # Change to build directory
|
|
|
|
|
+ cd $BUILD_DIR
|
|
|
|
|
+
|
|
|
|
|
+ if [ "$KEEPBUILD" != 'true' ] || [ ! -d "$BUILD_DIR_HESTIA" ]; then
|
|
|
|
|
+ # Check if target directory exist
|
|
|
|
|
+ if [ -d $BUILD_DIR_HESTIA ]; then
|
|
|
|
|
+ rm -r $BUILD_DIR_HESTIA
|
|
|
|
|
+ fi
|
|
|
|
|
+
|
|
|
|
|
+ # Create directory
|
|
|
|
|
+ mkdir -p $BUILD_DIR_HESTIA
|
|
|
|
|
+ fi
|
|
|
|
|
+
|
|
|
|
|
+ cd $BUILD_DIR
|
|
|
|
|
+ rm -rf $BUILD_DIR/hestiacp-$branch_dash
|
|
|
|
|
+ # Download and unpack source files
|
|
|
|
|
+ if [ "$use_src_folder" == 'true' ]; then
|
|
|
|
|
+ [ "$HESTIA_DEBUG" ] && echo DEBUG: cp -rf "$SRC_DIR/" $BUILD_DIR/hestiacp-$branch_dash
|
|
|
|
|
+ cp -rf "$SRC_DIR/" $BUILD_DIR/hestiacp-$branch_dash
|
|
|
|
|
+ elif [ -d $SRC_DIR ]; then
|
|
|
|
|
+ download_file $HESTIA_ARCHIVE_LINK '-' 'fresh' | tar xz
|
|
|
|
|
+ fi
|
|
|
|
|
+
|
|
|
|
|
+ mkdir -p $BUILD_DIR_HESTIA/usr/local/hestia
|
|
|
|
|
+
|
|
|
|
|
+ # Move needed directories
|
|
|
|
|
+ cd $BUILD_DIR/hestiacp-$branch_dash
|
|
|
|
|
+ cp -rf bin func install web $BUILD_DIR_HESTIA/usr/local/hestia/
|
|
|
|
|
+
|
|
|
|
|
+ # Set permissions
|
|
|
|
|
+ find $BUILD_DIR_HESTIA/usr/local/hestia/ -type f -exec chmod -x {} \;
|
|
|
|
|
+
|
|
|
|
|
+ # Allow send email via /usr/local/hestia/web/inc/mail-wrapper.php via cli
|
|
|
|
|
+ chmod +x $BUILD_DIR_HESTIA/usr/local/hestia/web/inc/mail-wrapper.php
|
|
|
|
|
+ # Allow the executable to be executed
|
|
|
|
|
+ chmod +x $BUILD_DIR_HESTIA/usr/local/hestia/bin/*
|
|
|
|
|
+ find $BUILD_DIR_HESTIA/usr/local/hestia/install/ \( -name '*.sh' \) -exec chmod +x {} \;
|
|
|
|
|
+ chmod -x $BUILD_DIR_HESTIA/usr/local/hestia/install/*
|
|
|
|
|
+ chown -R root:root $BUILD_DIR_HESTIA
|
|
|
|
|
+
|
|
|
|
|
+ if [ "$BUILD_DEB" = true ]; then
|
|
|
|
|
+ # Get Debian package files
|
|
|
|
|
+ mkdir -p $BUILD_DIR_HESTIA/DEBIAN
|
|
|
|
|
+ get_branch_file 'src/deb/hestia/control' "$BUILD_DIR_HESTIA/DEBIAN/control"
|
|
|
|
|
+ if [ "$BUILD_ARCH" != "amd64" ]; then
|
|
|
|
|
+ sed -i "s/amd64/${BUILD_ARCH}/g" "$BUILD_DIR_HESTIA/DEBIAN/control"
|
|
|
|
|
+ fi
|
|
|
|
|
+ get_branch_file 'src/deb/hestia/copyright' "$BUILD_DIR_HESTIA/DEBIAN/copyright"
|
|
|
|
|
+ get_branch_file 'src/deb/hestia/preinst' "$BUILD_DIR_HESTIA/DEBIAN/preinst"
|
|
|
|
|
+ get_branch_file 'src/deb/hestia/postinst' "$BUILD_DIR_HESTIA/DEBIAN/postinst"
|
|
|
|
|
+ chmod +x $BUILD_DIR_HESTIA/DEBIAN/postinst
|
|
|
|
|
+ chmod +x $BUILD_DIR_HESTIA/DEBIAN/preinst
|
|
|
|
|
+
|
|
|
|
|
+ echo Building Hestia DEB
|
|
|
|
|
+ dpkg-deb --build $BUILD_DIR_HESTIA $DEB_DIR
|
|
|
|
|
+ fi
|
|
|
|
|
+
|
|
|
|
|
+ if [ "$BUILD_RPM" = true ]; then
|
|
|
|
|
+ # Get RHEL package files
|
|
|
|
|
+ get_branch_file 'src/rpm/hestia/hestia.spec' "${BUILD_DIR_HESTIA}/hestia.spec"
|
|
|
|
|
+ sed -i "s/%HESTIA-VERSION%/${HESTIA_V}/g" "${BUILD_DIR_HESTIA}/hestia.spec"
|
|
|
|
|
+ get_branch_file 'src/rpm/hestia/hestia.service' "${BUILD_DIR_HESTIA}/hestia.service"
|
|
|
|
|
+
|
|
|
|
|
+ # Build RPM package
|
|
|
|
|
+ mkdir -p $BUILD_DIR/rpmbuild
|
|
|
|
|
+ echo Building Hestia RPM
|
|
|
|
|
+ rpmbuild -bb --define "sourcedir $BUILD_DIR_HESTIA" --buildroot=$BUILD_DIR/rpmbuild/ ${BUILD_DIR_HESTIA}/hestia.spec > ${BUILD_DIR_HESTIA}.rpm.log
|
|
|
|
|
+ cp ~/rpmbuild/RPMS/x86_64/hestia-*.rpm $RPM_DIR
|
|
|
|
|
+ rm ~/rpmbuild/RPMS/x86_64/hestia-*.rpm
|
|
|
|
|
+ rm -rf $BUILD_DIR/rpmbuild
|
|
|
|
|
+ fi
|
|
|
|
|
+
|
|
|
|
|
+ # clear up the source folder
|
|
|
|
|
+ if [ "$KEEPBUILD" != 'true' ]; then
|
|
|
|
|
+ rm -r $BUILD_DIR_HESTIA
|
|
|
|
|
+ rm -rf hestiacp-$branch_dash
|
|
|
|
|
+ fi
|
|
|
|
|
+ cd $BUILD_DIR/hestiacp-$branch_dash
|
|
|
|
|
+ done
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
|
|
|