From 87b498c472e90c5f71c3834bf2a8a5f5d2a328ef Mon Sep 17 00:00:00 2001 From: soulbird Date: Tue, 24 May 2022 09:01:03 +0800 Subject: [PATCH] chore(script): support to install dependencies under arm64 (#7091) --- utils/linux-install-etcd-client.sh | 18 +++++++++++++----- utils/linux-install-openresty.sh | 8 +++++++- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/utils/linux-install-etcd-client.sh b/utils/linux-install-etcd-client.sh index 8cefb01f7349..ea323aea41f2 100755 --- a/utils/linux-install-etcd-client.sh +++ b/utils/linux-install-etcd-client.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # # Licensed to the Apache Software Foundation (ASF) under one or more @@ -17,7 +17,15 @@ # limitations under the License. # -wget https://github.com/etcd-io/etcd/releases/download/v3.4.18/etcd-v3.4.18-linux-amd64.tar.gz -tar xf etcd-v3.4.18-linux-amd64.tar.gz -sudo cp etcd-v3.4.18-linux-amd64/etcdctl /usr/local/bin/ -rm -rf etcd-v3.4.18-linux-amd64 +ETCD_ARCH="amd64" +ETCD_VERSION=${ETCD_VERSION:-'3.4.18'} +ARCH=${ARCH:-`(uname -m | tr '[:upper:]' '[:lower:]')`} + +if [[ $ARCH == "arm64" ]] || [[ $ARCH == "aarch64" ]]; then + ETCD_ARCH="arm64" +fi + +wget https://github.com/etcd-io/etcd/releases/download/v${ETCD_VERSION}/etcd-v3.4.18-linux-${ETCD_ARCH}.tar.gz +tar xf etcd-v${ETCD_VERSION}-linux-${ETCD_ARCH}.tar.gz +sudo cp etcd-v${ETCD_VERSION}-linux-${ETCD_ARCH}/etcdctl /usr/local/bin/ +rm -rf etcd-v${ETCD_VERSION}-linux-${ETCD_ARCH} diff --git a/utils/linux-install-openresty.sh b/utils/linux-install-openresty.sh index d903fead62b2..7498da3ab381 100755 --- a/utils/linux-install-openresty.sh +++ b/utils/linux-install-openresty.sh @@ -17,10 +17,16 @@ # set -euo pipefail +ARCH=${ARCH:-`(uname -m | tr '[:upper:]' '[:lower:]')`} +arch_path="" +if [[ $ARCH == "arm64" ]] || [[ $ARCH == "aarch64" ]]; then + arch_path="arm64/" +fi + wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add - sudo apt-get -y update --fix-missing sudo apt-get -y install software-properties-common -sudo add-apt-repository -y "deb https://openresty.org/package/ubuntu $(lsb_release -sc) main" +sudo add-apt-repository -y "deb https://openresty.org/package/${arch_path}ubuntu $(lsb_release -sc) main" sudo apt-get update