This commit is contained in:
陆柯 2023-03-07 09:27:23 +08:00
parent 809e0ba4be
commit e741388185
3 changed files with 37 additions and 31 deletions

View File

@ -15,18 +15,22 @@ else
fi fi
fi fi
if [[ "$(uname)" = "linux" ]]
then
# 用 dpkg --print-architecture 更直接 # 用 dpkg --print-architecture 更直接
ARCH=`dpkg --print-architecture` ARCH=`dpkg --print-architecture`
# if [[ "$(uname -m)" = "aarch64" ]]; else
# then if [[ "$(uname -m)" = "aarch64" ]];
# ARCH=arm64 then
# elif [[ "$(uname -m)" = "armv7l" ]]; ARCH=arm64
# then elif [[ "$(uname -m)" = "armv7l" ]];
# ARCH=arm then
# elif [[ "$(uname -m)" = "x86_64" ]]; ARCH=arm
# then elif [[ "$(uname -m)" = "x86_64" ]];
# ARCH=amd64 then
# fi ARCH=amd64
fi
fi
OS=`uname | tr 'A-Z' 'a-z'` OS=`uname | tr 'A-Z' 'a-z'`
@ -34,15 +38,13 @@ echo "=== Install geth[b] for 二进制, [s] for 源代码,[anything else
read -p ">>> " BINARY_OR_SOURCE read -p ">>> " BINARY_OR_SOURCE
if [ "$BINARY_OR_SOURCE" == 'b' ] if [ "$BINARY_OR_SOURCE" == 'b' ]
then then
echo "--- 下载二进制 geth (https://geth.ethereum.org/downloads) with correct hash" echo "--- Extracting download link with correct hash from https://geth.ethereum.org/downloads"
read -p ">>> " DOWNLINK wget https://gethstore.blob.core.windows.net/builds/`curl -s -L -o - 'https://geth.ethereum.org/downloads' | grep -o -m 1 "geth-$OS-$ARCH-$VERSION-[0-9a-f]*.tar.gz" | head -n 1` -O geth-binary-temp.tgz
# wget https://gethstore.blob.core.windows.net/builds/geth-$OS-$ARCH-$VERSION-$HASH.tar.gz -O geth-$OS-$ARCH-$VERSION.tgz tar xzf ./geth-binary-temp.tgz # --strip-components 1 ## 去掉tar包中顶级目录因为顶级目录含有checksum不方便在下一步进入
wget $DOWNLINK -O geth-$OS-$ARCH-$VERSION.tgz
tar xzf ./geth-$OS-$ARCH-$VERSION.tgz # --strip-components 1 ## 去掉tar包中顶级目录因为顶级目录含有checksum不方便在下一步进入
echo "--- 安装到 /usr/local/bin/geth" echo "--- 安装到 /usr/local/bin/geth"
mv ./geth-$OS-$ARCH-$VERSION-*/geth /usr/local/bin/ mv ./geth-$OS-$ARCH-*/geth /usr/local/bin/
echo "--- 删除原始文件" echo "--- 删除原始文件"
rm -fr ./geth-$OS-$ARCH-$VERSION.tgz ./geth-$OS-$ARCH-$VERSION-*/ rm -fr ./geth-binary-temp.tgz ./geth-$OS-$ARCH-*/
elif [ "$BINARY_OR_SOURCE" == 's' ] elif [ "$BINARY_OR_SOURCE" == 's' ]
then then
echo "--- 克隆并编译 geth" echo "--- 克隆并编译 geth"

View File

@ -14,18 +14,22 @@ else
fi fi
fi fi
if [[ "$(uname)" = "linux" ]]
then
# 用 dpkg --print-architecture 更直接 # 用 dpkg --print-architecture 更直接
ARCH=`dpkg --print-architecture` ARCH=`dpkg --print-architecture`
# if [[ "$(uname -m)" = "aarch64" ]]; else
# then if [[ "$(uname -m)" = "aarch64" ]];
# ARCH=arm64 then
# elif [[ "$(uname -m)" = "armv7l" ]]; ARCH=arm64
# then elif [[ "$(uname -m)" = "armv7l" ]];
# ARCH=arm then
# elif [[ "$(uname -m)" = "x86_64" ]]; ARCH=arm
# then elif [[ "$(uname -m)" = "x86_64" ]];
# ARCH=amd64 then
# fi ARCH=amd64
fi
fi
OS=`uname | tr 'A-Z' 'a-z'` OS=`uname | tr 'A-Z' 'a-z'`