From: author scotth@sgi.com 842220273 +0000 Date: Sun, 8 Sep 1996 22:04:33 +0000 (+0000) Subject: Re: installperl feature request (was: Re: Upgrade 4.0x to 5.001m) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0ecb046b660bd887053f3af294f8ec6411a8cbbc;p=p5sagit%2Fp5-mst-13.2.git Re: installperl feature request (was: Re: Upgrade 4.0x to 5.001m) Fix installperl so that the -n option really only prints commands. (previously, it would still do the mkdirs.) an "ignore installed" option, so that it doesn't bother to check to see if the target already exists (an optimization that I *don't* want it to do when I do #1 above) --- diff --git a/installman b/installman index 38bd0af..5e0b0cc 100644 --- a/installman +++ b/installman @@ -66,6 +66,7 @@ sub runpod2man { } chdir $poddir || die "Unable to cd to $poddir directory!\n$!\n"; + print STDERR "chdir $poddir\n"; # We insist on using the current version of pod2man in case there # are enhancements or changes from previous installed versions. @@ -80,7 +81,7 @@ sub runpod2man { # installed by occult means.) $pod2man = "../perl -I ../lib ../pod/pod2man --section=$manext --official"; - mkpath($mandir, 1, 0777); # In File::Path + mkpath($mandir, 1, 0777) unless $notify; # In File::Path # Make a list of all the .pm and .pod files in the directory. We will # always run pod2man from the lib directory and feed it the full pathname # of the pod. This might be useful for pod2man someday. @@ -111,6 +112,7 @@ sub runpod2man { } } chdir "$builddir" || die "Unable to cd back to $builddir directory!\n$!\n"; + print STDERR "chdir $builddir\n"; } sub lsmodpods { diff --git a/installperl b/installperl index 5632824..346e835 100755 --- a/installperl +++ b/installperl @@ -1,10 +1,16 @@ #!./perl BEGIN { @INC=('./lib', '../lib') } use File::Find; -use File::Path qw(mkpath); +use File::Path (); use Config; use subs qw(unlink rename link chmod); +# override the ones in the rest of the script +sub mkpath +{ + File::Path::mkpath(@_) unless $nonono; +} + $mainperldir = "/usr/bin"; $exe_ext = $Config{exe_ext}; @@ -57,8 +63,8 @@ if ($d_dosuid && $>) { die "You must run as root to install suidperl\n"; } $installbin || die "No installbin directory in config.sh\n"; -d $installbin || mkpath($installbin, 1, 0777); --d $installbin || die "$installbin is not a directory\n"; --w $installbin || die "$installbin is not writable by you\n" +-d $installbin || $nonono || die "$installbin is not a directory\n"; +-w $installbin || $nonono || die "$installbin is not writable by you\n" unless $installbin =~ m#^/afs/# || $nonono; -x 'perl' . $exe_ext || die "perl isn't executable!\n"; @@ -347,6 +353,7 @@ sub samepath { sub installlib { my $dir = $File::Find::dir; $dir =~ s#^\.(?![^/])/?##; + local($depth) = $dir ? "lib/$dir" : "lib"; my $name = $_; @@ -373,7 +380,7 @@ sub installlib { &unlink("$installarchlib/$name"); } system "cmp", "-s", $_, "$installlib/$name"; - if ($?) { + if ($? || $nonono) { &unlink("$installlib/$name"); mkpath("$installlib/$dir", 1, 0777); cp_if_diff($_, "$installlib/$name"); @@ -403,9 +410,12 @@ sub cp_if_diff { my($from,$to)=@_; -f $from || die "$0: $from not found"; system "cmp", "-s", $from, $to; - if ($?) { + if ($? || $nonono) { my ($atime, $mtime); unlink($to); # In case we don't have write permissions. + if ($nonono) { + $from = $depth . "/" . $from if $depth; + } cmd("cp $from $to"); # Restore timestamps if it's a .a library. if ($to =~ /\.a$/) {