Index: head/lang/perl5/files/use.perl =================================================================== --- head/lang/perl5/files/use.perl (revision 60960) +++ head/lang/perl5/files/use.perl (revision 60961) @@ -1,82 +1,99 @@ #! %%PREFIX%%/bin/perl -w # $FreeBSD$ use strict; # XXX what to do with perldoc, pelbug, perlcc ?? sub usage { print STDERR < /usr/bin/perl is the perl5 port $0 system -> /usr/bin/perl is the system perl 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(); } elsif ($ARGV[0] eq 'system') { switch_to_system(); } else { usage(); } 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: $!"; print MK <> /etc/make.conf" or die "/etc/make.conf: $!"; print MK < /usr/bin/perl is the perl5 port $0 system -> /usr/bin/perl is the system perl 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(); } elsif ($ARGV[0] eq 'system') { switch_to_system(); } else { usage(); } 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: $!"; print MK <> /etc/make.conf" or die "/etc/make.conf: $!"; print MK < /usr/bin/perl is the perl5 port $0 system -> /usr/bin/perl is the system perl 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(); } elsif ($ARGV[0] eq 'system') { switch_to_system(); } else { usage(); } 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: $!"; print MK <> /etc/make.conf" or die "/etc/make.conf: $!"; print MK < /usr/bin/perl is the perl5 port $0 system -> /usr/bin/perl is the system perl 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(); } elsif ($ARGV[0] eq 'system') { switch_to_system(); } else { usage(); } 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: $!"; print MK <> /etc/make.conf" or die "/etc/make.conf: $!"; print MK < /usr/bin/perl is the perl5 port $0 system -> /usr/bin/perl is the system perl 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(); } elsif ($ARGV[0] eq 'system') { switch_to_system(); } else { usage(); } 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: $!"; print MK <> /etc/make.conf" or die "/etc/make.conf: $!"; print MK < /usr/bin/perl is the perl5 port $0 system -> /usr/bin/perl is the system perl 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(); } elsif ($ARGV[0] eq 'system') { switch_to_system(); } else { usage(); } 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: $!"; print MK <> /etc/make.conf" or die "/etc/make.conf: $!"; print MK < /usr/bin/perl is the perl5 port $0 system -> /usr/bin/perl is the system perl 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(); } elsif ($ARGV[0] eq 'system') { switch_to_system(); } else { usage(); } 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: $!"; print MK <> /etc/make.conf" or die "/etc/make.conf: $!"; print MK <