-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
183 lines (169 loc) · 7.69 KB
/
install.sh
File metadata and controls
183 lines (169 loc) · 7.69 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/usr/bin/env bash
# install.sh — One-line installer for OpenClaw VM
# Usage: curl -sSL https://raw.githubusercontent.com/openclaw/openclaw-vm/main/install.sh | bash
set -euo pipefail
# ── Colours ───────────────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'
ORANGE='\033[38;5;209m'; DORANGE='\033[38;5;166m'
CYAN='\033[0;36m'; BOLD='\033[1m'; DIM='\033[2m'; NC='\033[0m'
log() { echo -e " ${CYAN}→${NC} $1"; }
ok() { echo -e " ${GREEN}✓${NC} $1"; }
fail() { echo -e " ${RED}✗${NC} $1"; exit 1; }
REPO_URL="https://github.com/DaevMithran/openclaw-vm.git"
INSTALL_DIR="${OPENCLAW_VM_DIR:-$HOME/.openclaw-vm}"
VERSION="0.1.0"
echo ""
echo -e "${ORANGE} ╔═══╗ ╔═══╗ ╔═══╗ ╔═╗ ╔╗${ORANGE} ╔═══╗ ╔╗ ╔═══╗ ╔╗ ╔╗${NC}"
echo -e "${ORANGE} ║╔═╗║ ║╔═╗║ ║╔══╝ ║║╚╗║║${ORANGE} ║╔══╝ ║║ ║╔═╗║ ║║ ║║${NC}"
echo -e "${ORANGE} ║║ ║║ ║╚═╝║ ║╚══╗ ║╔╗╚╝║${ORANGE} ║║ ║║ ║╚═╝║ ║║ ╔╗║║${NC}"
echo -e "${ORANGE} ║║ ║║ ║╔══╝ ║╔══╝ ║║╚╗║║${ORANGE} ║║ ║║ ║╔═╗║ ║║╔╝╚╝║${NC}"
echo -e "${ORANGE} ║╚═╝║ ║║ ║╚══╗ ║║ ║║║${ORANGE} ║╚══╗ ║╚═╗ ║║ ║║ ║╚╝╔╗╔╝${NC}"
echo -e "${ORANGE} ╚═══╝ ╚╝ ╚═══╝ ╚╝ ╚═╝${ORANGE} ╚═══╝ ╚══╝ ╚╝ ╚╝ ╚══╝╚╝${NC}"
echo -e " 🦞${ORANGE} VM v${VERSION}${NC}"
# ── Detect OS ─────────────────────────────────────────────────
OS="unknown"
case "$(uname -s)" in
Darwin) OS="macos" ;;
Linux) OS="linux" ;;
*) fail "Unsupported operating system. OpenClaw VM supports macOS and Linux." ;;
esac
ARCH="$(uname -m)"
echo -e " ${DIM}OS: ${OS} / Arch: ${ARCH}${NC}"
echo ""
detect_linux_distro() {
if [[ -f /etc/os-release ]]; then
. /etc/os-release
echo "${ID:-unknown}"
else
echo "unknown"
fi
}
# ── Install VirtualBox ────────────────────────────────────────
if command -v VBoxManage &>/dev/null; then
ok "VirtualBox already installed ($(VBoxManage --version 2>/dev/null | head -1))"
else
case "$OS" in
macos)
if ! command -v brew &>/dev/null; then
fail "Homebrew is required on macOS. Install it from https://brew.sh"
fi
log "Installing VirtualBox via Homebrew..."
brew install --cask virtualbox
ok "VirtualBox installed"
;;
linux)
distro=$(detect_linux_distro)
case "$distro" in
ubuntu|debian|pop|linuxmint)
log "Installing VirtualBox via apt..."
sudo apt-get update -qq
sudo apt-get install -y -qq virtualbox virtualbox-ext-pack 2>/dev/null \
|| sudo apt-get install -y -qq virtualbox
;;
fedora|rhel|centos|rocky|alma)
log "Installing VirtualBox via dnf..."
sudo dnf install -y VirtualBox 2>/dev/null || {
sudo dnf install -y wget
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo rpm --import - 2>/dev/null
sudo wget -q "https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo" -O /etc/yum.repos.d/virtualbox.repo 2>/dev/null
sudo dnf install -y VirtualBox-7.1
}
;;
arch|manjaro|endeavouros)
log "Installing VirtualBox via pacman..."
sudo pacman -S --noconfirm virtualbox virtualbox-host-modules-arch
;;
*)
fail "Unsupported distro: $distro. Install VirtualBox manually: https://www.virtualbox.org/wiki/Linux_Downloads"
;;
esac
ok "VirtualBox installed"
;;
esac
fi
# ── Install Vagrant ───────────────────────────────────────────
if command -v vagrant &>/dev/null; then
ok "Vagrant already installed ($(vagrant --version 2>/dev/null))"
else
case "$OS" in
macos)
log "Installing Vagrant via Homebrew..."
brew install --cask vagrant
;;
linux)
distro=$(detect_linux_distro)
case "$distro" in
ubuntu|debian|pop|linuxmint)
log "Installing Vagrant via apt..."
if ! apt-cache show vagrant 2>/dev/null | grep -q "2\.[4-9]"; then
wget -qO- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg 2>/dev/null
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list > /dev/null
sudo apt-get update -qq
fi
sudo apt-get install -y -qq vagrant
;;
fedora|rhel|centos|rocky|alma)
log "Installing Vagrant via dnf..."
sudo dnf install -y dnf-plugins-core 2>/dev/null
sudo dnf config-manager --add-repo https://rpm.releases.hashicorp.com/fedora/hashicorp.repo 2>/dev/null
sudo dnf install -y vagrant
;;
arch|manjaro|endeavouros)
log "Installing Vagrant via pacman..."
sudo pacman -S --noconfirm vagrant
;;
*)
fail "Unsupported distro: $distro. Install Vagrant manually: https://developer.hashicorp.com/vagrant/install"
;;
esac
ok "Vagrant installed"
;;
esac
fi
# ── Get the repo ─────────────────────────────────────────────
# Detect if we're running from inside the repo already (local run)
SCRIPT_SOURCE="${BASH_SOURCE[0]:-}"
LOCAL_DIR=""
if [[ -n "$SCRIPT_SOURCE" ]] && [[ -f "$SCRIPT_SOURCE" ]]; then
CANDIDATE="$(cd "$(dirname "$SCRIPT_SOURCE")" && pwd)"
if [[ -f "$CANDIDATE/openclaw-vm" ]] && [[ -f "$CANDIDATE/Vagrantfile" ]]; then
LOCAL_DIR="$CANDIDATE"
fi
fi
if [[ -n "$LOCAL_DIR" ]]; then
# Running locally from inside the repo — use it directly
INSTALL_DIR="$LOCAL_DIR"
ok "Using local repo at $INSTALL_DIR"
elif [[ -d "$INSTALL_DIR/.git" ]]; then
log "Updating existing installation..."
cd "$INSTALL_DIR"
git pull --quiet
ok "Updated to latest version"
else
log "Cloning OpenClaw VM..."
git clone --quiet "$REPO_URL" "$INSTALL_DIR"
ok "Cloned to $INSTALL_DIR"
fi
# ── Make executable ───────────────────────────────────────────
chmod +x "$INSTALL_DIR/openclaw-vm"
# ── Symlink to PATH ──────────────────────────────────────────
TARGET="/usr/local/bin/openclaw-vm"
REAL_PATH="$(cd "$INSTALL_DIR" && pwd)/openclaw-vm"
if [[ -L "$TARGET" ]] && [[ "$(readlink "$TARGET")" == "$REAL_PATH" ]]; then
ok "openclaw-vm is on your PATH"
else
log "Adding openclaw-vm to your PATH..."
if [[ -w "/usr/local/bin" ]]; then
ln -sf "$REAL_PATH" "$TARGET"
else
sudo ln -sf "$REAL_PATH" "$TARGET"
fi
ok "openclaw-vm is now available globally"
fi
echo ""
echo -e " ${GREEN}${BOLD}Installation complete!${NC}"
echo ""
echo -e " Get started:"
echo -e " ${BOLD}openclaw-vm start${NC} Interactive setup + boot the VM"
echo -e " ${BOLD}openclaw-vm help${NC} Show all commands"
echo ""