diff --git a/.ci/package-mac.sh b/.ci/package-mac.sh index 48263d0..59ade2e 100644 --- a/.ci/package-mac.sh +++ b/.ci/package-mac.sh @@ -16,11 +16,11 @@ set -e # Modify the package with the solution from https://stackoverflow.com/a/11299907 # First, download the package and extract it wget https://github.com/rime/squirrel/releases/download/${SQUIRREL_VERSION}/Squirrel-${SQUIRREL_VERSION}.pkg -pkgutil --expand Squirrel-${SQUIRREL_VERSION}.pkg package pushd package +xar -xf ../Squirrel-${SQUIRREL_VERSION}.pkg # Extract the application -tar -xzf Payload +cat Payload | gunzip -dc | cpio -i pushd Squirrel.app/Contents # Remove all default rime schemas but keep opencc data and app config @@ -31,33 +31,19 @@ cp -rf "$SCHEMA_DIR/"* SharedSupport popd # Resign the application -for binary in $(codesign -v -vv --deep --strict Squirrel.app 2>&1 | sed -n 's/^--validated://p') Squirrel.app; do - echo "----------" - echo "Signing $binary" - codesign --sign "Developer ID Application: $APPLE_DEVELOPER_NAME ($APPLE_DEVELOPER_TEAM_ID)" -vvvvvv --timestamp --force --options runtime --preserve-metadata=identifier,entitlements "$binary" - - echo - codesign -v -vv --deep --strict "$binary" -done +codesign --sign "Developer ID Application: $APPLE_DEVELOPER_NAME ($APPLE_DEVELOPER_TEAM_ID)" --timestamp --deep --force --options runtime --preserve-metadata=identifier,entitlements Squirrel.app # Compress back the application find Squirrel.app | cpio -o | gzip -c > Payload mkbom Squirrel.app Bom rm -rf Squirrel.app -popd # Finally, compress back the package -mkdir output -pkgutil --flatten package output/Squirrel.pkg -cd output +mkdir ../output +xar -cf ../output/Squirrel.pkg * +popd # Resign the package +cd output pkg_path=Squirrel-${SQUIRREL_VERSION}-rime-cantonese.pkg productsign --sign "Developer ID Installer: $APPLE_DEVELOPER_NAME ($APPLE_DEVELOPER_TEAM_ID)" Squirrel.pkg "$pkg_path" - -# Verify -pkgutil --expand "$pkg_path" package -cd package - -tar -xzf Payload -codesign -v -vv --deep --strict "Squirrel.app"