-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·39 lines (32 loc) · 1.12 KB
/
install.sh
File metadata and controls
executable file
·39 lines (32 loc) · 1.12 KB
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
#!/usr/bin/env bash
set -euo pipefail
OWNER=gordonmurray
REPO=flycost
LATEST=${1:-$(curl -sSLI -o /dev/null -w %{url_effective} https://github.com/$OWNER/$REPO/releases/latest | awk -F/ '{print $NF}')}
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH=amd64;;
aarch64|arm64) ARCH=arm64;;
*) echo "unsupported architecture: $ARCH"; exit 1;;
esac
URL="https://github.com/$OWNER/$REPO/releases/download/$LATEST/flycost_${OS}_${ARCH}.tar.gz"
echo "Downloading flycost $LATEST for $OS/$ARCH..."
tmp=$(mktemp -d)
trap "rm -rf $tmp" EXIT
if command -v curl >/dev/null 2>&1; then
curl -sSLf "$URL" | tar -xz -C "$tmp"
elif command -v wget >/dev/null 2>&1; then
wget -qO- "$URL" | tar -xz -C "$tmp"
else
echo "Error: curl or wget required"
exit 1
fi
if [ -w /usr/local/bin ]; then
mv "$tmp/flycost" /usr/local/bin/flycost
echo "✅ Installed flycost $LATEST → /usr/local/bin/flycost"
else
sudo mv "$tmp/flycost" /usr/local/bin/flycost
echo "✅ Installed flycost $LATEST → /usr/local/bin/flycost (with sudo)"
fi
echo "🎉 Installation complete! Run 'flycost -h' to get started."