######################################################################################################### ## fichier install.sh pour ActivePerl ######################################################################################################### #!/bin/sh lib_path=perl/lib/CORE env -i \ PATH=/usr/bin:/bin \ HOME=$HOME \ LD_LIBRARY_PATH=$lib_path \ DYLD_LIBRARY_PATH=$lib_path \ perl/bin/perl -Isupport/lib support/install.pl "$@" ######################################################################################################### ## fichier install.pl utilisé ######################################################################################################### #!/usr/bin/perl -w BEGIN { # fix up @INC path so we can run from the unpacked tarball s,^/tmp/perl----[^/]*,perl, for @INC; } use strict; use ActiveState::Prompt qw(prompt yes); use ActiveState::Run qw(run); use Getopt::Long qw(GetOptions); use Config qw(%Config); $| = 1; my $product = "ActivePerl"; my $prefix; my $install_html = 1; my $license_accepted; my $manicheck = 1; GetOptions( 'prefix=s' => \$prefix, 'install-html!' => \$install_html, 'license-accepted' => \$license_accepted, 'manifest-check!' => \$manicheck, ) && !@ARGV || usage(); $ActiveState::Prompt::USE_DEFAULT++ if $prefix; $prefix ||= do { my $DEFAULT_PREFIX = sprintf "/opt/%s-%vd", $product, $^V; $DEFAULT_PREFIX =~ s/(5\.\d+)\.\d+$/$1/; # cut off revision $DEFAULT_PREFIX =~ s/\s/-/g; # can't have space in name if ($^O eq "hpux") { $DEFAULT_PREFIX = "/opt/perl"; $DEFAULT_PREFIX .= "_64" if $Config{use64bitall}; } $DEFAULT_PREFIX; }; if ($manicheck) { print "Checking package..."; my $errors = 0; if (!open(my $manifh, "support/MANIFEST")) { print "\n- MANIFEST is missing\n"; $errors++; } else { while (<$manifh>) { chomp; my %h = map { s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; $_ } map { /=/ ? split(/=/, $_, 2) : ($_ => 1) } split(" ", $_); if (my $f = $h{file}) { my $fh; unless (open($fh, "<", $f) && -f $fh) { print "\n" unless $errors; print "- file '$f' missing.\n"; $errors++; next; } binmode($fh); if (my $exp_md5 = $h{md5}) { require Digest::MD5; my $md5 = Digest::MD5->new->addfile($fh)->hexdigest; unless ($md5 eq $exp_md5) { print "\n" unless $errors; print "- file '$f' corrupt.\n"; $errors++; next; } } } } continue { if ($errors > 10) { print "Giving up.\n"; last; } } } if ($errors) { print <<"EOT"; This installer package does not have the expected content. Please try to download a fresh copy of $product from ActiveState's website at . If you still have problems please contact us at . EOT exit; } else { print "done\n"; } } print <<"EOT"; Welcome to $product EOT if (open(my $f, "LICENSE.txt")) { my $title = <$f>; chomp($title); close($f); if ($ActiveState::Prompt::USE_DEFAULT) { if (!$license_accepted) { die <. Thank you for trying to install $product! EOT exit 1; } print <<"EOT"; $product has been successfully installed at $prefix. Please modify your startup environment by adding: $prefix/site/bin:$prefix/bin to PATH $prefix/site/man:$prefix/man to MANPATH For general questions or comments about $product, please contact us at . Thank you for using $product! EOT sub do_install { my $prefix = shift; require ActiveState::RelocateTree; ActiveState::RelocateTree::relocate2("perl", $prefix); # unset these so that perl picks up the installed libperl.so instead of # the unrelocated version found in the installer tarball. These variables # are set by 'install.sh' before this script is invoked. delete $ENV{LD_LIBRARY_PATH}; delete $ENV{DYLD_LIBRARY_PATH}; # Generate the HTML documentation if ($install_html) { print "Generating HTML documentation..."; run("\@$prefix/bin/perl", "-MActivePerl::DocTools", "-eUpdateHTML(1)"); print "done\n"; } else { require File::Path; File::Path::rmtree("$prefix/html"); # tells DocTools not to update it } local $ENV{ACTIVEPERL_PPM_SETUP_TIME} = 1; run("\@$prefix/bin/perl", "-MActivePerl::PPM::InstallArea", "-e", "ActivePerl::PPM::InstallArea->new('perl')->sync_db(keep_package_version => 1)"); } sub usage { my $msg = < where to install to --license-accepted confirm agreement with terms of LICENSE.txt --no-install-html don't install the HTML documentation --no-manifest-check don't check the integrity of this package If --prefix is specified try to install non-interactively to the given location, otherwise prompt for install location and options. EOT $msg =~ s/--no-/--no/g if $Getopt::Long::VERSION < 2.33; print $msg; exit 1; }