-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathinstall-devkit.sh
More file actions
executable file
·79 lines (65 loc) · 2.18 KB
/
install-devkit.sh
File metadata and controls
executable file
·79 lines (65 loc) · 2.18 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -e
# DevKit version
DEVKIT_VERSION=$(curl -fsSL https://raw.githubusercontent.com/Layr-Labs/devkit-cli/main/VERSION)
DEVKIT_BASE_URL="https://s3.amazonaws.com/eigenlayer-devkit-releases"
# Detect platform
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case $OS in
darwin) OS="darwin" ;;
linux) OS="linux" ;;
*) echo "Error: Unsupported OS: $OS"; exit 1 ;;
esac
case $ARCH in
x86_64|amd64) ARCH="amd64" ;;
arm64|aarch64) ARCH="arm64" ;;
*) echo "Error: Unsupported architecture: $ARCH"; exit 1 ;;
esac
PLATFORM="${OS}-${ARCH}"
# Prompt for installation directory
if [[ -t 0 ]]; then
# Interactive terminal available
echo "Where would you like to install DevKit?"
echo "1) $HOME/bin (recommended)"
echo "2) /usr/local/bin (system-wide, requires sudo)"
echo "3) Custom path"
read -p "Enter choice (1-3) [1]: " choice
else
# Non-interactive (piped), use default
echo "Installing to $HOME/bin (default for non-interactive install)"
choice=1
fi
case ${choice:-1} in
1) INSTALL_DIR="$HOME/bin" ;;
2) INSTALL_DIR="/usr/local/bin" ;;
3)
read -p "Enter custom path: " INSTALL_DIR
if [[ -z "$INSTALL_DIR" ]]; then
echo "Error: No path provided"
exit 1
fi
;;
*) echo "Invalid choice"; exit 1 ;;
esac
# Create directory if it doesn't exist
if [[ "$INSTALL_DIR" == "/usr/local/bin" ]]; then
sudo mkdir -p "$INSTALL_DIR"
else
mkdir -p "$INSTALL_DIR"
fi
# Download and install
DEVKIT_URL="${DEVKIT_BASE_URL}/${DEVKIT_VERSION}/devkit-${PLATFORM}-${DEVKIT_VERSION}.tar.gz"
echo "Downloading DevKit ${DEVKIT_VERSION} for ${PLATFORM}..."
if [[ "$INSTALL_DIR" == "/usr/local/bin" ]]; then
curl -sL "$DEVKIT_URL" | sudo tar -x -C "$INSTALL_DIR" -f -
else
curl -sL "$DEVKIT_URL" | tar -x -C "$INSTALL_DIR" -f -
fi
echo "✅ DevKit installed to $INSTALL_DIR/devkit"
# Add to PATH if needed
if [[ "$INSTALL_DIR" == "$HOME/bin" ]] && [[ ":$PATH:" != *":$HOME/bin:"* ]]; then
echo "💡 Add $HOME/bin to your PATH:"
echo " echo 'export PATH=\"\$HOME/bin:\$PATH\"' >> ~/.$(basename $SHELL)rc"
fi
echo "🚀 Verify installation: $INSTALL_DIR/devkit --help"