mhonarc-commits
[Top] [All Lists]

CVS: install.me NEWS,1.3,1.4 install.me,1.18,1.19

2003-07-19 17:02:01
Update of /cvsroot/mhonarc/install.me
In directory subversions:/tmp/cvs-serv4173

Modified Files:
	NEWS install.me 
Log Message:
* Added "-root <path>" option to set the root file hierarchy that
  all installation paths will be relative to.  For example, if -root
  is set to "/tmp" and -binpath is set to "/usr/bin", bin files will
  be copied to "/tmp/usr/bin".  The option mainly exists for helping
  create alternate installation bundles, like rpms, and it should
  not be confused with the -prefix option.


Index: NEWS
===================================================================
RCS file: /cvsroot/mhonarc/install.me/NEWS,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** NEWS	15 May 2002 06:22:47 -0000	1.3
--- NEWS	20 Jul 2003 00:00:50 -0000	1.4
***************
*** 1,3 ****
--- 1,13 ----
  ===========================================================================
+ 2003/07/19    1.1.1
+ 
+ * Added "-root <path>" option to set the root file hierarchy that
+   all installation paths will be relative to.  For example, if -root
+   is set to "/tmp" and -binpath is set to "/usr/bin", bin files will
+   be copied to "/tmp/usr/bin".  The option mainly exists for helping
+   create alternate installation bundles, like rpms, and it should
+   not be confused with the -prefix option.
+ 
+ ===========================================================================
  2002/05/15    1.1.0
  

Index: install.me
===================================================================
RCS file: /cvsroot/mhonarc/install.me/install.me,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** install.me	14 May 2002 19:40:46 -0000	1.18
--- install.me	20 Jul 2003 00:00:51 -0000	1.19
***************
*** 230,233 ****
--- 230,235 ----
  my %OptValues	= ();
  
+ my $Root	= '';
+ 
  ###############################################################################
  ##	Parse Command-line
***************
*** 240,243 ****
--- 242,246 ----
  	       qw(
  		   afs
+ 		   root=s
  		   batch
  		   binpath=s
***************
*** 261,264 ****
--- 264,269 ----
      }
  
+     $Root		  = $OptValues{'root'}  if defined $OptValues{'root'};
+ 
      my $cfg_prefix        = interpolate_path($Config{'prefix'});
      $DefValues{'binpath'} = interpolate_path($Config{'installbin'});
***************
*** 423,427 ****
      ## Install files
      ## -------------
-     print STDERR "($OptValues{'perl'})\n";
      my $plprefix  = "#!$OptValues{'perl'}\n";
         $plprefix .= "use lib qw($OptValues{'libpath'});\n"
