Skip to content

Commit

Permalink
Seems like a gunzip cpio problem
Browse files Browse the repository at this point in the history
  • Loading branch information
graphemecluster committed Dec 17, 2024
1 parent 6461830 commit b6afd38
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions .ci/package-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

0 comments on commit b6afd38

Please sign in to comment.