Sfoglia il codice sorgente

Merge pull request #1675 from jaapmarcus/feature/arm64-support

Feature/arm64 support
Kristan Kenney 5 anni fa
parent
commit
9e66853b6c

+ 33 - 2
bin/v-update-sys-hestia-git

@@ -72,6 +72,12 @@ BUILD_DIR='/tmp/hestiacp-src'
 DEB_DIR="$BUILD_DIR/debs"
 INSTALL_DIR='/usr/local/hestia'
 ARCHIVE_DIR="${BUILD_DIR}/archive"
+architecture="$(uname -m)"
+if [ $architecture == 'aarch64' ]; then
+    BUILD_ARCH='arm64'
+else
+    BUILD_ARCH='amd64'
+fi
 
 # Set command variables
 fork=$1
@@ -81,7 +87,6 @@ flags=$4
 
 # Set Version for compiling
 BUILD_VER=$(curl -s https://raw.githubusercontent.com/$fork/hestiacp/$branch/src/deb/hestia/control | grep "Version:" | cut -d' ' -f2)
-BUILD_ARCH='amd64'
 HESTIA_V="${BUILD_VER}_${BUILD_ARCH}"
 NGINX_V=$(curl -s https://raw.githubusercontent.com/$fork/hestiacp/$branch/src/deb/nginx/control |grep "Version:" |cut -d' ' -f2)
 OPENSSL_V='1.1.1g'
@@ -234,6 +239,9 @@ if [ "$NGINX_B" = true ] ; then
     # Download control, postinst and postrm files
     cd DEBIAN
     download_file $GIT_REP/nginx/control
+    if [ "$BUILD_ARCH" != "amd64" ]; then
+        sed -i "s/amd64/${BUILD_ARCH}/g" "control"
+    fi
     download_file $GIT_REP/nginx/copyright
     download_file $GIT_REP/nginx/postinst
     download_file $GIT_REP/nginx/postrm
@@ -296,14 +304,31 @@ if [ "$PHP_B" = true ] ; then
     cd php-$PHP_V
 
     # Configure PHP
-    ./configure     --prefix=/usr/local/hestia/php \
+    if [ $BUILD_ARCH = 'amd64' ]; then
+        ./configure   --prefix=/usr/local/hestia/php \
                     --enable-fpm \
                     --with-fpm-user=admin \
                     --with-fpm-group=admin \
                     --with-libdir=lib/x86_64-linux-gnu \
                     --with-mysqli \
+                    --with-gettext \
                     --with-curl \
+                    --with-zip \
+                    --with-gmp \
                     --enable-mbstring
+    else
+        ./configure   --prefix=/usr/local/hestia/php \
+                    --enable-fpm \
+                    --with-fpm-user=admin \
+                    --with-fpm-group=admin \
+                    --with-libdir=lib/aarch64-linux-gnu \
+                    --with-mysqli \
+                    --with-gettext \
+                    --with-curl \
+                    --with-zip \
+                    --with-gmp \
+                    --enable-mbstring
+    fi
 
     # Create the files and install them
     make -j $NUM_CPUS && make INSTALL_ROOT=$BUILD_DIR install
@@ -319,6 +344,9 @@ if [ "$PHP_B" = true ] ; then
     # Download control, postinst and postrm files
     cd DEBIAN
     download_file $GIT_REP/php/control
+    if [ "$BUILD_ARCH" != "amd64" ]; then
+        sed -i "s/amd64/${BUILD_ARCH}/g" "control"
+    fi
     download_file $GIT_REP/php/copyright
 
     # Move php directory
@@ -375,6 +403,9 @@ if [ "$HESTIA_B" = true ] ; then
     # Download control, postinst and postrm files
     cd DEBIAN
     download_file $GIT_REP/hestia/control
+    if [ "$BUILD_ARCH" != "amd64" ]; then
+        sed -i "s/amd64/${BUILD_ARCH}/g" "control"
+    fi
     download_file $GIT_REP/hestia/copyright
     download_file $GIT_REP/hestia/postinst
 

+ 44 - 6
install/hst-install-debian.sh

@@ -14,9 +14,9 @@ HESTIA='/usr/local/hestia'
 LOG="/root/hst_install_backups/hst_install-$(date +%d%m%Y%H%M).log"
 memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
 hst_backups="/root/hst_install_backups/$(date +%d%m%Y%H%M)"
-arch=$(uname -i)
 spinner="/-\|"
 os='debian'
+architecture="$(uname -m)"
 release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
 codename="$(cat /etc/os-release |grep VERSION= |cut -f 2 -d \(|cut -f 1 -d \))"
 HESTIA_INSTALL_DIR="$HESTIA/install/deb"
@@ -413,6 +413,36 @@ if [ -z "$withdebs" ] || [ ! -d "$withdebs" ]; then
     fi
 fi
 
+case $architecture in 
+x86_64)
+    ARCH="amd64"
+    ;;
+ aarch64)
+    ARCH="arm64"
+    if [ -z "$withdebs" ] || [ ! -d "$withdebs" ]; then
+        echo
+        echo -e "\e[91mInstallation aborted\e[0m"
+        echo "===================================================================="
+        echo -e "\e[33mERROR: HestiaCP on ARM is currently not supported with install from ATP!\e[0m"
+        echo -e "\e[33mPlease compile your own packages for HestiaCP. \e[0m"
+        echo -e "\e[33mPlease follow the instructions at: \e[0m"
+        echo -e "  \e[33mhttps://docs.hestiacp.com/development/panel.html#compiling\e[21m\e[0m"
+        echo ""
+        check_result 1 "Installation aborted"    
+    fi
+    ;;
+*)
+echo
+echo -e "\e[91mInstallation aborted\e[0m"
+echo "===================================================================="
+echo -e "\e[33mERROR: $architecture is currently not supported!\e[0m"
+echo -e "\e[33mPlease verify the achitecture used is currenlty supported\e[0m"
+echo ""
+echo -e "\e[33mhttps://github.com/hestiacp/hestiacp/blob/main/README.md\e[0m"
+echo ""
+check_result 1 "Installation aborted"
+esac
+
 #----------------------------------------------------------#
 #                       Brief Info                         #
 #----------------------------------------------------------#
