Skip to content

Commit

Permalink
Extremely bad day
Browse files Browse the repository at this point in the history
  • Loading branch information
graphemecluster committed Dec 17, 2024
1 parent 1ddf3d0 commit 10bf057
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions .ci/package-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

0 comments on commit 10bf057

Please sign in to comment.