The root account on my system has a very strict umask for security
reasons. Normally when I install programs this is not a problem. But
when I use perl -MCPAN to install modules they are always installed
with the umask, and thus nobody can use them except root. Is there a
way to tell CPAN to open the permissions on modules at installation
time? Otherwise I need to hunt around for all the files (.pm and .so)
and chmod 644 them -- which is error prone and annoying.
Any suggestions?
I'm not sure this will work, but I'll toss it out there and see if anyone
says yea or nay
You could fashion a script to set your umask to something less
restrictive, run the CPAN shell, then unset the umask.
So, you could have ....
#!/bin/bash
unmask 0022
perl -MCPAN -e 'shell'
unset umask
My thinking is this ...
since you start another invocation of a shell (I use bash, but it could
be any), you can (un)set the umask as needed and it will be available
*only* for that invocation of the shell. The one issue I see right off
is if the CPAN shell will inherit the umask you set in this new
invocation or start yet another invocation of the shell, getting the
unask from somewhere like your .bashrc or .profile of somewhere else. If
it does, you're in business. If not, then you'll need another way.
Another option is to use 'look' instead of 'install'. Here, you start
another invocation of your shell within the CPAN shell. Set your umask.
Then do your install (perl Makefile.PL, make, make test, make install ).
This defeats the whole idea of using the shell, but I'm pretty certain it
will work.
Yet another option is to fashion your own install script using the CPAN
module (`perldoc CPAN` for more info). This isn't as nice as using the
CPAN shell, but would solve the issue, maybe. I'm not 100% sure how you
would set the umask in this way that would stick. Using 'system' won't
work, AFAIK, and I'm not sure if setting it with the %ENV hash
($ENV{'umask'}) will work; although it's worth a shot.
Others may have other options.
HTH
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL.
http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
You can learn many things from children. How much patience you
<have, for instance. -- Franklin P. Jones