1

我正在尝试为我们的产品创建一个包安装程序。以前我们使用 .dmg 安装,过程只是将其拖到 /Applications 文件夹。现在我们希望它安装到 /Application/Company/Suite/product。

问题是:如果我们在以前安装了我们的产品的系统上使用 .pkg 安装程序,它会创建文件夹,但会在旧位置安装产品。

如何使 pkg 安装程序执行以下操作:

  1. 删除旧版本
  2. 将新版本安装到适当的位置

我对 OSX 的经验很少 - 所以也许我只是错过了一些东西?还要查看应用程序文件夹-似乎没有将其他任何东西安装到子目录中,以这种方式做事是否不寻常?谢谢!

编辑:我正在查看位于此处的答案OSX .pkg 安装程序有时不安装 .app 文件,不同措辞的问题 - 但答案可能正是我所需要的。

EDIT2:OSX .pkg 安装程序有时不安装 .app 文件不适用。我们没有使用任何包管理器安装 - 所以没有以前的条目。

EDIT3:我们正在使用dmg,但现在正在转向pkg

4

1 回答 1

0

So I found the answer.

In order to have it install to a new location: The plist inside the app package (product.app/Contents/Info.plist) has an identifier "CFBundleIdentifier", these needs to be different from the old application. For instance ours was "Company.Product-Name", I've changed it to "Company.Product.Name". This will allow the new installation to go to the new location.

In order to remove the old installation: I simply added this line to the preinstall script: "sudo rm -Rf '/Application/Product Name.app'"

Thank you for your assistance.

于 2014-10-23T21:53:57.393 回答