-
Notifications
You must be signed in to change notification settings - Fork 10
/
wheel.sh
executable file
·46 lines (37 loc) · 1.02 KB
/
wheel.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
44
45
46
#!/usr/bin/env bash
if ! command -v curl &> /dev/null
then
echo "curl was not found, please install curl https://curl.se/"
exit
fi
if ! command -v jq &> /dev/null
then
echo "jq was not found, please install jq https://stedolan.github.io/jq/download/"
exit
fi
if ! command -v npx &> /dev/null
then
echo "npx was not found, please install node.js https://nodejs.org/en/download"
exit
fi
REPO=ceramicstudio/wheel/releases
ARCH=$(uname -m)
if [[ $ARCH == 'arm64' ]]
then
ARCH=aarch64
fi
OS=unknown-linux-gnu
if [[ $OSTYPE == 'darwin'* ]]
then
OS=apple-darwin
fi
TARGET=$ARCH-$OS
VERSION=$(curl https://api.github.com/repos/$REPO/latest -s | jq .name -r)
TAR_NAME=wheel_$TARGET.tar.gz
OUTPUT_FILE=wheel.tar.gz
DOWNLOAD_URL=https://github.com/$REPO/download/$VERSION/$TAR_NAME
echo "Downloading wheel "$VERSION" for target "$TARGET" from "$DOWNLOAD_URL
curl -LJ0 --output $OUTPUT_FILE $DOWNLOAD_URL
tar -xvf $OUTPUT_FILE
rm $OUTPUT_FILE
echo "Wheel is now ready to go, run ./wheel to setup Ceramic and ComposeDB"