cvs commit: modperl-docs/src/docs/2.0/os/win32 mpinstall

2003-07-07 Thread randyk
randyk  2003/07/06 18:27:36

  Modified:src/docs/1.0/os/win32 mpinstall
   src/docs/2.0/os/win32 mpinstall
  Log:
  some cleanup of the mpinstall script.
  
  Revision  ChangesPath
  1.7   +33 -33modperl-docs/src/docs/1.0/os/win32/mpinstall
  
  Index: mpinstall
  ===
  RCS file: /home/cvs/modperl-docs/src/docs/1.0/os/win32/mpinstall,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- mpinstall 6 Jul 2003 17:33:18 -   1.6
  +++ mpinstall 7 Jul 2003 01:27:36 -   1.7
  @@ -14,7 +14,6 @@
   use Config;
   use Safe;
   use Digest::MD5;
  -use IO::File;
   require Win32;
   require File::Spec;
   
  @@ -118,7 +117,7 @@
   
   # set appropriate ppd and tar.gz files
   if ($]  5.008) {
  -$checksums = $theoryx5 . '/ppmpackages/x86/' . $cs;
  +$checksums = $ppmpackagesx86 . $cs;
   if ($apache2) {
   die 'No mod_perl 2 package available for this perl version';
   }
  @@ -140,7 +139,7 @@
   }
   }
   else {
  -$checksums = $theoryx5 . '/ppms/x86/' . $cs;
  +$checksums = $ppmsx86 . $cs;
   if ($apache2) {
   $ppdfile = 'mod_perl.ppd';
   $tgzfile = 'mod_perl.tar.gz';
  @@ -186,34 +185,30 @@
   print Fetching $checksums ...;
   getstore($checksums, $cs);
   print  done!\n;
  +die Failed to fetch $checksums unless -e $cs;
   
  -# check CHECKSUMS for the tar.gz file
  -if (-e $cs) {
  -unless (verifyMD5($tgzfile)) {
  -die qq{CHECKSUM check for $tgzfile failed.\n};
  -}
  -unless (verifyMD5($so_fake)) {
  -die qq{CHECKSUM check for $so_fake failed.\n};
  -}
  -rename($so_fake, $so) or die Rename of $so_fake to $so failed: $!;
  -}
  -else {
  -die Failed to fetch $checksums - cannot verify CHECKSUMS.;
  -}
  +# check CHECKSUMS for the tar.gz and so files
  +my $cksum = load_cs($cs);
  +die Could not load $cs: $! unless $cksum;
  +die qq{CHECKSUM check for $tgzfile failed.\n} 
  +unless (verifyMD5($cksum, $tgzfile));
  +die qq{CHECKSUM check for $so_fake failed.\n}
  +unless (verifyMD5($cksum, $so_fake));
  +rename($so_fake, $so) or die Rename of $so_fake to $so failed: $!;
   
   # edit the ppd file to reflect a local installation
   my $old = $ppdfile . '.old';
  -rename $ppdfile, $old 
  +rename ($ppdfile, $old) 
   or die renaming $ppdfile to $old failed: $!;
  -open(OLD, $old) or die Cannot open $old: $!;
  -open(NEW, $ppdfile) or die Cannot open $ppdfile: $!;
  -while (OLD) {
  +open(my $oldfh, $old) or die Cannot open $old: $!;
  +open(my $newfh, $ppdfile) or die Cannot open $ppdfile: $!;
  +while ($oldfh) {
   next if /INSTALL/;
   s/$tgz/$tgzfile/;
  -print NEW $_;
  +print $newfh $_;
   }
  -close OLD;
  -close NEW;
  +close $oldfh;
  +close $newfh;
   
   # install mod_perl via ppm
   my $ppm = $Config{bin} . '\ppm';
  @@ -281,10 +276,10 @@
   
   # routine to verify the CHECKSUMS for a file
   # adapted from the MD5 check of CPAN.pm
  -sub verifyMD5 {
  -my $file = shift;
  -my $fh = IO::File-new;
  -my $cksum;
  +
  +sub load_cs {
  +my $cs = shift;
  +my ($cksum, $fh);
   unless (open $fh, $cs) {
   warn Could not open $cs: $!;
   return;
  @@ -299,18 +294,23 @@
   warn $@;
   return;
   }
  -my ($is, $should);
  -unless (open(FILE, $file)) {
  +return $cksum;
  +}
  +
  +sub verifyMD5 {
  +my ($cksum, $file) = @_;
  +my ($fh, $is, $should);
  +unless (open($fh, $file)) {
   warn Cannot open $file: $!;
   return;
   }
  -binmode(FILE);
  -unless ($is = Digest::MD5-new-addfile(*FILE)-hexdigest) {
  +binmode($fh);
  +unless ($is = Digest::MD5-new-addfile($fh)-hexdigest) {
   warn Could not compute checksum for $file: $!;
  -close(FILE);
  +close($fh);
   return;
   }
  -close(FILE);
  +close($fh);
   if ($should = $cksum-{$file}-{md5}) {
   my $test = $is eq $should ? 1 : 0;
   printf qq{Checksum for $file is %s\n}, 
  
  
  
  1.7   +33 -33modperl-docs/src/docs/2.0/os/win32/mpinstall
  
  Index: mpinstall
  ===
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/os/win32/mpinstall,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- mpinstall 6 Jul 2003 17:33:18 -   1.6
  +++ mpinstall 7 Jul 2003 01:27:36 -   1.7
  @@ -14,7 +14,6 @@
   use Config;
   use Safe;
   use Digest::MD5;
  -use IO::File;
   require Win32;
   require File::Spec;
   
  @@ -118,7 +117,7 @@
   
   # set appropriate ppd and tar.gz files
   if ($]  5.008) {
  -$checksums = $theoryx5 . '/ppmpackages/x86/' . $cs;
  +$checksums = $ppmpackagesx86 . $cs;
   if ($apache2) {
   die 'No mod_perl 2 package available for this perl version';
   }
  @@ -140,7 +139,7 @@
   

cvs commit: modperl-docs/src/docs/2.0/os/win32 mpinstall

2003-05-31 Thread randyk
randyk  2003/05/30 20:04:55

  Modified:src/docs/1.0/os/win32 mpinstall
   src/docs/2.0/os/win32 mpinstall
  Log:
  - adjust indentation style
  - attempt to handle stupid Win32 long filenames
  
  Revision  ChangesPath
  1.4   +164 -149  modperl-docs/src/docs/1.0/os/win32/mpinstall
  
  Index: mpinstall
  ===
  RCS file: /home/cvs/modperl-docs/src/docs/1.0/os/win32/mpinstall,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mpinstall 31 Dec 2002 23:25:01 -  1.3
  +++ mpinstall 31 May 2003 03:04:55 -  1.4
  @@ -1,3 +1,4 @@
  +#!C:/Perl/bin
   #
   # A Perl script to fetch and install via ppm mod_perl on Win32
   # Copyright 2002, by Randy Kobes.
  @@ -16,6 +17,7 @@
   use Safe;
   use Digest::MD5;
   use IO::File;
  +require Win32;
   
   die This only works for Win32 unless $^O =~ /Win32/i;
   die No mod_perl ppm package available for this Perl if ($]  5.006001);
  @@ -24,124 +26,125 @@
   
   # find a possible Apache2 directory
   APACHE2: {
  -  for my $drive ('C'..'G') {
  -for my $p ('Apache2', 'Program files/Apache2', 
  -'Program Files/Apache Group/Apache2') { 
  -  if (-d $drive:/$p) {
  - $apache2 = $drive:/$p;
  - last APACHE2;
  -  }
  +for my $drive ('C'..'G') {
  +for my $p ('Apache2', 'Program files/Apache2', 
  +   'Program Files/Apache Group/Apache2') { 
  +if (-d $drive:/$p) {
  +$apache2 = $drive:/$p;
  +last APACHE2;
  +}
  +}
   }
  -  }
   }
   if ($apache2) {
  -  my $ans = prompt(qq{Install mod_perl-2 for $apache2?}, 'yes');
  -  $apache2 = undef unless ($ans =~ /^y/i);
  +$apache2 = fix_path($apache2);
  +my $ans = prompt(qq{Install mod_perl-2 for $apache2?}, 'yes');
  +$apache2 = undef unless ($ans =~ /^y/i);
   }
   
   # if no Apache2, try to find Apache1
   unless ($apache2) {
  - APACHE: {
  -for my $drive ('C'..'G') {
  -  for my $p ('Apache', 'Program Files/Apache', 
  -  'Program Files/Apache Group/Apache') {
  - if (-d $drive:/$p) {
  -   $apache = $drive:/$p;
  -   last APACHE;
  - }
  -  }
  +  APACHE: {
  +for my $drive ('C'..'G') {
  +for my $p ('Apache', 'Program Files/Apache', 
  +   'Program Files/Apache Group/Apache') {
  +if (-d $drive:/$p) {
  +$apache = $drive:/$p;
  +last APACHE;
  +}
  +}
  +}
   }
  -  }
   }
   if ($apache) {
  -  my $ans = prompt(qq{Install mod_perl-1 for $apache?}, 'yes');
  -  $apache = undef unless ($ans =~ /^y/i);
  +$apache = fix_path($apache);
  +my $ans = prompt(qq{Install mod_perl-1 for $apache?}, 'yes');
  +$apache = undef unless ($ans =~ /^y/i);
   }
   
   # check Apache versions 
   if ($apache or $apache2) {
  -  my $vers;
  -  if ($apache) {
  -$vers = qx{$apache\\apache.exe -v};
  -die qq{$apache does not appear to be version 1.3}
  -  unless $vers =~ m!Apache/1.3!;
  -  }
  -  else {
  -$vers = qx{$apache2\\bin\\apache.exe -v};
  -die qq{$apache2 does not appear to be version 2.0}
  -  unless $vers =~ m!Apache/2.0!;
  -  }
  +my $vers;
  +if ($apache) {
  +$vers = qx{$apache/apache.exe -v};
  +die qq{$apache does not appear to be version 1.3}
  +unless $vers =~ m!Apache/1.3!;
  +}
  +else {
  +$vers = qx{$apache2/bin/apache.exe -v};
  +die qq{$apache2 does not appear to be version 2.0}
  +unless $vers =~ m!Apache/2.0!;
  +}
   }
  -
   # prompt to get an Apache installation directory
   else {
  -  my $dir = prompt(Where is your apache installation directory?, '');
  -  die 'Need to specify the Apache installation directory' unless $dir;
  -  die qq{$dir does not exist} unless (-d $dir);
  -  if ($dir =~ /Apache2/) {
  -my $ans = prompt(qq{Install mod_perl-2 for $dir?}, 'yes');
  -$apache2 = $dir if ($ans =~ /^y/i);
  -  }
  -  else {
  -my $ans = prompt(qq{Install mod_perl-1 for $dir?}, 'yes');
  -$apache = $dir if ($ans =~ /^y/i);
  -  }
  -  unless ($apache or $apache2) {
  -my $mpv = prompt('Which mod_perl version would you like [1 or 2]?', 2);
  -if ($mpv == 1) {
  -  $apache = $dir;
  -}
  -elsif ($mpv == 2) {
  -  $apache2 = $dir;
  +my $dir = prompt(Where is your apache installation directory?, '');
  +die 'Need to specify the Apache installation directory' unless $dir;
  +$dir = fix_path($dir);
  +die qq{$dir does not exist} unless (-d $dir);
  +if ($dir =~ /Apache2/) {
  +my $ans = prompt(qq{Install mod_perl-2 for $dir?}, 'yes');
  +$apache2 = $dir if ($ans =~ /^y/i);
   }
   else {
  -  die 'Please 

cvs commit: modperl-docs/src/docs/2.0/os/win32 mpinstall

2002-12-31 Thread randyk
randyk  2002/12/31 15:25:01

  Modified:src/docs/1.0/os/win32 mpinstall
   src/docs/2.0/os/win32 mpinstall
  Log:
  s/warn/die/
  
  Revision  ChangesPath
  1.3   +4 -4  modperl-docs/src/docs/1.0/os/win32/mpinstall
  
  Index: mpinstall
  ===
  RCS file: /home/cvs/modperl-docs/src/docs/1.0/os/win32/mpinstall,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mpinstall 31 Dec 2002 22:59:48 -  1.2
  +++ mpinstall 31 Dec 2002 23:25:01 -  1.3
  @@ -163,11 +163,11 @@
   # check CHECKSUMS for the tar.gz file
   if (-e $cs) {
 unless (verifyMD5($tgzfile)) {
  -print qq{CHECKSUM check for $tgzfile failed.\n};
  +die qq{CHECKSUM check for $tgzfile failed.\n};
 }
   }
   else {
  -  warn Failed to fetch $checksums - will not verify CHECKSUMS.;
  +  die Failed to fetch $checksums - cannot verify CHECKSUMS.;
   }
   
   # edit the ppd file to reflect a local installation
  @@ -258,8 +258,8 @@
 my $file = shift;
 my $fh = IO::File-new;
 my $cksum;
  -  unless (open $fh, 'CHECKSUMS') {
  -warn Could not open CHECKSUMS: $!;
  +  unless (open $fh, $cs) {
  +warn Could not open $cs: $!;
   return;
 }
 local($/);
  
  
  
  1.3   +4 -4  modperl-docs/src/docs/2.0/os/win32/mpinstall
  
  Index: mpinstall
  ===
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/os/win32/mpinstall,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mpinstall 31 Dec 2002 22:59:48 -  1.2
  +++ mpinstall 31 Dec 2002 23:25:01 -  1.3
  @@ -163,11 +163,11 @@
   # check CHECKSUMS for the tar.gz file
   if (-e $cs) {
 unless (verifyMD5($tgzfile)) {
  -print qq{CHECKSUM check for $tgzfile failed.\n};
  +die qq{CHECKSUM check for $tgzfile failed.\n};
 }
   }
   else {
  -  warn Failed to fetch $checksums - will not verify CHECKSUMS.;
  +  die Failed to fetch $checksums - cannot verify CHECKSUMS.;
   }
   
   # edit the ppd file to reflect a local installation
  @@ -258,8 +258,8 @@
 my $file = shift;
 my $fh = IO::File-new;
 my $cksum;
  -  unless (open $fh, 'CHECKSUMS') {
  -warn Could not open CHECKSUMS: $!;
  +  unless (open $fh, $cs) {
  +warn Could not open $cs: $!;
   return;
 }
 local($/);
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]