-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·65 lines (56 loc) · 1.65 KB
/
install.sh
File metadata and controls
executable file
·65 lines (56 loc) · 1.65 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
set -e
# Detect platform
PLATFORM=""
ARCH=$(uname -m)
OS=$(uname -s)
if [ "$OS" = "Linux" ]; then
if [ "$ARCH" = "x86_64" ]; then
PLATFORM="x86_64-unknown-linux-musl"
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
PLATFORM="aarch64-unknown-linux-musl"
fi
elif [ "$OS" = "Darwin" ]; then
if [ "$ARCH" = "x86_64" ]; then
PLATFORM="x86_64-apple-darwin"
elif [ "$ARCH" = "arm64" ]; then
PLATFORM="aarch64-apple-darwin"
fi
fi
if [ -z "$PLATFORM" ]; then
echo "Error: Unsupported platform: $OS $ARCH"
echo "Supported platforms:"
echo " - Linux x86_64"
echo " - Linux ARM64 (aarch64)"
echo " - macOS Intel (x86_64)"
echo " - macOS Apple Silicon (arm64)"
exit 1
fi
echo "Installing wok for $PLATFORM..."
# Download binary
BINARY_NAME="wok-$PLATFORM"
URL="https://github.com/balanza/wok/releases/latest/download/$BINARY_NAME"
echo "Downloading from $URL..."
if ! curl -LO "$URL"; then
echo "Error: Failed to download binary from $URL"
echo "Please check your internet connection and try again."
exit 1
fi
# Make executable
chmod +x "$BINARY_NAME"
# Install to /usr/local/bin
INSTALL_DIR="/usr/local/bin"
if [ -w "$INSTALL_DIR" ]; then
mv "$BINARY_NAME" "$INSTALL_DIR/wok"
echo "Installed wok to $INSTALL_DIR/wok"
else
echo "Need sudo permission to install to $INSTALL_DIR"
if sudo mv "$BINARY_NAME" "$INSTALL_DIR/wok"; then
echo "Installed wok to $INSTALL_DIR/wok"
else
echo "Error: Failed to install wok to $INSTALL_DIR"
echo "You can manually move $BINARY_NAME to a directory in your PATH"
exit 1
fi
fi
wok