Skip to content

Instantly share code, notes, and snippets.

@stevewood-tx
Created August 31, 2021 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevewood-tx/461ac4d7db4f52e9b7e3df603f897cd3 to your computer and use it in GitHub Desktop.
Save stevewood-tx/461ac4d7db4f52e9b7e3df603f897cd3 to your computer and use it in GitHub Desktop.
Package Build Script - Signed Distribution Package
#!/bin/bash
args=("$@")
pkgName="${args[0]}"
echo "Supply the package name and version: build.sh <pkgname> <version>"
# get date for package name
myDate=`date +%Y%m%d`
# Name of the package.
NAME="${pkgName}"
# Once installed the identifier is used as the filename for a receipt files in /var/db/receipts/.
IDENTIFIER="com.omnicom.$NAME"
# Package version number.
VERSION="${args[1]}"
# Remove any unwanted .DS_Store files.
find ROOT/ -name '*.DS_Store' -type f -delete
find scripts/ -name '*.DS_Store' -type f -delete
# Build package.
/usr/bin/pkgbuild \
--root ROOT/ \
--scripts scripts/ \
--identifier "$IDENTIFIER" \
--version "$VERSION" \
"Output/$NAME-$VERSION-$myDate.pkg"
# Build Distribution Package
/usr/bin/productbuild \
--package "Output/$NAME-$VERSION-$myDate.pkg" \
"Output/$NAME-$VERSION-$myDate-dist.pkg"
productsign --sign '<INSERT YOUR CERTIFICATE NAME>' "Output/$NAME-$VERSION-$myDate-dist.pkg" "Output/$NAME-$VERSION-$myDate-dist-signed.pkg"
@stevewood-tx
Copy link
Author

You need the Name of your signing certificate. You can find this by looking in Keychain Access and copying the name of the certificate. Paste that on line 30 above where it says "".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment