mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-08 05:31:53 +00:00
implemented --pkg and --notarize options
This commit is contained in:
@@ -4,6 +4,18 @@ Since the Installomator.sh script has grown to over 3000 lines, its management o
|
||||
|
||||
The full script is assembled using the `utils/assemble.sh` tool. For convenience, there is a symbolic link in the root of the repository.
|
||||
|
||||
## Fragments
|
||||
|
||||
These are the fragments in the order they are assembled:
|
||||
|
||||
- header.sh
|
||||
- version.sh
|
||||
- functions.sh
|
||||
- arguments.sh
|
||||
- (optiona) all labels from locations given with the ``--labels` argument
|
||||
- labels/*.sh
|
||||
- main.txt
|
||||
|
||||
## assemble.sh Usage
|
||||
|
||||
```
|
||||
@@ -53,14 +65,4 @@ assemble.sh --notarize
|
||||
|
||||
Build the full script, disable Debug mode, sign it, build a signed pkg, and send it to notarization.
|
||||
|
||||
## The Fragments
|
||||
|
||||
These are the fragments in the order they are assembled:
|
||||
|
||||
- header.txt
|
||||
- version.txt
|
||||
- functions.txt
|
||||
- arguments.txt
|
||||
- all labels from locations given with the ``--labels` argument
|
||||
- labels/*.txt
|
||||
- main.txt
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
#!/bin/zsh
|
||||
|
||||
# settings
|
||||
|
||||
# package
|
||||
pkgname="Installomator"
|
||||
identifier="com.scriptingosx.${pkgname}"
|
||||
install_location="/usr/local/Installomator/"
|
||||
signature="Developer ID Installer: Armin Briegel (JME5BW3F3R)"
|
||||
|
||||
# notarization
|
||||
dev_team="JME5BW3F3R" # asc-provider
|
||||
dev_account="developer@scriptingosx.com"
|
||||
dev_keychain_label="notary-scriptingosx"
|
||||
|
||||
# parse arguments
|
||||
|
||||
zparseopts -D -E -a opts r -run s -script p -pkg n -notarize h -help -labels+:=label_args l+:=label_args
|
||||
@@ -113,9 +126,61 @@ fi
|
||||
if [[ $buildScript -eq 1 ]]; then
|
||||
echo "# copying script to $repo_dir/Installomator.sh"
|
||||
cp $destination_file $repo_dir/Installomator.sh
|
||||
chmod 755 $repo_dir/Installomator.sh
|
||||
fi
|
||||
|
||||
# TODO: build a pkg when flag is set
|
||||
# build a pkg when flag is set
|
||||
if [[ buildPkg -eq 1 ]]; then
|
||||
echo "# building installer package"
|
||||
|
||||
tmpfolder=$(mktemp -d)
|
||||
payloadfolder="${tmpfolder}/payload"
|
||||
|
||||
# TODO: notarize when flag is set
|
||||
# create a projectfolder with a payload folder
|
||||
if [[ ! -d "${payloadfolder}" ]]; then
|
||||
mkdir -p "${payloadfolder}"
|
||||
fi
|
||||
|
||||
# copy the script file
|
||||
cp $repo_dir/Installomator.sh ${payloadfolder}
|
||||
chmod 755 ${payloadfolder}/Installomator.sh
|
||||
|
||||
# set the DEBUG variable to 0
|
||||
sed -i '' -e 's/^DEBUG=1$/DEBUG=0/g' ${payloadfolder}/Installomator.sh
|
||||
|
||||
# build the component package
|
||||
pkgpath="${script_dir}/${pkgname}.pkg"
|
||||
|
||||
pkgbuild --root "${payloadfolder}" \
|
||||
--identifier "${identifier}" \
|
||||
--version "${version}" \
|
||||
--install-location "${install_location}" \
|
||||
"${pkgpath}"
|
||||
|
||||
# build the product archive
|
||||
|
||||
productpath="${repo_dir}/${pkgname}-${version}.pkg"
|
||||
|
||||
productbuild --package "${pkgpath}" \
|
||||
--version "${version}" \
|
||||
--identifier "${identifier}" \
|
||||
--sign "${signature}" \
|
||||
"${productpath}"
|
||||
|
||||
# clean up project folder
|
||||
rm -Rf "${projectfolder}"
|
||||
# clean the component pkgname
|
||||
rm "$pkgpath"
|
||||
fi
|
||||
|
||||
# notarize when flag is set
|
||||
if [[ $notarizePkg -eq 1 ]]; then
|
||||
# NOTE: notarytool requires Xcode 13
|
||||
|
||||
# upload for notarization
|
||||
xcrun notarytool submit "$productpath" --keychain-profile "$dev_keychain_label" --wait
|
||||
|
||||
# staple result
|
||||
echo "# Stapling $productpath"
|
||||
xcrun stapler staple "$productpath"
|
||||
fi
|
||||
Reference in New Issue
Block a user