Update pkg pre and postinstall scripts to use os version comparision compatible with Big Sur

This commit is contained in:
Greg Neagle
2021-01-19 09:46:18 -08:00
parent ae28a71550
commit 053e3eac9e
4 changed files with 8 additions and 8 deletions

View File

@@ -13,11 +13,11 @@ if [ "$3" == "/" ]; then
launchctl load /Library/LaunchDaemons/com.googlecode.munki.appusaged.plist
# Run postinstall actions for all logged in users.
os_major_version=$(sw_vers -productVersion | cut -d. -f2)
os_build_version=$(sw_vers -buildVersion | cut -b 1-2)
for pid_uid in $(ps -axo pid,uid,args | grep -i "[l]oginwindow.app" | awk '{print $1 "," $2}'); do
pid=$(echo $pid_uid | cut -d, -f1)
uid=$(echo $pid_uid | cut -d, -f2)
if [[ $os_major_version -lt 10 ]] ; then
if [[ $os_build_version -lt 14 ]] ; then
launchctl bsexec "$pid" chroot -u "$uid" / launchctl load /Library/LaunchAgents/com.googlecode.munki.app_usage_monitor.plist
else
launchctl asuser "$uid" launchctl load /Library/LaunchAgents/com.googlecode.munki.app_usage_monitor.plist