use 'dpkg --print-architecture' to replace uname -m

This commit is contained in:
陆柯 2023-03-07 08:41:13 +08:00
parent 6e950b54cd
commit 809e0ba4be
3 changed files with 52 additions and 37 deletions

View File

@ -10,12 +10,18 @@ then
DEBIAN_VERSION=11 DEBIAN_VERSION=11
fi fi
echo "=== Enter architecture [amd64, i386, arm64, armhf] or [leave blank] for amd64" # 用 dpkg --print-architecture 更直接
read -p ">>> " DEBIAN_ARCH ARCH=`dpkg --print-architecture`
if [ -z "${DEBIAN_ARCH}" ] # if [[ "$(uname -m)" = "aarch64" ]];
then # then
DEBIAN_ARCH=amd64 # ARCH=arm64
fi # elif [[ "$(uname -m)" = "armv7l" ]];
# then
# ARCH=arm
# elif [[ "$(uname -m)" = "x86_64" ]];
# then
# ARCH=amd64
# fi
echo "=== Enter presets to download from [cdn, aws, china] or [leave blank] for cdn" echo "=== Enter presets to download from [cdn, aws, china] or [leave blank] for cdn"
read -p ">>> " PRESET read -p ">>> " PRESET
@ -26,7 +32,7 @@ fi
sudo curl -fLO https://raw.githubusercontent.com/bohanyang/debi/master/debi.sh sudo curl -fLO https://raw.githubusercontent.com/bohanyang/debi/master/debi.sh
sudo chmod a+rx debi.sh sudo chmod a+rx debi.sh
sudo ./debi.sh --version $DEBIAN_VERSION --architecture $DEBIAN_ARCH --user root --$PRESET # --architecture 可参略,默认为 amd64--password 可省略,则脚本启动后会问你要密码 sudo ./debi.sh --version $DEBIAN_VERSION --architecture $ARCH --user root --$PRESET # --architecture 可参略或者[amd64默认, i386, arm64, armhf]--password 可省略,则脚本启动后会问你要密码
echo "=== Shutdown now, wait for about 30 minutes (the project's github says 30 seconds), then try to ssh" echo "=== Shutdown now, wait for about 30 minutes (the project's github says 30 seconds), then try to ssh"
sudo shutdown -r now sudo shutdown -r now

View File

@ -15,31 +15,34 @@ else
fi fi
fi fi
ARCH=amd64 # 用 dpkg --print-architecture 更直接
ARCH=`dpkg --print-architecture`
# if [[ "$(uname -m)" = "aarch64" ]];
# then
# ARCH=arm64
# elif [[ "$(uname -m)" = "armv7l" ]];
# then
# ARCH=arm
# elif [[ "$(uname -m)" = "x86_64" ]];
# then
# ARCH=amd64
# fi
OS=`uname | tr 'A-Z' 'a-z'`
echo "=== Install geth[b] for 二进制, [s] for 源代码,[anything else or leave blank] for no change" echo "=== Install geth[b] for 二进制, [s] for 源代码,[anything else or leave blank] for no change"
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)" echo "--- 下载二进制 geth (https://geth.ethereum.org/downloads) with correct hash"
# mkdir -p ./geth-temp/
# cd ./geth-temp
if [ "$VERSION" == '1.10.26' ]
then
wget https://gethstore.blob.core.windows.net/builds/geth-linux-$ARCH-$VERSION-e5eb32ac.tar.gz -O geth-linux.tgz
elif [ "$VERSION" == '1.10.25' ]
then
wget https://gethstore.blob.core.windows.net/builds/geth-linux-$ARCH-$VERSION-69568c55.tar.gz -O geth-linux.tgz
else
echo "=== please find the download link in https://geth.ethereum.org/downloads"
read -p ">>> " DOWNLINK read -p ">>> " DOWNLINK
wget $DOWNLINK -O geth-linux.tgz # wget https://gethstore.blob.core.windows.net/builds/geth-$OS-$ARCH-$VERSION-$HASH.tar.gz -O geth-$OS-$ARCH-$VERSION.tgz
fi wget $DOWNLINK -O geth-$OS-$ARCH-$VERSION.tgz
tar xzf ./geth-linux.tgz # --strip-components 1 ## 去掉tar包中顶级目录因为顶级目录含有checksum不方便在下一步进入 tar xzf ./geth-$OS-$ARCH-$VERSION.tgz # --strip-components 1 ## 去掉tar包中顶级目录因为顶级目录含有checksum不方便在下一步进入
echo "--- 安装到 /usr/local/bin/geth" echo "--- 安装到 /usr/local/bin/geth"
mv ./geth-linux-*/geth /usr/local/bin/ mv ./geth-$OS-$ARCH-$VERSION-*/geth /usr/local/bin/
echo "--- 删除原始文件" echo "--- 删除原始文件"
rm -fr ./geth-linux.tgz ./geth-linux-$ARCH-$VERSION-*/ rm -fr ./geth-$OS-$ARCH-$VERSION.tgz ./geth-$OS-$ARCH-$VERSION-*/
elif [ "$BINARY_OR_SOURCE" == 's' ] elif [ "$BINARY_OR_SOURCE" == 's' ]
then then
echo "--- 克隆并编译 geth" echo "--- 克隆并编译 geth"

View File

@ -1,3 +1,5 @@
## https://dist.ipfs.tech/
defaultVERSION=0.18.1 defaultVERSION=0.18.1
if [ $1 ] if [ $1 ]
@ -12,19 +14,23 @@ else
fi fi
fi fi
if [[ "$(uname -m)" = "aarch64" ]]; # 用 dpkg --print-architecture 更直接
then ARCH=`dpkg --print-architecture`
ARCH=arm64 # if [[ "$(uname -m)" = "aarch64" ]];
elif [[ "$(uname -m)" = "armv7l" ]]; # then
then # ARCH=arm64
ARCH=arm # elif [[ "$(uname -m)" = "armv7l" ]];
elif [[ "$(uname -m)" = "x86_64" ]]; # then
then # ARCH=arm
ARCH=amd64 # elif [[ "$(uname -m)" = "x86_64" ]];
fi # then
# ARCH=amd64
# fi
echo Download https://dist.ipfs.tech/kubo/v$VERSION/kubo_v${VERSION}_linux-${ARCH}.tar.gz OS=`uname | tr 'A-Z' 'a-z'`
curl https://dist.ipfs.tech/kubo/v$VERSION/kubo_v${VERSION}_linux-${ARCH}.tar.gz -o kubo_v$VERSION.tgz
echo Download https://dist.ipfs.tech/kubo/v$VERSION/kubo_v${VERSION}_${OS}-${ARCH}.tar.gz
curl https://dist.ipfs.tech/kubo/v$VERSION/kubo_v${VERSION}_${OS}-${ARCH}.tar.gz -o kubo_v$VERSION.tgz
tar xzf kubo_v$VERSION.tgz tar xzf kubo_v$VERSION.tgz
rm -fr kubo_v$VERSION.tgz rm -fr kubo_v$VERSION.tgz
## install ./kubo/ipfs to /usr/local/bin/ipfs ## install ./kubo/ipfs to /usr/local/bin/ipfs