Mac Installer: I want to do something (popup dialog) in the postinstall script ONLY if it is an interactive installation. (not through MDM or command line)
How can I determine in my postinstall script if the installation is interactive or not?
Maybe will help to someone in the future:
There are 2 options: (one can combine those 2 options to have full solutions, depends on its needs)
In my case I just had to check if COMMAND_LINE_INSTALL exists, if not - it means that this is interactive installation.
IMPORTANT: this environment variable exist and value=1 ONLY in case of installation from terminal(command line).
During installation from MDM this variable doesn't exist
=========================================================================
From the post install script: run ps and check the existence of "/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer"
If it exists- it means the installation is interactive (via mac installer app).
The lines I used:
INSTALLER_APP_PATH ="/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer"
if ps aux | grep -v grep | grep -q "$INSTALLER_APP_PATH"
then
echo "Interactive installation"
else
echo "Not an interactive installation"
fi