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

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

View File

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