简体   繁体   English

如何确定我的软件包是否在平面软件包安装后脚本中升级?

[英]How can I tell if my package is being upgraded in a flat package postinstall script?

I have a Mac OS X flat package that runs a postinstall script. 我有一个运行后安装脚本的Mac OS X Flat软件包。 I would like to know in the script if it's a new install or an upgrade. 我想在脚本中知道这是新安装还是升级。 Bundle-style packages have pre and postupgrade scripts but I can't use a bundle package. 捆绑包样式的软件包具有升级前和升级后的脚本,但是我不能使用捆绑包。

I've dumped out the environment variables in the script and I've dumped the arguments to the script itself and none of these seem to indicate if it's an upgrade or install. 我已经转储了脚本中的环境变量,并且已将参数转储到了脚本本身,但这些参数似乎都没有表明它是升级还是安装。 I can tell that Installer knows because the Installer Log indicates install or upgrade. 我可以说安装程序知道,因为安装程序日志指示安装或升级。 I just don't know how to tell from the postinstall script. 我只是不知道如何从安装后脚本中分辨出来。

If it's your package, why don't you check for signs that you're already on the machine? 如果是您的包裹,为什么不检查是否已经在机器上呢? Either leave some marker that will tell you that you've already been installed or check if your old files are present on the disk before deployment? 留下一些标记来告诉您已经安装了,还是在部署之前检查磁盘上是否存在旧文件?

If your package is installed for the first time Installer will call postinstall script but if it is upgraded, it should call postupgrade script. 如果您的软件包是首次安装,则安装程序将调用安装后脚本,但如果已升级,则应调用升级后脚本。

More information here in the What About script section. 更多信息这里什么关于脚本部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM