mirror of
https://github.com/mas-cli/mas
synced 2024-11-28 22:40:24 +00:00
43 lines
1.2 KiB
Bash
Executable file
43 lines
1.2 KiB
Bash
Executable file
#!/bin/bash -e
|
|
#
|
|
# script/package
|
|
# mas
|
|
#
|
|
# Builds macOS installer component and distribution packages.
|
|
#
|
|
|
|
BUILD_DIR="$PWD/.build"
|
|
COMPONENT_PACKAGE="$BUILD_DIR/mas_components.pkg"
|
|
DISTRIBUTION_PACKAGE="$BUILD_DIR/mas.pkg"
|
|
|
|
IDENTIFIER="com.mphys.mas-cli"
|
|
|
|
# Distribution package definition
|
|
# https://developer.apple.com/library/archive/documentation/DeveloperTools/Reference/DistributionDefinitionRef/Chapters/Distribution_XML_Ref.html
|
|
DISTRIBUTION_PLIST="Package/Distribution.plist"
|
|
|
|
# Destination for install root
|
|
DSTROOT=.build/distributions
|
|
script/install "$DSTROOT/usr/local" --universal
|
|
|
|
VERSION=$(script/version)
|
|
|
|
echo "==> 📦 Assemble an installer package"
|
|
|
|
# Assemble macOS installer component package (aka "product archive").
|
|
pkgbuild \
|
|
--identifier "$IDENTIFIER" \
|
|
--install-location "/" \
|
|
--version "$VERSION" \
|
|
--root "$DSTROOT" \
|
|
"$COMPONENT_PACKAGE"
|
|
|
|
# Build distribution package (aka "product archive"). Not sure why, but this is how Carthage does it.
|
|
# https://github.com/Carthage/Carthage/blob/master/Makefile#L69
|
|
productbuild \
|
|
--distribution "$DISTRIBUTION_PLIST" \
|
|
--package-path "$BUILD_DIR" \
|
|
"$DISTRIBUTION_PACKAGE"
|
|
|
|
echo "==> 🔢 File Hash"
|
|
shasum -a 256 "$DISTRIBUTION_PACKAGE"
|