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. 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"