--- 428,431 ----
***************
*** 430,445 ****
      if ($dobin) {
  	print STDOUT qq(Installing programs to "$OptValues{'binpath'}":\n);
! 	if (create_dir($OptValues{'binpath'}, 1) <= 0) { die "\n"; }
  	foreach (@{$Files{'bin'}}) {
  	    print STDOUT "    $_ => ";
  	    ($file = $_) =~ s%.*/%%o;
  	    $destfile = join('', $OptValues{'binpath'}, $DIRSEP, $file);
  	    print STDOUT $destfile, "\n";
! 	    cp($_, $destfile, $plprefix, $WINDOWS);
! 	    eval q{chmod 0755, $destfile;};
  	    if ($WINDOWS && $file !~ /\.pl$/i) {
! 		$destfile .= ".pl";
! 		cp($_, $destfile, $plprefix);
! 		eval q{chmod 0755, $destfile;};
  	    }
  	}
--- 434,452 ----
      if ($dobin) {
  	print STDOUT qq(Installing programs to "$OptValues{'binpath'}":\n);
! 	if (create_dir(apply_root($Root, $OptValues{'binpath'}), 1) <= 0) {
! 	    die "\n";
! 	}
  	foreach (@{$Files{'bin'}}) {
  	    print STDOUT "    $_ => ";
  	    ($file = $_) =~ s%.*/%%o;
  	    $destfile = join('', $OptValues{'binpath'}, $DIRSEP, $file);
+ 	    my $fulldestfile = apply_root($Root, $destfile);
  	    print STDOUT $destfile, "\n";
! 	    cp($_, $fulldestfile, $plprefix, $WINDOWS);
! 	    eval q{chmod 0755, $fulldestfile;};
  	    if ($WINDOWS && $file !~ /\.pl$/i) {
! 		$fulldestfile .= ".pl";
! 		cp($_, $fulldestfile, $plprefix);
! 		eval q{chmod 0755, $fulldestfile;};
  	    }
  	}
***************
*** 447,451 ****
      if ($dolib) {
  	print STDOUT qq(Installing lib files to "$OptValues{'libpath'}":\n);
! 	if (create_dir($OptValues{'libpath'}, 1) <= 0) { die "\n"; }
  	foreach (@{$Files{'lib'}}) {
  	    print STDOUT "    $_ => ";
--- 454,460 ----
      if ($dolib) {
  	print STDOUT qq(Installing lib files to "$OptValues{'libpath'}":\n);
! 	if (create_dir(apply_root($Root, $OptValues{'libpath'}), 1) <= 0) {
! 	    die "\n";
! 	}
  	foreach (@{$Files{'lib'}}) {
  	    print STDOUT "    $_ => ";
***************
*** 453,462 ****
  	    $destfile = join('', $OptValues{'libpath'}, $DIRSEP, $file);
  	    print STDOUT $destfile, "\n";
! 	    cp($_, $destfile);
  	}
      }
      if ($dodoc) {
  	print STDOUT qq(Installing docs to "$OptValues{'docpath'}":\n);
! 	if (create_dir($OptValues{'docpath'}, 1) <= 0) { die "\n"; }
  	foreach (@{$Files{'doc'}}) {
  	    print STDOUT "    $_ => ";
--- 462,473 ----
  	    $destfile = join('', $OptValues{'libpath'}, $DIRSEP, $file);
  	    print STDOUT $destfile, "\n";
! 	    cp($_, apply_root($Root, $destfile));
  	}
      }
      if ($dodoc) {
  	print STDOUT qq(Installing docs to "$OptValues{'docpath'}":\n);
! 	if (create_dir(apply_root($Root, $OptValues{'docpath'}), 1) <= 0) {
! 	    die "\n";
! 	}
  	foreach (@{$Files{'doc'}}) {
  	    print STDOUT "    $_ => ";
***************
*** 464,468 ****
  	    $destfile = join('', $OptValues{'docpath'}, $DIRSEP, $file);
  	    print STDOUT $destfile, "\n";
! 	    cp($_, $destfile);
  	}
      }
--- 475,479 ----
  	    $destfile = join('', $OptValues{'docpath'}, $DIRSEP, $file);
  	    print STDOUT $destfile, "\n";
! 	    cp($_, apply_root($Root, $destfile));
  	}
      }
***************
*** 470,474 ****
  	my($sect, $msubdir);
  	print STDOUT qq(Installing manpages to "$OptValues{'manpath'}":\n);
! 	if (create_dir($OptValues{'manpath'}, 1) <= 0) { die "\n"; }
  	foreach (@{$Files{'man'}}) {
  	    print STDOUT "    $_ => ";
--- 481,487 ----
  	my($sect, $msubdir);
  	print STDOUT qq(Installing manpages to "$OptValues{'manpath'}":\n);
! 	if (create_dir(apply_root($Root, $OptValues{'manpath'}), 1) <= 0) {
! 	    die "\n";
! 	}
  	foreach (@{$Files{'man'}}) {
  	    print STDOUT "    $_ => ";
***************
*** 476,483 ****
  	    ($sect = $file) =~ s%.*\.%%o;
  	    $msubdir  = join($DIRSEP, $OptValues{'manpath'}, "man$sect");
! 	    if (create_dir($msubdir, 1) <= 0) { die "\n"; }
  	    $destfile = join($DIRSEP, $msubdir, $file);
  	    print STDOUT $destfile, "\n";
! 	    cp($_, $destfile);
  	}
      }
--- 489,496 ----
  	    ($sect = $file) =~ s%.*\.%%o;
  	    $msubdir  = join($DIRSEP, $OptValues{'manpath'}, "man$sect");
! 	    if (create_dir(apply_root($Root, $msubdir), 1) <= 0) { die "\n"; }
  	    $destfile = join($DIRSEP, $msubdir, $file);
  	    print STDOUT $destfile, "\n";
! 	    cp($_, apply_root($Root, $destfile));
  	}
      }
***************
*** 549,552 ****
--- 562,577 ----
  
  ##------------------------------------------------------------------------
+ ##	apply_root() applies install base root path to given path.
+ ##
+ sub apply_root {
+   my $base = shift;
+   my $path = shift;
+   if ($base) {
+     return $base . $path;
+   }
+   $path;
+ }
+ 
+ ##------------------------------------------------------------------------
  ##	get_path_from_user() gets a path from the user.  The function
  ##	insures the path exists.
***************
*** 559,568 ****
      if (defined($value) && ($value =~ /\S/)) {
  	die qq(ERROR: Unable to create "$value".\n)
! 	    unless create_dir($value, 1) > 0;
      } else {
  	my $stat;
  	while (1) {
  	    $value = interpolate_path(prompt_user($prompt, $default));
! 	    $stat = create_dir($value);
  	    if ($stat > 0)  { last; }
  	    if ($stat == 0) { next; }
--- 584,593 ----
      if (defined($value) && ($value =~ /\S/)) {
  	die qq(ERROR: Unable to create "$value".\n)
! 	    unless create_dir(apply_root($Root, $value), 1) > 0;
      } else {
  	my $stat;
  	while (1) {
  	    $value = interpolate_path(prompt_user($prompt, $default));
! 	    $stat = create_dir(apply_root($Root, $value));
  	    if ($stat > 0)  { last; }
  	    if ($stat == 0) { next; }

---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV