Relocate MunkiStatus.app and Munki-notifier.app to ../Contents/Helpers/ from ../Contents/Resources/ - Munki6dev base (#1207)

* Relocate MunkiStatus.app and Munki-notifier.app to ../Contents/Helpers/ from ../Contents/Resources/

- Updated location of munki-notifier in code/apps/Managed Software Center/Managed Software Center/Controllers/MainWindowController.swift
- Added code/client/installhelper script
- Amended code/tools/make_munki_mpkg.sh with new locations for munki-notifier and MunkiStatus as well as changes required to leverage `installhelper`
- Amended code/tools/pkgresources/Scripts_app_usage/postinstall to leverage `installhelper`
- Deleted code/tools/pkgresources/Scripts_app_usage/preinstall as the actions within should be handled now by `installhelper`
- Amended code/tools/pkgresources/Scripts_launchd/postinstall to leverage `installhelper`
- Amended launchd/LaunchAgents/com.googlecode.munki.munki-notifier.plist to use the new path to munki-notifier.app
- Amended launchd/LaunchAgents/com.googlecode.munki.MunkiStatus.plist to use the new path to MunkiStatus.app

This is a resubmission of https://github.com/munki/munki/pull/1203, which needed it's base branch changing from `main` to `Munki6dev`

* Update installhelper

 - Removed CHECK_TIME global - 374fbaf922 (r1515000516)
- Remove erroneous login window comments - 374fbaf922 (r1515006835) and 374fbaf922 (r1515006962)
- Simplified IF condition - 374fbaf922 (r1515005565) this was in place incase LimitLoadToSessionType contained multiple values (as it can).

* Update installhelper

- Reverted changes made for - 374fbaf922 (r1515005565)
- Changed constant/global PASSED_ARG to local: launchd_group - https://github.com/munki/munki/pull/1207#discussion_r1515002646 and https://github.com/munki/munki/pull/1207#discussion_r1515002968

* Update installhelper

* Update installhelper

* Update installhelper

* Update installhelper

* Update make_munki_mpkg.sh

Amended so that the launchd pkg is installed by default
This commit is contained in:
macmule
2024-03-26 18:04:26 +00:00
committed by GitHub
parent 29fd72a80c
commit dc2725e4e7
8 changed files with 529 additions and 119 deletions

View File

@@ -1,22 +1,19 @@
#!/bin/sh
# Lovingly adapted from Per Olofsson
# https://github.com/MagerValp/Scripted-Mac-Package-Creation/blob/master/scripts/postinstall
#
# this postinstall should run installhelper in the background, with it then waiting until
# managedsoftwareupdate isn't running and then (re)load Munki's appusage launchditems items as needed
#
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Execute postinstall actions if we're installing on a live system.
# This is useful for loading launch daemons and agents.
if [ "$3" = "/" ]; then
# Run postinstall actions for root.
launchctl bootstrap system/ /Library/LaunchDaemons/com.googlecode.munki.appusaged.plist
# Run postinstall actions for all logged in users.
for uid in $(ps -axo uid,args | grep "/[F]inder.app/" | awk '{print $1}'); do
launchctl bootstrap gui/"$uid"/ /Library/LaunchAgents/com.googlecode.munki.app_usage_monitor.plist
done
fi
exit 0
# Only execute postinstall actions if we're installing on a live system.
if [ "$3" = "/" ]
then
installHelper='/usr/local/munki/installhelper'
if [ -f "${installHelper}" ]
then
/bin/echo "Loading ${installHelper}..."
"${installHelper}" appusage &
else
/bin/echo "Cannot locate: ${installHelper}..."
fi
fi

View File

@@ -1,29 +0,0 @@
#!/bin/sh
# Lovingly adapted from Per Olofsson
# https://github.com/MagerValp/Scripted-Mac-Package-Creation/blob/master/scripts/postinstall
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Execute preinstall actions if we're installing on a live system.
# This is useful for unloading launch daemons and agents.
if [ "$3" = "/" ]; then
# Run preinstall actions for root.
if launchctl print system/munki.app_usage_monitor > /dev/null 2>&1 ; then
launchctl bootout system/munki.app_usage_monitor
fi
if launchctl print system/com.googlecode.munki.appusaged. > /dev/null 2>&1 ; then
launchctl bootout system/com.googlecode.munki.appusaged
fi
# Run preinstall actions for all logged in users.
for uid in $(ps -axo uid,args | grep "/[F]inder.app/" | awk '{print $1}'); do
if launchctl print gui/"$uid"/com.googlecode.munki.app_usage_monitor > /dev/null 2>&1 ; then
launchctl bootout gui/"$uid"/com.googlecode.munki.app_usage_monitor
fi
done
fi
exit 0