usr/src/tools/install-proto.pl
changeset 6 1fb1123973f8
parent 0 b34509ac961f
child 66 f9848e44a68b
child 231 64b14ad80c09
--- a/usr/src/tools/install-proto.pl	Sat Jan 16 18:11:20 2010 +0200
+++ b/usr/src/tools/install-proto.pl	Mon Feb 08 12:51:29 2010 +0200
@@ -19,10 +19,10 @@
 #
 # CDDL HEADER END
 #
-# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#ident	"@(#)install-proto.pl	1.4	09/06/15 SMI"
+#ident	"@(#)install-proto.pl	1.5	10/01/08 SMI"
 #
 # BSD compatible install(1b) that honors DESTDIR and performs SFW post
 # processing on various file types
@@ -32,8 +32,8 @@
 use File::Basename;
 use File::Copy;
 
-my ($PERL, $DESTDIR, $SRC, $MANSCRIPT, %opts, @paths) =
-	($ENV{'PERL'}, $ENV{'DESTDIR'}, $ENV{'SRC'}, $ENV{'MANSCRIPT'});
+my ($PERL, $DESTDIR, $SRC, $MANSCRIPT, $PYTHON, %opts, @paths) =
+	($ENV{'PERL'}, $ENV{'DESTDIR'}, $ENV{'SRC'}, $ENV{'MANSCRIPT'}, $ENV{'PYTHON'});
 my ($post_process, $post_process_so, $strip) = (
 	$SRC.'/tools/post_process',
 	$SRC.'/tools/post_process_so',
@@ -41,6 +41,7 @@
 my $progname = basename($0);
 
 defined($PERL) || ($PERL = $);	# fallback to this version of perl
+defined($PYTHON) || ($PYTHON = '/usr/bin/python2.4');	# fallback to this version of perl
 
 (defined($DESTDIR)) || ($DESTDIR = $ENV{'ROOT'});
 
@@ -80,14 +81,17 @@
 		(-f $MANSCRIPT) ||
 			die "$progname: error: $MANSCRIPT does not exist\n";
 		system("sed -f $MANSCRIPT <$src >$dst");
-	} elsif ($type =~ /perl .*script/) {
+	} elsif ($type =~ / .*script/) {
 		my $IFH, $OFH;
 
 		open($IFH, "<$src") || die("$progname: open(<$src): $!\n");
 		open($OFH, ">$dst") || die("$progname: open(>$dst): $!\n");
 
 		while (<$IFH>) {
-			($. == 1) && (s|^#!.*perl|#!${PERL}|g);
+			if ($. == 1) {
+				(s|^#!.*perl|#!${PERL}|g);
+				(s|^#!.*python[\d\.]*|#!${PYTHON}|g);
+			}
 			print($OFH "$_");
 		}