@@ -602,11 +632,11 @@ echo "Adding required repositories to proceed with installation:"
 echo
 
 # Installing Nginx repo
+
 echo "[ * ] NGINX"
-echo "deb [arch=amd64] https://nginx.org/packages/mainline/$VERSION/ $codename nginx" > $apt/nginx.list
+echo "deb [arch=$ARCH] https://nginx.org/packages/mainline/$VERSION/ $codename nginx" > $apt/nginx.list
 apt-key adv --fetch-keys 'https://nginx.org/keys/nginx_signing.key' > /dev/null 2>&1
 
-
 # Installing sury PHP repo
 echo "[ * ] PHP"
 echo "deb https://packages.sury.org/php/ $codename main" > $apt/php.list
@@ -622,19 +652,27 @@ fi
 # Installing MariaDB repo
 if [ "$mysql" = 'yes' ]; then
     echo "[ * ] MariaDB"
-    echo "deb [arch=amd64] https://mirror.mva-n.net/mariadb/repo/$mariadb_v/$VERSION $codename main" > $apt/mariadb.list
+    echo "deb [arch=$ARCH] https://mirror.mva-n.net/mariadb/repo/$mariadb_v/$VERSION $codename main" > $apt/mariadb.list
     apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' > /dev/null 2>&1
 fi
 
 # Installing HestiaCP repo
 echo "[ * ] Hestia Control Panel"
-echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
+if [ "$ARCH" = "amd64" ]; then
+    echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
+else
+    echo "# deb https://$RHOST/ $codename main" > $apt/hestia.list
+    echo -e "\e[91m[ ! ] HestiaCP on ARM is currently in Development.\e[0m"
+    echo -e "\e[91m      This will mean that we don't provide any packages and you are responisble\e[0m"
+    echo -e "\e[91m      for building the packages your self. To build your own packeges see\e[0m"
+    echo -e "\e[91m      https://docs.hestiacp.com/development/panel.html#compiling\e[0m"
+fi
 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A189E93654F0B0E5 > /dev/null 2>&1
 
 # Installing PostgreSQL repo
 if [ "$postgresql" = 'yes' ]; then
     echo "[ * ] PostgreSQL"
-    echo "deb [arch=amd64] https://apt.postgresql.org/pub/repos/apt/ $codename-pgdg main" > $apt/postgresql.list
+    echo "deb [arch=$ARCH] https://apt.postgresql.org/pub/repos/apt/ $codename-pgdg main" > $apt/postgresql.list
     apt-key adv --fetch-keys 'https://www.postgresql.org/media/keys/ACCC4CF8.asc' > /dev/null 2>&1
 fi
 

+ 44 - 6
install/hst-install-ubuntu.sh

@@ -14,11 +14,11 @@ HESTIA='/usr/local/hestia'
 LOG="/root/hst_install_backups/hst_install-$(date +%d%m%Y%H%M).log"
 memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
 hst_backups="/root/hst_install_backups/$(date +%d%m%Y%H%M)"
-arch=$(uname -i)
 spinner="/-\|"
 os='ubuntu'
 release="$(lsb_release -s -r)"
 codename="$(lsb_release -s -c)"
+architecture="$(uname -m)"
 HESTIA_INSTALL_DIR="$HESTIA/install/deb"
 VERBOSE='no'
 
@@ -387,6 +387,35 @@ if [ -z "$withdebs" ] || [ ! -d "$withdebs" ]; then
     fi
 fi
 
+case $architecture in 
+    x86_64)
+        ARCH="amd64"
+        ;;
+    aarch64)
+        ARCH="arm64"
+        if [ -z "$withdebs" ] || [ ! -d "$withdebs" ]; then
+            echo
+            echo -e "\e[91mInstallation aborted\e[0m"
+            echo "===================================================================="
+            echo -e "\e[33mERROR: HestiaCP on ARM is currently not supported with install from ATP!\e[0m"
+            echo -e "\e[33mPlease compile your own packages for HestiaCP. \e[0m"
+            echo -e "\e[33mPlease follow the instructions at: \e[0m"
+            echo -e "  \e[33mhttps://docs.hestiacp.com/development/panel.html#compiling\e[21m\e[0m"
+            echo ""
+            check_result 1 "Installation aborted"    
+        fi
+        ;;
+    *)
+    echo
+    echo -e "\e[91mInstallation aborted\e[0m"
+    echo "===================================================================="
+    echo -e "\e[33mERROR: $architecture is currently not supported!\e[0m"
+    echo -e "\e[33mPlease verify the achitecture used is currenlty supported\e[0m"
+    echo ""
+    echo -e "\e[33mhttps://github.com/hestiacp/hestiacp/blob/main/README.md\e[0m"
+    echo ""
+    check_result 1 "Installation aborted"
+esac
 #----------------------------------------------------------#
 #                       Brief Info                         #
 #----------------------------------------------------------#
@@ -574,9 +603,10 @@ echo "Adding required repositories to proceed with installation:"
 echo
 
 # Installing Nginx repo
+
 echo "[ * ] NGINX"
-echo "deb [arch=amd64] https://nginx.org/packages/mainline/$VERSION/ $codename nginx" > $apt/nginx.list
-apt-key adv --fetch-keys 'https://nginx.org/keys/nginx_signing.key' > /dev/null 2>&1    
+echo "deb [arch=ARCH] https://nginx.org/packages/mainline/$VERSION/ $codename nginx" > $apt/nginx.list
+apt-key adv --fetch-keys 'https://nginx.org/keys/nginx_signing.key' > /dev/null 2>&1
 
 # Installing sury PHP repo
 echo "[ * ] PHP"
