简体   繁体   English

如何从OSX .pkg强制安装位置

[英]How to Force install location from OSX .pkg

I'm attempting to create a package installer for our product. 我正在尝试为我们的产品创建软件包安装程序。 Previously we installed with a .dmg, and the process was to just drag it to the /Applications folder. 以前我们安装了.dmg,然后将其拖到/ Applications文件夹中。 Now we want it to install to /Application/Company/Suite/product. 现在,我们希望它安装到/ Application / Company / Suite / product。

Problem is: If we use the .pkg installer on a system that previously had our product installed it creates the folders, but installs the product over the old location. 问题是:如果我们在以前安装了产品的系统上使用.pkg安装程序,则会创建文件夹,但会在旧位置上安装产品。

How can I make the pkg installer do the following: 如何使pkg安装程序执行以下操作:

  1. Remove the old version 删除旧版本
  2. Install new version to proper location 将新版本安装到正确的位置

I've had very little experience with OSX - so maybe I'm just missing something? 我对OSX的经验很少-也许我只是缺少一些东西? Also looking in the applications folder - it doesn't appear that anything else is installed to a subdirectory, is it unusual to do things this way? 还要在Applications文件夹中查找-子目录中似乎没有安装其他任何东西,以这种方式进行操作是否异常? Thank you! 谢谢!

EDIT: I'm looking into the answers located here OSX .pkg installer sometimes does not install .app file , differently worded problem - but the answer might be just what I need. 编辑:我正在寻找位于这里的答案OSX .pkg安装程序有时不安装.app文件 ,即措辞不同的问题-但答案可能正是我需要的。

EDIT2: OSX .pkg installer sometimes does not install .app file Does not apply. EDIT2: OSX .pkg安装程序有时不安装.app文件不适用。 We didn't install with any package manager - so there isn't a previous entry. 我们没有安装任何软件包管理器-因此没有上一个条目。

EDIT3: We were using dmg , but are now moving to pkg . EDIT3:我们正在使用dmg ,但是现在正在使用pkg

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. 为了将其安装到新位置:应用程序包(product.app/Contents/Info.plist)中的plist具有标识符“ CFBundleIdentifier”,这些标识符必须与旧的应用程序不同。 For instance ours was "Company.Product-Name", I've changed it to "Company.Product.Name". 例如我们的名称为“ Company.Product-Name”,我将其更改为“ 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'" 为了删除旧的安装:我仅将以下行添加到预安装脚本中:“ sudo rm -Rf'/ Application / Product Name.app'”

Thank you for your assistance. 谢谢您的帮助。

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

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