From 761d57f9bfea941d21fec0b1dedb99a801dcea3a Mon Sep 17 00:00:00 2001 From: Christ Date: Tue, 11 Aug 2026 22:44:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=20macOS=20=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=A4=B1=E8=B4=A5=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 postinstall 的完整执行过程和退出码写入 /var/log/ydisks-xianyu-helper-install.log。 记录 LaunchAgent 注册、用户目录解析和 Chromium 初始化输出,便于定位安装失败原因。 --- packaging/macos/scripts/postinstall | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packaging/macos/scripts/postinstall b/packaging/macos/scripts/postinstall index 36ab915..770718c 100755 --- a/packaging/macos/scripts/postinstall +++ b/packaging/macos/scripts/postinstall @@ -1,6 +1,14 @@ #!/bin/sh set -eu +INSTALL_LOG="/var/log/ydisks-xianyu-helper-install.log" +exec >>"$INSTALL_LOG" 2>&1 +trap 'exit_code=$?; printf "[%s] postinstall exit code: %s\\n" "$(date -u "+%Y-%m-%dT%H:%M:%SZ")" "$exit_code"' EXIT + +printf '\n[%s] postinstall start; uid=%s; user=%s; args=%s\n' \ + "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$(id -u)" "$(id -un)" "$*" +set -x + APP="/Applications/Ydisks Xianyu Helper.app" SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)" SERVER="$APP/Contents/Helpers/xianyu-server" @@ -63,8 +71,8 @@ launchctl bootout "gui/$UID_VALUE/$LEGACY_TRAY_LABEL" >/dev/null 2>&1 || true rm -f "$AGENT_DIR/$LEGACY_SERVER_LABEL.plist" "$AGENT_DIR/$LEGACY_TRAY_LABEL.plist" launchctl asuser "$UID_VALUE" env HOME="$HOME_DIR" "$BROWSER_INSTALL" \ - -driver-dir "$DRIVER_DIR" -browser-dir "$BROWSER_DIR" >/tmp/ydisks-xianyu-helper-browser-install.log 2>&1 || { - echo "Chromium 自动安装失败,详见 /tmp/ydisks-xianyu-helper-browser-install.log" + -driver-dir "$DRIVER_DIR" -browser-dir "$BROWSER_DIR" >>"$INSTALL_LOG" 2>&1 || { + echo "Chromium 自动安装失败,详情已写入 $INSTALL_LOG" } launchctl bootstrap "gui/$UID_VALUE" "$server_plist"