Enhance Installer Compatibility with Automated MDM Deployments
In enterprise environments utilizing MDM solutions like Jamf Pro for macOS device management, software installations often occur during automated workflows such as PreStage enrollment. These installations run in a root context without an active user session. 
Currently, the DisplayLink Manager installer includes a post-installation script that attempts to launch the application using:
currentuser=$(/usr/bin/stat -f %Su /dev/console)
launchctl asuser $(/usr/bin/id -u "$currentuser") /usr/bin/open "/Applications/DisplayLink Manager.app"
This approach fails when no user is logged in, leading to installation errors in automated deployment scenarios.
Proposed Enhancement:
Modify the post-installation script to check for an active user session before attempting to launch the application. For example:
currentuser=$(/usr/bin/stat -f %Su /dev/console)
if [[ "$currentuser" != "root" && -n "$currentuser" ]]; then
launchctl asuser $(/usr/bin/id -u "$currentuser") /usr/bin/open "/Applications/DisplayLink Manager.app"
else
echo "No active user session detected; skipping application launch."
fi
Implementing this check would prevent installation failures during automated deployments and improve compatibility with MDM-managed environments.
