Просмотр исходного кода

Fix cpu architecture compatibility with b2 host (#2394)

* Fix cpu architecture compatibility with b2 host

Add check for cpu architecture and use the python b2 package instead of Github for arm64 architecture as the GitHub version doesn't exist and will produce an error.

* Add check if pip3 exists

If pip3 doesn't exit install python3-pip

* change arm cpu architecture handing

- change the way the script handles servers with ARM cpus, from downloading using pip3, to returning an error requesting the user solve this using manual action.
ZedPro 4 лет назад
Родитель
Сommit
d3a54bc240
1 измененных файлов с 10 добавлено и 2 удалено
  1. 10 2
      bin/v-add-backup-host

+ 10 - 2
bin/v-add-backup-host

@@ -20,6 +20,9 @@ password=$(perl -e 'print quotemeta shift(@ARGV)' "${raw_password}")
 path=${5-/backup}
 port=$6
 
+# CPU Architecture
+arch=$(uname -m)
+
 # Includes
 # shellcheck source=/usr/local/hestia/func/main.sh
 source $HESTIA/func/main.sh
@@ -188,8 +191,13 @@ fi
 if [ "$type" = 'b2' ]; then
     # Download b2 binary
     if [ ! -f "$b2cli" ]; then
-        wget -O $b2cli $b2lnk > /dev/null 2>&1
-        chmod +x $b2cli > /dev/null 2>&1
+        if [ "$arch" = 'aarch64' ] || [ "$arch" = 'arm64' ]; then
+            echo "Error: B2 binary for arm64 must be downloaded manually."
+            exit 3
+        else
+            wget -O $b2cli $b2lnk > /dev/null 2>&1
+            chmod +x $b2cli > /dev/null 2>&1
+        fi
         if [ ! -f "$b2cli" ]; then
             echo "Error: Binary download failed, b2 doesnt work as expected."
             exit 3