Extract the contents of example-2.0-1.x86_64.rpm into the current directory for inspection.
Do not register it in the RPM database; convert it to a cpio stream and extract it.
Which command is appropriate?
rpm2cpio converts an RPM archive to a cpio stream on standard output. Piping that stream to cpio -i extracts files without installing the package.
Detailed explanation
cpio example-2.0-1.x86_64.rpm | rpm2cpio -idmvIncorrect. cpio cannot read an RPM archive directly in this order.
Incorrect. cpio cannot read an RPM archive directly in this order.
rpm2cpio example-2.0-1.x86_64.rpm | cpio -idmvCorrect. rpm2cpio converts the archive and cpio -idmv extracts the stream.
Correct. rpm2cpio converts the archive and cpio -idmv extracts the stream.
rpm -ivh example-2.0-1.x86_64.rpm | cpio -idmvIncorrect. rpm -i would install the package before any extraction.
Incorrect. rpm -i would install the package before any extraction.
rpm -e example-2.0-1.x86_64.rpm | cpio -idmvIncorrect. rpm -e removes an installed package and is not an extraction step.
Incorrect. rpm -e removes an installed package and is not an extraction step.
Try it yourself
An example you can run in a temporary verification environment.
rpm2cpio example.rpm | cpio -tExpected result
RPM内のパス一覧。実在するRPMを一時ディレクトリで使うKey points
- rpm2cpio writes to standard output
- cpio -i extracts
- The RPM database is not modified
Notes
- Environment: rpm2cpio 4.x公式仕様
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.