@@ -591,19 +621,27 @@ fi
 # Installing MariaDB repo
 if [ "$mysql" = 'yes' ]; then
     echo "[ * ] MariaDB"
-    echo "deb [arch=amd64] https://mirror.mva-n.net/mariadb/repo/$mariadb_v/$VERSION $codename main" > $apt/mariadb.list
+    echo "deb [arch=$ARCH] https://mirror.mva-n.net/mariadb/repo/$mariadb_v/$VERSION $codename main" > $apt/mariadb.list
     apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' > /dev/null 2>&1
 fi
 
 # Installing HestiaCP repo
 echo "[ * ] Hestia Control Panel"
-echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
+if [ "$ARCH" = "amd64" ]; then
+    echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
+else
+    echo "# deb https://$RHOST/ $codename main" > $apt/hestia.list
+    echo -e "\e[91m[ ! ] HestiaCP on ARM is currently in Development.\e[0m"
+    echo -e "\e[91m      This will mean that we don't provide any packages and you are responisble\e[0m"
+    echo -e "\e[91m      for building the packages your self. To build your own packeges see\e[0m"
+    echo -e "\e[91m      https://docs.hestiacp.com/development/panel.html#compiling\e[0m"
+fi
 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A189E93654F0B0E5 > /dev/null 2>&1
 
 # Installing PostgreSQL repo
 if [ "$postgresql" = 'yes' ]; then
     echo "[ * ] PostgreSQL"
-    echo "deb [arch=amd64] https://apt.postgresql.org/pub/repos/apt/ $codename-pgdg main" > $apt/postgresql.list
+    echo "deb [arch=$ARCH] https://apt.postgresql.org/pub/repos/apt/ $codename-pgdg main" > $apt/postgresql.list
     apt-key adv --fetch-keys 'https://www.postgresql.org/media/keys/ACCC4CF8.asc' > /dev/null 2>&1
 fi
 

+ 49 - 15
src/hst_autocompile.sh

@@ -6,7 +6,7 @@
 #   and the script will not try to download the arhive from github, since '~' char is 
 #   not accepted in branch name.
 # Compile but dont install -> ./hst_autocompile.sh --hestia --noinstall --keepbuild '~localsrc'
-# Compilea and install -> ./hst_autocompile.sh --hestia --install '~localsrc' 
+# Compile and install -> ./hst_autocompile.sh --hestia --install '~localsrc' 
 
 # Clear previous screen output
 clear
@@ -106,6 +106,12 @@ BUILD_DIR='/tmp/hestiacp-src'
 INSTALL_DIR='/usr/local/hestia'
 SRC_DIR="$(cd "$(dirname "$0")/.." && pwd)"
 ARCHIVE_DIR="$SRC_DIR/src/archive/"
+architecture="$(uname -m)"
+if [ $architecture == 'aarch64' ]; then
+    BUILD_ARCH='arm64'
+else
+    BUILD_ARCH='amd64'
+fi
 RPM_DIR="$BUILD_DIR/rpm/"
 DEB_DIR="$BUILD_DIR/deb/"
 if [ -f '/etc/redhat-release' ]; then
@@ -204,7 +210,6 @@ fi
 
 echo "Build version $BUILD_VER, with Nginx version $NGINX_V and PHP version $PHP_V"
 
-BUILD_ARCH='amd64'
 HESTIA_V="${BUILD_VER}_${BUILD_ARCH}"
 OPENSSL_V='1.1.1j'
 PCRE_V='8.44'
@@ -249,7 +254,11 @@ if [ "$dontinstalldeps" != 'true' ]; then
 
         # Fix for Debian PHP Envroiment
         if [ ! -e /usr/local/include/curl ]; then
-            ln -s /usr/include/x86_64-linux-gnu/curl /usr/local/include/curl
+            if [ $BUILD_ARCH == "amd64" ]; then
+                ln -s /usr/include/x86_64-linux-gnu/curl /usr/local/include/curl
+            else
+                echo "No x86_64 working"
+            fi
         fi
     fi
 fi
