diff --git a/.ci/package-mac.sh b/.ci/package-mac.sh index 0c2dcde..4c3935e 100644 --- a/.ci/package-mac.sh +++ b/.ci/package-mac.sh @@ -16,16 +16,15 @@ 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 # Extract the application -mkdir package -pushd package -xar -xf ../Squirrel-${SQUIRREL_VERSION}.pkg -cat Payload | gunzip -dc | cpio -i +tar --xattrs -xzf Payload +pushd Squirrel.app/Contents # Remove all default rime schemas but keep opencc data and app config # Then, download the latest schemas we need and amend the `default.yaml` -pushd Squirrel.app/Contents GLOBIGNORE=SharedSupport/squirrel.yaml rm SharedSupport/*.* cp -rf "$SCHEMA_DIR/"* SharedSupport @@ -35,16 +34,16 @@ popd 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 +tar --xattrs -czf Payload Squirrel.app mkbom Squirrel.app Bom rm -rf Squirrel.app +popd # Finally, compress back the package -mkdir ../output -xar -cf ../output/Squirrel.pkg * -popd +mkdir output +pkgutil --flatten package output/Squirrel.pkg +cd output # 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"