Created
August 31, 2021 14:41
-
-
Save stevewood-tx/461ac4d7db4f52e9b7e3df603f897cd3 to your computer and use it in GitHub Desktop.
Package Build Script - Signed Distribution Package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 "".