@@ -270,6 +279,7 @@ if [ "$HESTIA_DEBUG" ]; then
     echo "Hestia version   : $BUILD_VER"
     echo "Nginx version    : $NGINX_V"
     echo "PHP version      : $PHP_V"
+    echo "Architecture     : $BUILD_ARCH"
     echo "Debug mode       : $HESTIA_DEBUG"
     echo "Source directory : $SRC_DIR"
 fi
@@ -372,6 +382,9 @@ if [ "$NGINX_B" = true ] ; then
         # Get Debian package files
         mkdir -p $BUILD_DIR_HESTIANGINX/DEBIAN
         get_branch_file 'src/deb/nginx/control' "$BUILD_DIR_HESTIANGINX/DEBIAN/control"
+        if [ "$BUILD_ARCH" != "amd64" ]; then
+            sed -i "s/amd64/${BUILD_ARCH}/g" "$BUILD_DIR_HESTIANGINX/DEBIAN/control"
+        fi
         get_branch_file 'src/deb/nginx/copyright' "$BUILD_DIR_HESTIANGINX/DEBIAN/copyright"
         get_branch_file 'src/deb/nginx/postinst' "$BUILD_DIR_HESTIANGINX/DEBIAN/postinst"
         get_branch_file 'src/deb/nginx/postrm' "$BUILD_DIR_HESTIANGINX/DEBIAN/portrm"
@@ -451,18 +464,33 @@ if [ "$PHP_B" = true ] ; then
         cd $BUILD_DIR_PHP
 
         # Configure PHP
-        ./configure   --prefix=/usr/local/hestia/php \
-                    --enable-fpm \
-                    --with-fpm-user=admin \
-                    --with-fpm-group=admin \
-                    --with-libdir=lib/x86_64-linux-gnu \
-                    --with-mysqli \
-                    --with-gettext \
-                    --with-curl \
-                    --with-zip \
-                    --with-gmp \
-                    --enable-intl \
-                    --enable-mbstring
+        if [ $BUILD_ARCH = 'amd64' ]; then
+            ./configure   --prefix=/usr/local/hestia/php \
+                        --enable-fpm \
+                        --with-fpm-user=admin \
+                        --with-fpm-group=admin \
+                        --with-libdir=lib/x86_64-linux-gnu \
+                        --with-mysqli \
+                        --with-gettext \
+                        --with-curl \
+                        --with-zip \
+                        --with-gmp \
+                        --enable-intl \
+                        --enable-mbstring
+        else
+            ./configure   --prefix=/usr/local/hestia/php \
+                        --enable-fpm \
+                        --with-fpm-user=admin \
+                        --with-fpm-group=admin \
+                        --with-libdir=lib/aarch64-linux-gnu \
+                        --with-mysqli \
+                        --with-gettext \
+                        --with-curl \
+                        --with-zip \
+                        --with-gmp \
+                        --enable-intl \
+                        --enable-mbstring
+        fi
     fi
 
     cd $BUILD_DIR_PHP
@@ -503,6 +531,9 @@ if [ "$PHP_B" = true ] ; then
         [ "$HESTIA_DEBUG" ] && echo DEBUG: mkdir -p $BUILD_DIR_HESTIAPHP/DEBIAN
         mkdir -p $BUILD_DIR_HESTIAPHP/DEBIAN
         get_branch_file 'src/deb/php/control' "$BUILD_DIR_HESTIAPHP/DEBIAN/control"
+        if [ "$BUILD_ARCH" != "amd64" ]; then
+            sed -i "s/amd64/${BUILD_ARCH}/g" "$BUILD_DIR_HESTIAPHP/DEBIAN/control"
+        fi
         get_branch_file 'src/deb/php/copyright' "$BUILD_DIR_HESTIAPHP/DEBIAN/copyright"
 
         # Get custom config
@@ -600,6 +631,9 @@ if [ "$HESTIA_B" = 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