OSX 安装程序更改安装目录

发布于 2024-12-09 17:53:52 字数 612 浏览 1 评论 0原文

我得到了一个 pkg 文件,在使用 UI 启动时我可以在其中更改安装目录,但安装程序的联机帮助页仅提到要安装到的目标驱动器。

调用安装程序时是否需要设置环境变量?

关于目标选项,来自安装程序帮助:

The -target <device> parameter is any one of the following:

(1) One of the domains returned by -dominfo.
(2) Device node entry.  Any entry of the form of /dev/disk*.
      ex: /dev/disk2
(3) The disk identifier.  Any entry of the form of disk*.  ex: disk1s9
(4) Volume mount point.  Any entry of the form of /Volumes/Mountpoint.
      ex: /Volumes/Untitled
(5) Volume UUID.  ex: 376C4046-083E-334F-AF08-62FAFBC4E352

所以目标是一个“硬盘驱动器”,而不是应安装 pkg 的“根路径”。

I got a pkg file in which I can change the installation directory when launched using the UI, but the manpage of installer only mention the target drive to install to.

Is there an environement variable to set when calling the installer ?

About the target options, from installer help :

The -target <device> parameter is any one of the following:

(1) One of the domains returned by -dominfo.
(2) Device node entry.  Any entry of the form of /dev/disk*.
      ex: /dev/disk2
(3) The disk identifier.  Any entry of the form of disk*.  ex: disk1s9
(4) Volume mount point.  Any entry of the form of /Volumes/Mountpoint.
      ex: /Volumes/Untitled
(5) Volume UUID.  ex: 376C4046-083E-334F-AF08-62FAFBC4E352

So target is a "hard drive", not the "root path" where the pkg should be installed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦幻的心爱 2024-12-16 17:53:52

大多数包管理器都包含用于重新定位(即更改其安装路径)包的选项,在基于 RPM 的 Linux 系统上 rpm 具有选项 -relocate,在 OS X 上,命令行工具installer有选项-target

但是,正如您所注意到的,您不能像使用 rpm-relocate-target 的参数。 code>

-target 的参数仅限于(请参阅 man installer):

  1. 卷安装点 (/Volumes/HDD) 、设备节点(/dev/disk0s5) 或卷 UUID (376C4046-083E-334F-AF08-62FAFBC4E352)。

  2. 例如,-dominfo 返回的任何值(例如 LocalSystemCurrentUserHomeDirectory)。

你写:

我有一个 pkg 文件,可以在其中更改安装目录
使用 UI 启动

如果是这种情况,则可以使用 -dominfo 查询该信息,如下所示:

installer -verbose -dominfo -pkg <path to your package>

并且可以在从命令行安装时使用:(

installer -pkg <path to your package> -target <dominfo as listed above>

我已经查询了几个 pkg 文件,并且全部返回 NoDomainsAvailable,因此无法分享任何经验。)

但请记住,您不能任意重新定位 pkg文件。原因是包中包含的配置文件、二进制文件和库通常指定或依赖于绝对路径。

包生成器必须主动将它们转换为相对路径(使用安装后脚本和技术,例如 @rpath)。因此,一般来说,您只能重新定位在构建时考虑到重定位的软件包

Most package managers include options to relocate (that is, change the installation path of) a package, on RPM-based Linux systems rpm has the option -relocate, on OS X, command line tool installer has the option -target.

However, as you have noticed, you can't specify an arbitrary path as argument to -target, as you would do with rpm's -relocate

The arguments to -target are limited to (see man installer):

  1. A volume mount point (/Volumes/HDD), device node (/dev/disk0s5) or volume UUID (376C4046-083E-334F-AF08-62FAFBC4E352).

  2. Any of the values returned by -dominfo (like LocalSystem or CurrentUserHomeDirectory), for example.

You write:

I got a pkg file in which I can change the installation directory when
launched using the UI

If that's the case, that information can probably be queried with -dominfo like this:

installer -verbose -dominfo -pkg <path to your package>

and can be used when installing from the command line:

installer -pkg <path to your package> -target <dominfo as listed above>

(I have queried several pkg files and all return NoDomainsAvailable, so can't share any experience.)

Keep in mind that, though, you can't arbitrarily relocate a pkg file. The reason is that configuration files, binaries and libraries included in the package usually specify or depend on absolute paths.

The package builder must actively convert those into relative paths (using postinstallation scripts and techniques like @rpath). So, generally speaking, you can only relocate a package that has been built with relocation in mind.

旧人九事 2024-12-16 17:53:52

您的问题很不清楚:如果您从 GUI 运行安装程序,并且只有一个驱动器可供安装,则您无法以一种简单的方式更改它(意味着:您必须对安装程序包进行更改才能安装在与默认提供的位置不同)。

由于您使用的是“cli”标签(命令行界面),我认为您试图不在 GUI 上运行安装程序,而是从终端运行它。您有更多选项:使用 -target 选项,您可以设置安装程序的安装路径。

-target-Option 手册页中的信息:

目标卷通过 -target 参数指定( -tgt 为
被接受为同义词)。安装程序时必须已安装
命令被调用。

有关如何从终端 (cli) 运行安装程序的其他信息,您可以在我的 博客

Your question is quite unclear: If you run the installer from the GUI and there is only one drive offered to install to, you can not change it in an easy way (means: you have to make changes to the installer package to install in a different location than offered by default).

Since you are using the "cli"-Tag (command line interface), I think you are trying to run the installer not on the GUI, instead you are running it from the terminal. There you have more options: With the -target option, you can set the installpath for your installer.

Information from the man-pages on the -target-Option:

The target volume is specified with the -target parameter ( -tgt is
accepted as a synonym). It must already be mounted when the installer
command is invoked.

Additional informations on how to run an installer from the Terminal (cli), you will find on my blog.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文