feat: add bootable Linux USB module (independent within repo)
Add bootable/ directory with complete toolkit to create a bootable Ubuntu USB drive with OpenClaw AI: - 4-step PowerShell scripts for USB preparation on Windows - Ventoy 1.0.99 boot manager with casper-rw persistence - Self-contained Linux setup and startup scripts - Detailed README with architecture, usage guide, and troubleshooting bootable/ is fully independent - does not reference any files from portable/, u-claw-app/, or website/. Also maintained as standalone repo at u-claw-linux for convenience. Update main README to reference both bootable/ and u-claw-linux repo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
82
bootable/linux-setup/start-openclaw.sh
Normal file
82
bootable/linux-setup/start-openclaw.sh
Normal file
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env bash
|
||||
# ============================================================
|
||||
# U-Claw OpenClaw Startup Script (Linux)
|
||||
# Completely self-contained — no external file dependencies
|
||||
# ============================================================
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
INSTALL_DIR="/opt/u-claw"
|
||||
NODE_BIN="$INSTALL_DIR/runtime/node-linux-x64/bin/node"
|
||||
CORE_DIR="$INSTALL_DIR/core"
|
||||
DATA_DIR="$INSTALL_DIR/data"
|
||||
|
||||
export OPENCLAW_HOME="$DATA_DIR/.openclaw"
|
||||
export OPENCLAW_STATE_DIR="$DATA_DIR/.openclaw"
|
||||
export OPENCLAW_CONFIG_PATH="$DATA_DIR/.openclaw/openclaw.json"
|
||||
|
||||
# --- Sanity checks ---
|
||||
if [[ ! -x "$NODE_BIN" ]]; then
|
||||
echo "[ERROR] Node.js not found at $NODE_BIN"
|
||||
echo "Please run setup-openclaw.sh first."
|
||||
read -rp "Press Enter to exit..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$CORE_DIR/node_modules/openclaw" ]]; then
|
||||
echo "[ERROR] OpenClaw not installed in $CORE_DIR"
|
||||
echo "Please run setup-openclaw.sh first."
|
||||
read -rp "Press Enter to exit..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Find available port in 18789-18799 ---
|
||||
PORT=""
|
||||
for p in $(seq 18789 18799); do
|
||||
if ! ss -tlnp 2>/dev/null | grep -q ":${p} "; then
|
||||
PORT="$p"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z "$PORT" ]]; then
|
||||
echo "[ERROR] All ports 18789-18799 are in use."
|
||||
read -rp "Press Enter to exit..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "============================================"
|
||||
echo " U-Claw AI Assistant"
|
||||
echo " Starting on port $PORT ..."
|
||||
echo "============================================"
|
||||
|
||||
# --- Check if model is configured ---
|
||||
CONFIG_FILE="$OPENCLAW_CONFIG_PATH"
|
||||
FIRST_RUN=false
|
||||
if [[ ! -f "$CONFIG_FILE" ]] || ! grep -q '"apiKey"' "$CONFIG_FILE" 2>/dev/null; then
|
||||
FIRST_RUN=true
|
||||
echo ""
|
||||
echo "[INFO] No AI model configured yet."
|
||||
echo " After startup, please configure your model in the browser."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# --- Start OpenClaw gateway ---
|
||||
cd "$CORE_DIR"
|
||||
OPENCLAW_ENTRY=$(find node_modules/openclaw -name "openclaw.mjs" -maxdepth 2 2>/dev/null | head -1)
|
||||
|
||||
if [[ -z "$OPENCLAW_ENTRY" ]]; then
|
||||
echo "[ERROR] Cannot find openclaw.mjs entry point."
|
||||
read -rp "Press Enter to exit..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Opening browser at http://localhost:$PORT ..."
|
||||
|
||||
# Open browser after a short delay
|
||||
(sleep 3 && xdg-open "http://localhost:$PORT" 2>/dev/null) &
|
||||
|
||||
"$NODE_BIN" "$OPENCLAW_ENTRY" gateway run \
|
||||
--allow-unconfigured \
|
||||
--force \
|
||||
--port "$PORT"
|
||||
Reference in New Issue
Block a user