As part of an installation procedure of a piece of software, I use:
curl -s <url-to-targz> | tar -p -x -z -C /
inside a Perl script (I use
system($command), either will do.All goes well, and the tar ball is installed to the / of my system, but when I do the same thing to an nfs share:
curl -s <url-to-targz> | tar -p -x -z -C /my-nfs/opt
Then the following occurs:
- When I do this on the prompt, this goes well (i.e. all my permissions that I saved in the tar ball are still in place).
- When I do this from withing the Perl script (or a shell script, for that matter), either
system($command)leaves me in with the situation that the permissions are changed (for example, what was executable, is no longer executable).
I am suspecting this has to do with umask (which is 022 on my system), and normally the -p flag should take care of that, but still no joy in this case. Does anyone have any suggestions for me (other than read the manpage :-))?
I have also tried something like
system("umask xyz; $command"), but (probably because the
$command is using a fork of my process, which gets the
umask 022): also no joy.
Edit: Some of the answers indicate I should use umask of Perl. I think a umask 000 will do the trick (but I will see this in the morning, when I am at the system. umask though, has a different effect on files and directories. Is there a way to disable umask entirely during the run of my progran (despite a thousand security reasons against it).