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
How to force RPM to install files in a single directory, Is it possible?
提问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 --relocate
to change 1 directory of the install process
您可以使用--relocate
更改安装过程的 1 个目录
rpm -i --relocate /usr/sbin=/some/other/path/sbin packagename.rpm
or use --prefix
for 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