#!/bin/bash # 真机部署脚本:编译 GlassRemote 并安装到吴小苏的iPhone(WiFi 配对通道) # 用法: bash deploy.sh (Xcode 需已登录 Apple ID 且团队可用) set -u cd "$(dirname "$0")" TEAM=H2C3YSR973 UDID=D469A28E-D29F-54A0-8936-0EA41BA02DA2 DD=/tmp/dd_deploy LOG=/tmp/deploy_now.log : > "$LOG" echo "=== [1/2] 编译并签名 ===" | tee -a "$LOG" xcodebuild -project GlassRemote.xcodeproj -scheme GlassRemote \ -destination "platform=iOS,id=$UDID" \ -derivedDataPath "$DD" \ DEVELOPMENT_TEAM=$TEAM CODE_SIGN_STYLE=Automatic \ -allowProvisioningUpdates \ build 2>&1 | tee -a "$LOG" BUILD_EXIT=${PIPESTATUS[0]} echo "BUILD_EXIT=$BUILD_EXIT" | tee -a "$LOG" if [ "$BUILD_EXIT" != "0" ]; then echo "!!! 编译失败,停止" | tee -a "$LOG" exit 1 fi APP=$(find "$DD" -name "GlassRemote.app" -type d | head -1) echo "APP=$APP" | tee -a "$LOG" if [ -z "$APP" ]; then echo "!!! 未找到 .app" | tee -a "$LOG" exit 1 fi echo "=== [2/2] 安装到 iPhone ===" | tee -a "$LOG" xcrun devicectl device install app --device "$UDID" "$APP" 2>&1 | tee -a "$LOG" echo "INSTALL_EXIT=${PIPESTATUS[0]}" | tee -a "$LOG" echo "=== DONE ===" | tee -a "$LOG"