[英]Mac Installer : How to determine if pkg installation is intercative
Mac Installer: I want to do something (popup dialog) in the postinstall script ONLY if it is an interactive installation. Mac 安装程序:仅当它是交互式安装时,我才想在安装后脚本中执行某些操作(弹出对话框)。 (not through MDM or command line)
(不是通过 MDM 或命令行)
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)有 2 个选项:(可以将这 2 个选项结合起来以获得完整的解决方案,具体取决于其需求)
In my case I just had to check if COMMAND_LINE_INSTALL exists, if not - it means that this is interactive installation.就我而言,我只需要检查 COMMAND_LINE_INSTALL 是否存在,如果不存在 - 这意味着这是交互式安装。
IMPORTANT: this environment variable exist and value=1 ONLY in case of installation from terminal(command line).重要提示:仅在从终端(命令行)安装的情况下,此环境变量存在且值=1。
During installation from MDM this variable doesn't exist从 MDM 安装期间,此变量不存在
========================================================================= ================================================== ========================
From the post install script: run ps and check the existence of "/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer"从安装后脚本:运行 ps 并检查“/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer”是否存在
If it does - it means the installation is interactive (via mac installer app).如果是 - 这意味着安装是交互式的(通过 mac 安装程序应用程序)。
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.