1

我正在开发像 cocoa 应用程序这样的“安装”,它需要处理一些 http 请求、一些文件系统读取、将文件复制到 /usr/share、设置 cron(不是启动)并向用户询问一些信息。我放弃了 PackageMaker,因为我需要更多的灵活性。

目前一切进展顺利,但在我的最后一个安装步骤中,我需要:

  • 删除我之前安装的应用程序文件夹(如果存在)。它总是相同的路径:/usr/share/MY_APP
  • 再次在以下位置创建应用程序文件夹:/usr/share/MY_APP
  • 将应用程序文件复制到 /usr/share/MY_APP
  • 更新 cron 作业

/usr/share/MY_APP 受到管理权限的保护是非常重要的,所以普通人不应该删除它。

实施这些步骤的最佳方法是什么?

顺便说一句,我使用的是 Xcode 3.2。

非常感谢!卡洛斯。

4

1 回答 1

2

Between the preflight script, the postflight script, and perhaps an Installer plug-in for the custom UI, I see no reason why you can't do all of this in PackageMaker.

Note: “Installer plug-in” is a little misleading. The user does not have to install the plug-in somewhere as a separate step; you include the plug-in inside your package, and Installer will use it from there.

The relevant document is a ReadMe file in a sample code project. There's also an Installer plug-in project template in Xcode since 2.0.

Also, an Installer plug-in won't get used if the user does a command-line installation. Of course, they can't install from the command line at all (which includes remote installation onto an office or lab full of machines) if you write your own custom installer.

By the way: Why /usr/share? What are you putting there? There may be a better way to do what you're really trying to accomplish.

于 2010-03-27T14:27:33.673 回答