使用PackageMaker在安装时运行脚本 [英] Using PackageMaker to run a script on install

查看:173
本文介绍了使用PackageMaker在安装时运行脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我需要为其创建安装程序的应用程序,并且该安装程序需要做的所有工作(复制该应用程序除外)都运行一个脚本(或可执行文件),该脚本(或可执行文件)不属于该应用程序本身.我如何做到这一点有帮助吗?我在要求标签中看到了脚本结果操作,并且在操作中还有预安装操作 strong>标签,该标签具有打开文件操作.这些都可以做吗,还是我应该找别的地方?

I have an app I need to create an installer for, and all the installer needs to do (besides copying the app) is run a script (or executable) that is not part of the app itself. Any help on how I can do this? I see in the Requirements tab there is a Results of Script action, and there is also the Preinstall Actions in the Actions tab which has an Open File action. Will either of these do the job or should I be looking elsewhere?

推荐答案

此处是一个很好的方法

在安装过程中可以启动7种脚本:

There are 7 types of scripts than can be launched during the Installation Process:

安装检查: 该脚本在安装过程开始时启动(甚至在身份验证"步骤之前).可以用来检查该软件包是否可以安装在此计算机上.

InstallationCheck: This script is launched at the beginning of the installation process (even before the Authentication step). It can be used to check that the Package can be installed on this computer.

VolumeCheck: 该脚本在选择目标"步骤中启动.用于确定可以在哪个卷上安装该软件包.

VolumeCheck: This script is launched in the "Select Destination" step. It is used to determine on which volume the Package can be installed.

预检: 用户单击安装"按钮后,便会启动该脚本.

preflight: This script is launched just after the user clicked on the "Install" button.

预安装/预升级: 如果有此脚本,则在预检脚本之后启动该脚本(对于单个软件包安装而言);否则,将在预检脚本之后启动该脚本.否则,仅在用户单击安装"按钮之后.

preinstall / preupgrade: This script is launched after the preflight script if there's one (in the case of a single package installation); otherwise just after the user clicked on the "Install" button.

如您所见,这里有两种脚本.当从未安装过Package时(从Installer.app的角度来看),将启动预安装版本;如果已安装Package,则将启动预升级版本.为了确定软件包是否已经安装,Installer.app正在查看以下目录的内容:/Library/Receipts.如果其中有一个名为PackageName.pkg的文件,则表示该软件包已经安装,否则是第一次安装.

As you see, there's 2 types of scripts here. The preinstall one is launched when the Package has never been installed (from an Installer.app point of view), the preupgrade one is launched when the Package has already been installed. To determine whether a Package has already been installed or not, Installer.app is having a look at the content of the following directory: /Library/Receipts. If there's a file named PackageName.pkg within it, then the Package has already been installed, otherwise it's the first install.

安装后/升级后: 安装包中的文件后,将启动此脚本.请参阅(预安装/预升级)以查看启动了哪一个.

postinstall / postupgrade: This script is launched after the files in the package have been installed. See (preinstall / preupgrade) to see which one is launched.

飞行后: 此脚本是在postinstall/postupgrade脚本之后或在安装软件包后启动的.

postflight: This script is launched after the postinstall / postupgrade script or when the package has been installed.

这篇关于使用PackageMaker在安装时运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