-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfetch-kubo.sh
executable file
·46 lines (34 loc) · 916 Bytes
/
fetch-kubo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
ARCH=$(rustc -Vv | grep host | cut -f2 -d' ' | cut -f1 -d'-')
if [ $ARCH = 'x86_64' ]
then
ARCH="amd64";
elif [ $ARCH = 'aarch64' ]
then
ARCH="arm64";
fi
OS=$(rustc -Vv | grep host | cut -f3 -d'-')
DOUBLE=$OS-$ARCH
TRIPLE=$(rustc -Vv | grep host | cut -f2 -d' ')
if [ -f "bin/kubo-$TRIPLE" ]
then
exit
fi
KUBO_VERSIONS=$(curl -s https://dist.ipfs.tech/kubo/versions)
KUBO_LATEST=v${KUBO_VERSIONS##*v}
mkdir -p ./bin
cd bin
if [ ! $OS = 'windows' ]
then
curl -Os "https://dist.ipfs.tech/kubo/$KUBO_LATEST/kubo_${KUBO_LATEST}_$DOUBLE.tar.gz"
tar -xf kubo_${KUBO_LATEST}_$DOUBLE.tar.gz
mv ./kubo/ipfs ./kubo-$TRIPLE
rm -R kubo
rm kubo_${KUBO_LATEST}_$DOUBLE.tar.gz
else
curl -Os "https://dist.ipfs.tech/kubo/$KUBO_LATEST/kubo_${KUBO_LATEST}_$DOUBLE.zip"
unzip kubo_${KUBO_LATEST}_$DOUBLE".zip"
mv ./kubo/ipfs.exe ./kubo-$TRIPLE.exe
rm -R kubo
rm kubo_${KUBO_LATEST}_$DOUBLE.zip
fi