OSX 安装程序更改安装目录
我得到了一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
大多数包管理器都包含用于重新定位(即更改其安装路径)包的选项,在基于 RPM 的 Linux 系统上
rpm
具有选项-relocate
,在 OS X 上,命令行工具installer
有选项-target
。但是,正如您所注意到的,您不能像使用
rpm
的-relocate-target
的参数。 code>-target
的参数仅限于(请参阅man installer
):卷安装点 (
/Volumes/HDD
) 、设备节点(/dev/disk0s5
) 或卷 UUID (376C4046-083E-334F-AF08-62FAFBC4E352
)。例如,
-dominfo
返回的任何值(例如LocalSystem
或CurrentUserHomeDirectory
)。你写:
如果是这种情况,则可以使用
-dominfo
查询该信息,如下所示:并且可以在从命令行安装时使用:(
我已经查询了几个
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 toolinstaller
has the option-target
.However, as you have noticed, you can't specify an arbitrary path as argument to
-target
, as you would do withrpm
's-relocate
The arguments to
-target
are limited to (seeman installer
):A volume mount point (
/Volumes/HDD
), device node (/dev/disk0s5
) or volume UUID (376C4046-083E-334F-AF08-62FAFBC4E352
).Any of the values returned by
-dominfo
(likeLocalSystem
orCurrentUserHomeDirectory
), for example.You write:
If that's the case, that information can probably be queried with
-dominfo
like this:and can be used when installing from the command line:
(I have queried several
pkg
files and all returnNoDomainsAvailable
, 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.您的问题很不清楚:如果您从 GUI 运行安装程序,并且只有一个驱动器可供安装,则您无法以一种简单的方式更改它(意味着:您必须对安装程序包进行更改才能安装在与默认提供的位置不同)。
由于您使用的是“cli”标签(命令行界面),我认为您试图不在 GUI 上运行安装程序,而是从终端运行它。您有更多选项:使用 -target 选项,您可以设置安装程序的安装路径。
-target-Option 手册页中的信息:
有关如何从终端 (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:
Additional informations on how to run an installer from the Terminal (cli), you will find on my blog.