On Dec 26, 2011, at 5:35 AM, David Abdurachmanov wrote:
> Hi All,
> I am trying to unpack RPM, which has all files with root:root permissions. Unpacking is done in the environment, where user does not have root permissions. I am using something like this:
> rpm2cpio /Users/david/tmp/RPMS/gcc+4.6.1.rpm | cpio -idmvu --insecure -R david:staff
That's the basic pipe (though -v is optional, and -u and --insecure and -R user:group
are a matter of taste and style).
There are no ".." in any *.rpm payload, and all paths are absolute (*.src.rpm's
are just base names, not paths); if unpacking into an empty directory, you are
unlikely (as non-root) to overwrite any file with any file in a *.rpm payload.
So --insecure (and -u if empty directory) is likely unneeded.
> Important flags:
> --insecure # Install into location, which is pointed by symlink
> -u # Overwrite destination files is such already exists
> -R david:staff # Change file permissions to david:staff as there is no access to root:root
> If I run this under "david" user it will fail at the end . If I run it as root user, everything is okay. While on the Linux machines I do not have any problems unpacking such RPMS (holds root:root files) and making cpio to set my permissions on the files, I can't do that on Mac OS X. Some of the executables are zero-size files .
> Any suggestions how to unpack RPM, which holds root:root permission files, using non-root user would be very welcomed.
Your question is ultimately about cpio behavior (apparently on Mac OS X) rather
than RPM itself.
Apple may have a modified cpio (iirc) to handle resource forks etc. E.g. ditto
is basically a cpio with some additional options and _file "magic names".
But the core issue appears to be that -R is root-only (from "man cpio" on Lion):
Set the owner and/or group on files in the output. If group is
specified with no user (for example, -R :wheel) then the group
will be set but not the user. If the user is specified with a
trailing colon and no group (for example, -R root:) then the
group will be set to the user's default group. If the user is
specified with no trailing colon, then the user will be set but
not the group. In -i and -p modes, this option can only be used
by the super-user. (For compatibility, a period can be used in
place of the colon.)
> Thanks in advance and Merry Christmas!
And to you as well!
73 de Jeff
> ./opt/gcc/4.6.1/bin/x86_64-apple-darwin10.8.0-gfortran: Can't create 'opt/gcc/4.6.1/bin/x86_64-apple-darwin10.8.0-gfortran'
> ./opt/gcc/4.6.1/bin/x86_64-apple-darwin10.8.0-gcc-4.6.1: Can't create 'opt/gcc/4.6.1/bin/x86_64-apple-darwin10.8.0-gcc-4.6.1'
> ./opt/gcc/4.6.1/bin/x86_64-apple-darwin10.8.0-g++: Can't create 'opt/gcc/4.6.1/bin/x86_64-apple-darwin10.8.0-g++'
> drwxr-xr-x 18 david staff 612 Grd 25 00:36 .
> drwxr-xr-x 8 david staff 272 Grd 25 00:36 ..
> -r-xr-xr-x 4 david staff 0 Grd 25 00:36 c++
> lrwxr-xr-x 1 david staff 3 Grd 25 00:36 cc -> gcc
> -r-xr-xr-x 1 david staff 9504 Grd 25 00:36 cloog
> -r-xr-xr-x 1 david staff 431392 Grd 25 00:36 cpp
> -r-xr-xr-x 4 david staff 0 Grd 25 00:36 g++
> -r-xr-xr-x 3 david staff 0 Grd 25 00:36 gcc
> -r-xr-xr-x 1 david staff 51680 Grd 25 00:36 gcov
> -r-xr-xr-x 2 david staff 0 Grd 25 00:36 gfortran
> -r-xr-xr-x 1 david staff 119464 Grd 25 00:36 ppl-config
> -r-xr-xr-x 1 david staff 91472 Grd 25 00:36 ppl_lcdd
> -r-xr-xr-x 1 david staff 73448 Grd 25 00:36 ppl_pips
> -r-xr-xr-x 4 david staff 0 Grd 25 00:36 x86_64-apple-darwin10.8.0-c++
> -r-xr-xr-x 4 david staff 0 Grd 25 00:36 x86_64-apple-darwin10.8.0-g++
> -r-xr-xr-x 3 david staff 0 Grd 25 00:36 x86_64-apple-darwin10.8.0-gcc
> -r-xr-xr-x 3 david staff 0 Grd 25 00:36 x86_64-apple-darwin10.8.0-gcc-4.6.1
> -r-xr-xr-x 2 david staff 0 Grd 25 00:36 x86_64-apple-darwin10.8.0-gfortran______________________________________________________________________
> RPM Package Manager http://rpm5.org
> User Communication List firstname.lastname@example.org
Received on Mon Dec 26 17:11:09 2011