-
Notifications
You must be signed in to change notification settings - Fork 0
Example Automation Code
Chris Lasell edited this page Oct 5, 2025
·
2 revisions
Here's some bash/zsh code, which could be turned into a script, or executed manually by pasting into a terminal.
This code shows how you can automate building a distribution package and adding it to xolo.
# Copyright 2025 Pixar
#
# Licensed under the terms set forth in the LICENSE.txt file available at
# at the root of the Xolo project.
XOLO_TITLE='xolodemo'
# Update this as needed each time you build the pkg
CURRENT_VERSION='1.0.0'
APP_BNDL_NAME='XoloDemo'
APP_BNDL_ID='com.mycompany.xolodemo'
APP_NAME="$APP_BNDL_NAME.app"
PROJ_DIR='/Users/myuser/Desktop/XoloDemo/xolodemo'
PKG_ROOT_DIR="$PROJ_DIR/pkg-root"
DUMMY_APP="$PKG_ROOT_DIR/Applications/$APP_NAME"
INFO_PLIST="$DUMMY_APP/Contents/Info.plist"
# The signing certs must be in the login keychain
# or some other unlocked keychain.
# If in another keychain, use `--keychain /path/to/keychain` with
# codesign, pkgbuild and productbuild
APP_SIGNING_IDENT="Developer ID Application: My Company (123A456B789)"
PKG_SIGNING_IDENT="Developer ID Installer: My Company (123A456B789)"
PKG_SCRIPTS_DIR="$PROJ_DIR/pkg-scripts"
PKG_ID="$APP_BNDL_ID"
COMPONENT_PLIST="$PROJ_DIR/xolodemo-component.plist"
COMPONENT_PKG="$PROJ_DIR/xolodemo-component.pkg"
DIST_PKG="$PROJ_DIR/xolodemo.pkg"
# Provide a good description
read -r -d '' DESCRIPTION <<'EODESC'
Here is a good example of a description.
XoloDemo is a software tool that does nothing directly. Instead
it exists to demonstrate deploying and maintaining software
using Xolo.
For more information, see
https://pixaranimationstudios.github.io/xolo-home/
EODESC
##### Add the title to Xolo
##### This os a one-time task
##### Once its done, remove it from this code.
########################################
# use --walkthru or -w to do this interactively
#
# xadm --walkthru add-title $XOLO_TITLE
#
/usr/local/bin/xadm add-title $XOLO_TITLE \
--display-name "$APP_BNDL_NAME" \
--description "$DESCRIPTION" \
--publisher 'My Company' \
--app-name "$APP_NAME" \
--app-bundle-id "$APP_BNDL_ID" \
--excluded-groups 'finance-macs' \
--excluded-groups 'hr-macs' \
--contact-email [email protected]
##### Build a package for the next version, which includes
##### the dummy app
########################################
# Clean up from last time
rm -f "$PROJ_DIR"/*.pkg "$PROJ_DIR"/*.plist
# Ensure the values in the dummy app are correct
/usr/libexec/PlistBuddy -c "set :CFBundleName $APP_BNDL_NAME" $INFO_PLIST
/usr/libexec/PlistBuddy -c "set :CFBundleIdentifier $APP_BNDL_ID" $INFO_PLIST
/usr/libexec/PlistBuddy -c "set :CFBundleShortVersionString $CURRENT_VERSION" $INFO_PLIST
# Sign the dummy app
# remove finder cruft before signing
xattr -d com.apple.FinderInfo "$DUMMY_APP" 2>/dev/null
/usr/bin/codesign \
--sign "$APP_SIGNING_IDENT" \
--force \
"$DUMMY_APP"
# remove other Finder droppings before packaging
find "$PKG_ROOT_DIR" -name '.DS_Store' -delete
# ensure embedded scripts are executable
chmod -R 700 "$PKG_SCRIPTS_DIR"/*
# make the component plist
# This is needed if your project contains a .app bundle,
# to insure that when the package is installed, the desired
# one gets updated, not the one in your project.
/usr/bin/pkgbuild --root "$PKG_ROOT_DIR" --analyze "$COMPONENT_PLIST"
# We do this by making the app not relocatable, so that when
# the pkg is installed on developer machines, where there are other copies
# of the app, only the correct one (in /Applications) gets updated.
/usr/libexec/PlistBuddy -c 'set :Dict:BundleIsRelocatable false' "$COMPONENT_PLIST"
# build the component pkg
/usr/bin/pkgbuild \
--root "$PKG_ROOT_DIR" \
--component-plist "$COMPONENT_PLIST" \
--identifier "$PKG_ID" \
--version "$CURRENT_VERSION" \
--scripts "$PKG_SCRIPTS_DIR" \
--sign "$PKG_SIGNING_IDENT" \
--install-location / \
"$COMPONENT_PKG"
# build the distribution package
# This is needed if you want to use `xadm deploy`
/usr/bin/productbuild --package "$COMPONENT_PKG" \
--identifier "$PKG_ID" \
--version $CURRENT_VERSION \
--sign "$PKG_SIGNING_IDENT" \
"$DIST_PKG"
##### Add the version to Xolo
########################################
# use --walkthru or -w to do this interactively
#
# xadm -w add-version $XOLO_TITLE $CURRENT_VERSION
/usr/local/bin/xadm add-version $XOLO_TITLE $CURRENT_VERSION \
--min-os 14 \
--pilot-groups 'chrisltest' \
--pkg-to-upload $DIST_PKG
##### If you need to fix a problem in the .pkg without bumping the version,
##### do so, and rebuild the .pkg as above.
##### Then re-upload it with
#####
##### /usr/local/bin/xadm edit-version $XOLO_TITLE $CURRENT_VERSION --pkg-to-upload $DIST_PKG
########################################
##### For the next round,
##### Update CURRENT_VERSION and repeat building the pkg and adding new version.
########################################