Linux 如何强制 RPM 在单个目录中安装文件,这可能吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13738970/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 17:58:47  来源:igfitidea点击:

How to force RPM to install files in a single directory, Is it possible?

linuxinstallrpm

提问by Jasper

rpm install command, installs files all over the place like: /usr/bin, /usr/sbin, /etc/, /usr/share

rpm install 命令,将文件安装到所有地方,例如:/usr/bin、/usr/sbin、/etc/、/usr/share

This way it's hard to figure out all the contents of the installation. Is it possible to force rpm to install everything in a single directory?

这样就很难弄清楚安装的所有内容。是否可以强制 rpm 将所有内容安装在单个目录中?

采纳答案by phschoen

you can use the --relocateto change 1 directory of the install process

您可以使用--relocate更改安装过程的 1 个目录

rpm -i --relocate /usr/sbin=/some/other/path/sbin packagename.rpm

or use --prefixfor the whole installation process

--prefix用于整个安装过程

rpm  -i --prefix=/some/other/path/ packagename.rpm

回答by Aaron D. Marasco

As noted elsewhere, don't do that.

正如其他地方所指出的,不要那样做

However, if you want to see what files will be installed where:

但是,如果您想查看将安装哪些文件:

rpm -qlp packagename.rpm

If you want to extract them to a different root to examine them (e.g. look at configuration files, etc), in a temporary directory:

如果要将它们解压缩到不同的根目录以检查它们(例如查看配置​​文件等),请在临时目录中:

rpm2cpio packagename.rpm | cpio -div