libarchive, .iso images, and perms

I just recently noticed all the interesting new formats libarchive (and by extension, tools like bsdtar) supports.

One of these is ISO-9660 CD-ROM images. This is very handy, but one issue I've yet to work around is that when tar is used to extract these (in my example, I'm looking at FreeBSD release ISOs), it simply sets ownership to the user that unpacks the file and permissions to be only readable/executable by that user.

Is this a limitation of the ISO-9660 format?

In my case, I'm pulling apart the first DVD for some netinstall stuff and it's a pain to try to manually whack everything back in shape, especially the "livefs" stuff. Any ideas how to get proper permissions without resorting to an md mount of the ISO?

Thanks!
 
Have you tried using the -p option?
(x mode only) Preserve file permissions. Attempt to restore the full permissions, including owner, file modes, file flags and ACLs, if available, for each item extracted from the archive. By default, newly-created files are owned by the user running tar, the file mode is restored for newly-created regular files, and all other types of entries receive default permissions. If tar is being run by root, the default is to restore the owner unless the -o option is also specified.
 
spork said:
Any ideas how to get proper permissions without resorting to an md mount of the ISO?

Just think about what is "proper" permission for a file on a ISO-9660 file system. The media in its own nature is read only so naturally you will not see write permission on a CD drive. Live cds go around this by mounting some of the stuff at boot into memory based file system that can be written to. Also ISO-9660 does not support user ownership, so OS assumes who ever mounted the disk is the owner.
 
Interesting stuff. I just mounted an ISO image (FreeBSD-8.1-RELEASE-i386-dvd1.iso) and lo and behold, everything is basically a+r or a+x (directories). This makes sense then if the ISO-9660 format simply doesn't support any extended permissions or ownership info.

I am still puzzled by how something like this works when you use the DVD for it's live FS option:

Code:
[root@archive /tank1/exports/netboot]# ls -l /mnt/etc/master.passwd 
-r--r--r--  3 root  wheel  1433 Jul 18  2010 /mnt/etc/master.passwd

or even more, something like:

Code:
[root@archive /tank1/exports/netboot]# ls -l /mnt/usr/bin/passwd 
-r-xr-xr-x  6 root  wheel  6160 Jul 18  2010 /mnt/usr/bin/passwd

It's sort of a weird path that took me here - I've been using mm@'s mfsbsd tools to do network installs. Yesterday we were playing around with his "zfsinstall" script which requires a tarball of something like the livefs disk, so I used what was on the ISO image. Hilarity ensued as we found we found the permissions were totally out of whack (good motivation to read up on mtree though I think).

I've been working with FreeBSD since something like 2.1.6, but haven't always kept up with all the changes. These days, what is available that would essentially give me a clean install that I could use as a basis for creating the tarfile zfsinstall wants? The ISO noted above seems to have what I want, but the restrictions on permissions/ownership rule it out. I could always modify the zfsinstall script to instead look for the normal set of install files and then have it run the various "install.sh" scripts, but I'm a bit curious what the original intent was in the script wanting to work from a tarball.
 
Back
Top