duplicati/ReleaseBuilder/Resources/MacOS/AppBundle/daemon-scripts/preinstall
Kenneth Skovhede 250bea997c Updated launchagent installs on MacOS.
This changes the way launchagents are installed via `.pkg` files.

The installers are updated to no longer use `launchtctl load` but rely on `launchctl bootstrap` instead to load in the current user context.

For the Agent, this fixes a problem where the installer would initially start in a root context.
For the GUI package this changes to not rely on `open` to start Duplicati, as that appears to be incompatible with `bootstrap`
The uninstallers are updated handle both `load` / `unload` and `bootstrap` / `bootout` before removing the launchagents.

This fixes #5766
2024-12-13 09:55:25 +01:00

12 lines
341 B
Bash
Executable file

#!/bin/bash
set +e
# Identify the user installing the package
USER=$(stat -f%Su /dev/console)
if [ -f "/Library/LaunchAgents/com.duplicati.app.launchagent.plist" ]; then
/bin/launchctl bootout gui/$(id -u "$USER")/com.duplicati.app.launchagent
/bin/launchctl unload "/Library/LaunchAgents/com.duplicati.app.launchagent.plist"
fi