-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathatw-install.bash
39 lines (30 loc) · 1 KB
/
atw-install.bash
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
#!/usr/bin/env bash
ATW_HOME="$HOME/.allthingsweb"
mkdir -p $ATW_HOME
cd $ATW_HOME
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
if [ "$ARCH" = "x86_64" ]; then
ARCH="x64"
elif [ "$ARCH" = "arm64" ] || [ "$ARCH" = "aarch64" ]; then
ARCH="arm64"
else
echo "❌ Unsupported architecture: $ARCH"
exit 1
fi
FILE="bun-${OS}-${ARCH}"
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/allthingsweb-dev/allthingsweb/releases/latest" | grep tag_name | cut -d'"' -f 4)
URL="https://github.com/allthingsweb-dev/allthingsweb/releases/download/${LATEST_RELEASE}/atw-cli-${FILE}"
if curl -fLO "${URL}"; then
echo "✅ Successfully downloaded ${FILE}"
else
echo "❌ Failed to download ${FILE}. Please check the URL or platform."
exit 1
fi
ln -sf $ATW_HOME/atw-cli-${FILE} $HOME/atw
chmod +x $HOME/atw
echo "You can now use ATW CLI by running: ~/atw"
echo ""
echo "- You may want to put ~/atw in you PATH"
echo "- You may want to creat an alias (in your .zshrc or .bashrc) alias atw='~/atw'"
~/atw