From 4d36971511c6f4bfe143b23824de417618d4d366 Mon Sep 17 00:00:00 2001 From: chaodu-agent <274062505+chaodu-agent@users.noreply.github.com> Date: Sun, 27 Sep 2026 08:51:16 -0400 Subject: [PATCH 1/2] fix(pkg): pin payload app path so PackageKit cannot relocate it The first v0.6.0 install found the existing dev.openab.instance-mcp bundle under ~/.local and relocated the package payload there before postinstall. The script then failed because /Library/Application Support/OpenAB/instance-mcp/oab-instance-mcp.app no longer existed. Generate a pkgbuild component plist with BundleIsRelocatable=false. Packaging smoke expands PackageInfo and fails if the app ever appears under again. --- scripts/package-pkg.sh | 10 ++++++++++ scripts/test-packaging.sh | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/scripts/package-pkg.sh b/scripts/package-pkg.sh index 31c854d..bfd7df3 100755 --- a/scripts/package-pkg.sh +++ b/scripts/package-pkg.sh @@ -34,15 +34,25 @@ TMP=$(mktemp -d) trap 'rm -rf "$TMP"' EXIT PAYLOAD="$TMP/payload" SCRIPTS="$TMP/scripts" +COMPONENTS="$TMP/components.plist" mkdir -p "$PAYLOAD/Library/Application Support/OpenAB/instance-mcp" "$SCRIPTS" "$(dirname "$OUT")" /usr/bin/ditto "$APP" "$PAYLOAD/Library/Application Support/OpenAB/instance-mcp/oab-instance-mcp.app" cp "$ROOT/scripts/install-prebuilt.sh" "$SCRIPTS/install-prebuilt.sh" cp "$ROOT/scripts/pkg/postinstall" "$SCRIPTS/postinstall" chmod 755 "$SCRIPTS/install-prebuilt.sh" "$SCRIPTS/postinstall" +# Without an explicit component property list, pkgbuild marks the nested .app as +# relocatable. PackageKit then sees an existing copy under ~/.local and moves the +# payload there instead of /Library/Application Support; postinstall cannot find +# its source and fails. Pin the payload path — install-prebuilt performs the +# intentional per-user copy after dropping root. +/usr/bin/pkgbuild --analyze --root "$PAYLOAD" "$COMPONENTS" >/dev/null +/usr/libexec/PlistBuddy -c 'Set :0:BundleIsRelocatable false' "$COMPONENTS" + ARGS=( --root "$PAYLOAD" --scripts "$SCRIPTS" + --component-plist "$COMPONENTS" --identifier "$IDENTIFIER" --version "$VERSION" --install-location / diff --git a/scripts/test-packaging.sh b/scripts/test-packaging.sh index 0480c50..b888d7b 100755 --- a/scripts/test-packaging.sh +++ b/scripts/test-packaging.sh @@ -93,6 +93,13 @@ EXPANDED="$TMP/expanded" /usr/sbin/pkgutil --expand "$PKG" "$EXPANDED" [ -x "$EXPANDED/Scripts/postinstall" ] [ -x "$EXPANDED/Scripts/install-prebuilt.sh" ] +# A bundle listed under is moved to any existing matching bundle on +# the target Mac; then postinstall's payload path vanishes (the first v0.6.0 +# install failed exactly this way). The explicit component plist must remove it. +if /usr/bin/sed -n '//,/<\/relocate>/p' "$EXPANDED/PackageInfo" | /usr/bin/grep -q '&2 + exit 1 +fi /bin/bash -n "$EXPANDED/Scripts/postinstall" /bin/bash -n "$EXPANDED/Scripts/install-prebuilt.sh" From 5595461a13716cedfd57e5a80d34360010239ecd Mon Sep 17 00:00:00 2001 From: chaodu-agent <274062505+chaodu-agent@users.noreply.github.com> Date: Sun, 27 Sep 2026 08:55:22 -0400 Subject: [PATCH 2/2] release: bump fixed installer to 0.6.1 --- Sources/oab-instance-mcp/main.swift | 2 +- docs/releasing.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/oab-instance-mcp/main.swift b/Sources/oab-instance-mcp/main.swift index 0c03dd1..42fd525 100644 --- a/Sources/oab-instance-mcp/main.swift +++ b/Sources/oab-instance-mcp/main.swift @@ -4,7 +4,7 @@ import CoreGraphics import Foundation import InstanceMCPCore -let version = "0.6.0" +let version = "0.6.1" struct Options { var host = "127.0.0.1" diff --git a/docs/releasing.md b/docs/releasing.md index 649a129..77b3ca0 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -120,8 +120,8 @@ lipo -create /tmp/imcp-arm64/release/oab-instance-mcp \ /tmp/imcp-x86_64/release/oab-instance-mcp \ -output /tmp/oab-instance-mcp chmod +x /tmp/oab-instance-mcp -scripts/assemble-app.sh /tmp/oab-instance-mcp /tmp/oab-instance-mcp.app 0.6.0 -ALLOW_UNSIGNED=1 scripts/package-pkg.sh /tmp/oab-instance-mcp.app /tmp/oab-instance-mcp.pkg 0.6.0 +scripts/assemble-app.sh /tmp/oab-instance-mcp /tmp/oab-instance-mcp.app 0.6.1 +ALLOW_UNSIGNED=1 scripts/package-pkg.sh /tmp/oab-instance-mcp.app /tmp/oab-instance-mcp.pkg 0.6.1 ``` Unsigned artifacts are testing inputs only; do not install or publish them.