0

I would like to overwrite a file that's already located inside a cpio folder with a new file that has the same name. I'm having some troubles by finding the working parameters. I've found this webpage that may have the solution,but I'm not sure :

https://drumperl.wordpress.com/2014/01/12/forcing-cpio-to-overwrite-files/

Anyway,I tried to do this :

echo usr/share/plymouth/themes/homeworld/debian.png | cpio -pumd /home/ziomario/Scrivania/PassT-Cubic/kernels/initrd.img-5.10.0-18-amd64

Keep in consideration that the file that I want to copy inside the cpio archive (initrd.img-5.10.0-18-amd64) is called "debian.png" and that inside it there is a file with the same name.

The command that I have issued above give the following error :

"initrd.img-5.10.0-18-amd64" exists but is not a a directory. Function "open" failed: is not a directory

thanks very much.

1 Answer 1

0

The command you wrote expects the target to be a directory, not a cpio archive file.

The -p flag makes cpio to run in copy-pass mode. From the cpio man page:

Copy-pass mode

In copy-pass mode, cpio copies files from one directory tree to another, combining the copy-out and copy-in steps without actually using an archive. It reads the list of files to copy from the standard input; the directory into which it will copy them is given as a non-option argument.

This is useful if you extract a cpio archive, and you want to replace a file inside the extracted directory.

There isn't an easy way to override a file inside a cpio archive. You'll need to extract the archive, replace the file (where your command might come in handy) and create a new archive.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .