From 20820b30864061dd41ef000f46525f0fa49603db Mon Sep 17 00:00:00 2001 From: dougb Date: Sun, 9 Jun 2002 11:24:22 +0000 Subject: Update to better handle life as it is now in -current. Approved by: tobez (MAINTAINER) --- lang/perl5.8/files/use.perl | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'lang/perl5.8') diff --git a/lang/perl5.8/files/use.perl b/lang/perl5.8/files/use.perl index 08cef70c7ab3..557e38b52311 100644 --- a/lang/perl5.8/files/use.perl +++ b/lang/perl5.8/files/use.perl @@ -14,6 +14,11 @@ EOF exit 2; } +my $port_perl = '%%PREFIX%%/bin/perl'; +$port_perl =~ tr|/|/|s; + +my $ident = `/usr/bin/ident /usr/bin/perl5`; + @ARGV == 1 or usage(); if ($ARGV[0] eq 'port') { switch_to_port(); @@ -24,18 +29,25 @@ if ($ARGV[0] eq 'port') { } exit 0; +# Both functions depend on the idea that switch_to_port leaves +# perl5 alone. If the wrapper is installed on a -current system, +# /usr/bin/perl5 will also be the wrapper. + sub switch_to_system { - my $port_perl = '%%PREFIX%%/bin/perl'; - $port_perl =~ tr|/|/|s; - # protect against cases where people use PREFIX=/usr if ($port_perl ne '/usr/bin/perl') { unlink '/usr/bin/perl', '/usr/bin/suidperl', '/usr/bin/perl%%PERL_VERSION%%'; link '/usr/bin/perl5', '/usr/bin/perl'; - link '/usr/bin/sperl5', '/usr/bin/suidperl'; + link '/usr/bin/perl5', '/usr/bin/perl%%PERL_VERSION%%'; + + if ($ident =~ m#src/usr.bin/perl/perl.c#) { + link '/usr/bin/perl5', '/usr/bin/suidperl'; + } else { + link '/usr/bin/sperl5', '/usr/bin/suidperl'; + } } open MK, ">> /etc/make.conf" or die "/etc/make.conf: $!"; @@ -47,6 +59,7 @@ sub switch_to_system .undef PERL_VERSION .undef PERL_ARCH .undef NOPERL +.undef NO_PERL EOF close MK; @@ -54,13 +67,15 @@ EOF sub switch_to_port { - my $port_perl = '%%PREFIX%%/bin/perl'; - $port_perl =~ tr|/|/|s; - # protect against cases where people use PREFIX=/usr if ($port_perl ne '/usr/bin/perl') { - unlink '/usr/bin/perl', '/usr/bin/suidperl', - '/usr/bin/perl%%PERL_VERSION%%'; + if ($ident =~ m#src/usr.bin/perl/perl.c#) { + rename '/usr/bin/perl', '/usr/bin/perl-wrapper'; + } else { + unlink '/usr/bin/perl'; + } + + unlink '/usr/bin/suidperl', '/usr/bin/perl%%PERL_VERSION%%'; symlink '%%PREFIX%%/bin/perl', '/usr/bin/perl'; symlink '%%PREFIX%%/bin/suidperl', '/usr/bin/suidperl'; @@ -76,6 +91,8 @@ PERL_VER=%%PERL_VER%% PERL_VERSION=%%PERL_VERSION%% PERL_ARCH=%%PERL_ARCH%% NOPERL=yo +NO_PERL=yo +NO_PERL_WRAPPER=yo EOF close MK; -- cgit