From e718c60a22efd88f5db1c7aec886912b7446fb48 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 20 May 2024 08:57:25 +0200 Subject: [PATCH] Adding aarch64 support for install script --- install | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/install b/install index 355a0a5..4260ee4 100755 --- a/install +++ b/install @@ -12,10 +12,16 @@ function fail() { # platform IDs LIN=linux -LIN_URL=https://git.phoenix.ipv64.de/attachments/f701fbff-c58b-4aac-91e3-47efda1fc760 MAC=macos -MAC_URL=https://git.phoenix.ipv64.de/attachments/b09c6469-406a-4dd1-b5e8-1294a3aabf0f WIN=windows +# Urls +LIN_X64_URL=https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-x64.warp-packer +LIN_AARCH64_URL=https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/linux-aarch64.warp-packer +MAC_URL=https://git.phoenix.ipv64.de/public/warp/releases/download/1.0.0/macos-x64.warp-packer + +# platform architecture +X64=x64 +AARCH64=aarch64 # returns this platform ID function get_this_platform() { @@ -30,18 +36,39 @@ function get_this_platform() { esac } +# returns this platform architecture +function get_this_architecture() { + local this_machine="$(uname -m)" + case $this_machine in + x86_64) echo $X64 ;; + aarch64) echo $AARCH64 ;; + *) + fail_with "Unsupported machine $this_machine" + ;; + esac +} + # actually sets this platform THIS_PLATFORM=$(get_this_platform) +# actually sets this architecture +THIS_ARCHITECTURE=$(get_this_architecture) + # fetches latest release download link for the platform function get_warp_link() { local this_platform=$1 + local this_architecture=$2 if [ "$this_platform" = "$LIN" ]; then - echo "$LIN_URL" - else - echo "$MAC_URL" - fi + echo "$LIN_URL" + if [ "$this_architecture" = "$X64" ]; then + echo "$LIN_X64_URL" + else + echo "$LIN_AARCH64_URL" + fi + else + echo "$MAC_URL" + fi } # downloads and installs single binary @@ -90,7 +117,7 @@ function get_missing_deps() { WARP4J_LINK="https://git.phoenix.ipv64.de/public/warp4j/raw/branch/master/warp4j" echo "Getting information about warp-packer releases..." -WARP_LINK=$(get_warp_link $THIS_PLATFORM) +WARP_LINK=$(get_warp_link $THIS_PLATFORM $THIS_ARCHITECTURE) MISSING_DEPS=$(get_missing_deps)