简体   繁体   English

将 RPM 解压到当前目录以外的目录

[英]Extract RPM to directory other than current directory

I am needing to run:我需要运行:

rpm2cpio mypackage.rpm | cpio -idmv

However, I need the output to be in a different directory.但是,我需要将输出放在不同的目录中。 Is there a more elegant solution than doing有没有比做更优雅的解决方案

mv <output> <to/other/directory>

after performing the extraction?执行提取后?

Since cpio is just reading from standard input, you can change to another directory before running it:由于cpio只是从标准输入读取,您可以在运行之前切换到另一个目录:

rpm2cpio mypackage.rpm | (cd /to/other/directory; cpio -idmv)

This is a general solution that will work with a variety of tools.这是适用于各种工具的通用解决方案。 The cpio command has a --directory ( -D ) option that will accomplish the same thing: cpio命令有一个--directory ( -D ) 选项,可以完成同样的事情:

rpm2cpio mypackage.rpm | cpio -D /to/other/directory -idmv

或者更简单:

rpmdev-extract -C DIR mypackage.rpm

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

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