cleanup: remove Linux scripts, unify core dir, fix Intel Mac bug

- Delete usb-scripts/, Linux-*.sh, setup-linux-usb.sh, migrate.js
- Rename core-mac/core-win → core (with migration shims for existing USBs)
- Fix Mac-Menu.command ARM64 hardcode — now detects Intel/Apple Silicon
- setup.sh: remove Linux branch, Windows download only with --all-platforms
- Update README.md and CLAUDE.md to reflect Mac + Windows only
This commit is contained in:
dongsheng123132
2026-03-14 00:08:56 +08:00
parent aa14c8528e
commit 4fcd22d4e3
18 changed files with 101 additions and 1390 deletions

View File

@@ -9,11 +9,13 @@ set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
APP_DIR="$SCRIPT_DIR/app"
CORE_DIR="$APP_DIR/core-mac"
CORE_DIR="$APP_DIR/core"
RUNTIME_DIR="$APP_DIR/runtime"
MIRROR="https://registry.npmmirror.com"
NODE_MIRROR="https://npmmirror.com/mirrors/node"
NODE_VERSION="v22.14.0"
ALL_PLATFORMS=false
[ "$1" = "--all-platforms" ] && ALL_PLATFORMS=true
GREEN='\033[0;32m'
CYAN='\033[0;36m'
@@ -38,11 +40,8 @@ if [ "$OS" = "Darwin" ]; then
PLATFORM="darwin-x64"
NODE_DIR_NAME="node-mac-x64"
fi
elif [ "$OS" = "Linux" ]; then
PLATFORM="linux-x64"
NODE_DIR_NAME="node-linux-x64"
else
echo -e "${RED}请在 Mac 或 Linux 上运行此脚本。Windows 请用 setup.bat${NC}"
echo -e "${RED}请在 Mac 上运行此脚本。Windows 请用 setup.bat${NC}"
exit 1
fi
@@ -71,35 +70,35 @@ else
fi
fi
# ---- 1b. Download Node.js for Windows (Cross-platform support) ----
WIN_NODE_TARGET="$RUNTIME_DIR/node-win-x64"
if [ -f "$WIN_NODE_TARGET/node.exe" ]; then
echo -e " ${GREEN}${NC} Node.js (win-x64) 已存在,跳过下载"
else
echo -e " ${CYAN}${NC} 下载 Node.js $NODE_VERSION (win-x64) - Windows支持..."
mkdir -p "$WIN_NODE_TARGET"
WIN_NODE_URL="$NODE_MIRROR/$NODE_VERSION/node-$NODE_VERSION-win-x64.zip"
echo " $WIN_NODE_URL"
# Download zip file to temp, extract, then move
TMP_ZIP="/tmp/node-win-x64-$$.zip"
curl -fSL "$WIN_NODE_URL" -o "$TMP_ZIP"
# Use unzip if available, otherwise try native tools
if command -v unzip >/dev/null 2>&1; then
unzip -q "$TMP_ZIP" -d "/tmp/node-win-extract-$$"
cp -r "/tmp/node-win-extract-$$"/node-$NODE_VERSION-win-x64/* "$WIN_NODE_TARGET/"
rm -rf "/tmp/node-win-extract-$$"
else
echo -e " ${RED}✗ unzip not found, skipping Windows runtime${NC}"
fi
rm -f "$TMP_ZIP"
# ---- 1b. Download Node.js for Windows (only with --all-platforms) ----
if [ "$ALL_PLATFORMS" = "true" ]; then
WIN_NODE_TARGET="$RUNTIME_DIR/node-win-x64"
if [ -f "$WIN_NODE_TARGET/node.exe" ]; then
echo -e " ${GREEN}${NC} Node.js (win-x64) 下载完成"
echo -e " ${GREEN}${NC} Node.js (win-x64) 已存在,跳过下载"
else
echo -e " ${CYAN}${NC} Windows runtime下载失败 (不影响当前平台使用)"
echo -e " ${CYAN}${NC} 下载 Node.js $NODE_VERSION (win-x64) - Windows支持..."
mkdir -p "$WIN_NODE_TARGET"
WIN_NODE_URL="$NODE_MIRROR/$NODE_VERSION/node-$NODE_VERSION-win-x64.zip"
echo " $WIN_NODE_URL"
TMP_ZIP="/tmp/node-win-x64-$$.zip"
curl -fSL "$WIN_NODE_URL" -o "$TMP_ZIP"
if command -v unzip >/dev/null 2>&1; then
unzip -q "$TMP_ZIP" -d "/tmp/node-win-extract-$$"
cp -r "/tmp/node-win-extract-$$"/node-$NODE_VERSION-win-x64/* "$WIN_NODE_TARGET/"
rm -rf "/tmp/node-win-extract-$$"
else
echo -e " ${RED}✗ unzip not found, skipping Windows runtime${NC}"
fi
rm -f "$TMP_ZIP"
if [ -f "$WIN_NODE_TARGET/node.exe" ]; then
echo -e " ${GREEN}${NC} Node.js (win-x64) 下载完成"
else
echo -e " ${CYAN}${NC} Windows runtime下载失败 (不影响当前平台使用)"
fi
fi
fi
@@ -173,4 +172,6 @@ echo -e " 目录结构:"
echo -e " app/core/ ← OpenClaw + 依赖"
echo -e " app/runtime/ ← Node.js $NODE_VERSION"
echo -e " data/ ← 运行后自动生成"
echo ""
echo -e " ${CYAN}提示: 制作跨平台 U 盘请用 bash setup.sh --all-platforms${NC}"
echo -e "${GREEN}════════════════════════════════════════${NC}"