Update postinstall to use more modern launchctl commands (#4179)

* Update postinstall to use more modern launchctl comamnds

Fixes #3995

* Switching to service-target specifier

* Removing unnecessary kill flag
This commit is contained in:
Nate Felton 2022-02-16 06:31:16 -05:00 committed by GitHub
parent ed41c2a445
commit bb0b56acb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -0,0 +1 @@
* Update macOS package postinstall script to use more modern `launchctl` commands.

View file

@ -37,8 +37,17 @@ ln -sf /var/lib/orbit/bin/orbit/macos/{{.OrbitChannel}}/orbit /var/lib/orbit/bin
ln -sf /var/lib/orbit/bin/orbit/orbit /usr/local/bin/orbit
{{ if .StartService -}}
launchctl unload /Library/LaunchDaemons/com.fleetdm.orbit.plist
launchctl load -w /Library/LaunchDaemons/com.fleetdm.orbit.plist
DAEMON_LABEL="com.fleetdm.orbit"
DAEMON_PLIST="/Library/LaunchDaemons/${DAEMON_LABEL}.plist"
# Remove any pre-existing version of the config
launchctl bootout "system/${DAEMON_LABEL}"
# Add the daemon to the launchd system
launchctl bootstrap system "${DAEMON_PLIST}"
# Enable the daemon
launchctl enable "system/${DAEMON_LABEL}"
# Force the daemon to start
launchctl kickstart "system/${DAEMON_LABEL}"
{{- end }}
`))