#!/bin/bash # Create macOS installation packages. # Based on bomutils tutorail: http://bomutils.dyndns.org/tutorial.html cd $(dirname $0) [ -r ../src/VERSION ] && VERSION="$(cat ../src/VERSION)" || VERSION="1.1.0" AUTHOR="OpenGnsys Project" # Create empty directories. rm -fr build mkdir -p build && cd build mkdir -p flat/base.pkg flat/Resources/en.lproj mkdir -p root/Applications # Copy application and script files. cp -a ../../src root/Applications/OGAgent.app cp -a ../scripts . # Create plist file. cat << EOT > root/Applications/OGAgent.app/OGAgent.plist BuildAliasOf OGAgent BuildVersion $VERSION $AUTHOR EOT # Add files in the base package. ( cd root && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > flat/base.pkg/Payload # Create PackageInfo file. cat << EOT > flat/base.pkg/PackageInfo EOT # Compress the scripts folder. ( cd scripts && find . | cpio -o --format odc --owner 0:80 | gzip -c ) > flat/base.pkg/Scripts # Create BOM file. mkbom -u 0 -g 80 root flat/base.pkg/Bom # Create Distribution file. cat << EOT > flat/Distribution OGAgent $VERSION #base.pkg EOT # Create new Xar application archive. rm -f ../../../OGAgentInstaller-$VERSION.pkg ( cd flat && xar --compression none -cf "../../../OGAgentInstaller-$VERSION.pkg" * )