We have been using this script likely stolen from somewhere without source for a few years now to configure the nomad launch agent. The python bits need to be updated and unfortunately I don't know python which is making it a tad bit complicated to update. Any advice would be much appreciated.
**We are moving to JAMF connect later this year.
#!/bin/sh
## postinstall
#*=============================================================================
#*==============================å===============================================
#* REVISION HISTORY
#*=============================================================================
#* Date:
#* Author:
#* Solution:
#*=============================================================================
pathToScript=$0
pathToPackage=$1
targetLocation=$2
targetVolume=$3
loggedInUserPid=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; username = SCDynamicStoreCopyConsoleUser(None, None, None)[1]; print(username);')
launchctlCmd=$(python -c 'import platform; from distutils.version import StrictVersion as SV; print("asuser") if SV(platform.mac_ver()[0]) >= SV("10.10") else "bsexec"')
## Delete old preference files, is any
sudo rm -rfv "/Library/LaunchAgents/com.trusourcelabs.NoMAD.plist"
sudo rm -rfv "/Users/$ActiveUser/Library/Preferences/com.trusourcelabs.NoMAD.plist"
## Create launchdaemon
read -d '' launchAgent <<"EOF"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.trusourcelabs.NoMAD</string>
<key>LimitLoadToSessionType</key>
<array>
<string>Aqua</string>
</array>
<key>ProgramArguments</key>
<array>
<string>/Applications/NoMAD.app/Contents/MacOS/NoMAD</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOF
echo "$launchAgent" > /Library/LaunchAgents/com.trusourcelabs.NoMAD.plist
## Grant appropriate permissions for daemon
/usr/sbin/chown root:wheel /Library/LaunchAgents/com.trusourcelabs.NoMAD.plist
/bin/chmod 644 /Library/LaunchAgents/com.trusourcelabs.NoMAD.plist
## Load daemon
#log "Loading LaunchAgent..."
/bin/launchctl "$launchctlCmd" "$loggedInUserPid" /bin/launchctl load /Library/LaunchAgents/com.trusourcelabs.NoMAD.plist
open /Applications/NoMad.app
exit 0 ## Success
exit 1 ## Failure