40 lines
1.1 KiB
Bash
40 lines
1.1 KiB
Bash
#!/bin/sh
|
|
# OpenClaw CLI wrapper for Git Bash / MSYS2 on Windows
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
INSTALL_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
|
|
case "$1" in
|
|
update)
|
|
echo "openclaw is managed by ClawX (bundled version)."
|
|
echo ""
|
|
echo "To update openclaw, update ClawX:"
|
|
echo " Open ClawX > Settings > Check for Updates"
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
export OPENCLAW_EMBEDDED_IN="ClawX"
|
|
NODE_EXE="$INSTALL_DIR/resources/bin/node.exe"
|
|
OPENCLAW_RUNTIME_ROOT="$INSTALL_DIR/resources/openclaw-runtime"
|
|
OPENCLAW_DIR=""
|
|
for dir in "$OPENCLAW_RUNTIME_ROOT"/openclaw-*; do
|
|
if [ -d "$dir" ]; then
|
|
OPENCLAW_DIR="$dir"
|
|
break
|
|
fi
|
|
done
|
|
if [ -z "$OPENCLAW_DIR" ]; then
|
|
OPENCLAW_DIR="$INSTALL_DIR/resources/openclaw"
|
|
else
|
|
export OPENCLAW_PLUGIN_STAGE_DIR="$OPENCLAW_RUNTIME_ROOT"
|
|
fi
|
|
OPENCLAW_ENTRY="$OPENCLAW_DIR/openclaw.mjs"
|
|
|
|
if [ -f "$NODE_EXE" ]; then
|
|
if "$NODE_EXE" -e 'const [maj,min]=process.versions.node.split(".").map(Number);process.exit((maj>22||maj===22&&min>=16)?0:1)' >/dev/null 2>&1; then
|
|
exec "$NODE_EXE" "$OPENCLAW_ENTRY" "$@"
|
|
fi
|
|
fi
|
|
|
|
ELECTRON_RUN_AS_NODE=1 exec "$INSTALL_DIR/ClawX.exe" "$OPENCLAW_ENTRY" "$@"
|