Re: Some of the parameters used in my genisoimage command don't produce a bootable ISO image
On Fri, Oct 28, 2022 at 05:03:34PM +0200, Mario Marietto wrote:
> Greg,are you talking about this :
>
> find . -depth -type f | cpio --create --format='newc' >
> ../../initrd.img-5.10.0-18-amd64
>
> or this :
>
> find . -depth | cpio --create --format='newc' >
> ../../initrd.img-5.10.0-18-amd64
>
> or are they equivalent ? Thanks.
I wasn't talking about either of those, specifically. I was simply
answering the question of whether "-type f" was *needed* here. It's not
needed, because cpio does not work like tar.
As for your question: no, they are not the same. Adding "-type f"
means that only files are added to the archive, so when the archive is
extracted, the directories will have to be created implicitly. They won't
necessarily get the same owner/group/permissions they originally had.
Without "-type f", the directories themselves are included in the archive,
along with their metadata (owner, group, permissions), so they can be
recreated when the archive is extracted.
Demonstration:
unicorn:/tmp/x$ find . -type f | cpio --create | cpio -ivt
1 block
-rw-r--r-- 1 greg greg 0 Oct 28 13:15 dir/file2
-rw-r--r-- 1 greg greg 0 Oct 28 13:15 dir/file1
1 block
unicorn:/tmp/x$ find . | cpio --create | cpio -ivt
1 block
drwxr-xr-x 3 greg greg 0 Oct 28 13:15 .
drwxr-xr-x 2 greg greg 0 Oct 28 13:15 dir
-rw-r--r-- 1 greg greg 0 Oct 28 13:15 dir/file2
-rw-r--r-- 1 greg greg 0 Oct 28 13:15 dir/file1
1 block
The second archive contains entries for "." and "dir", whereas the first
archive does not.
Reply to: