Net-FullAuto

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

             system compatibilty will be tested and corrected [if needed]
             in the months ahead.)

END

   print $message;
   exit 0;

}

our $aws;
our %amazon;
$ENV{LOADED_MODULES}||='';
$ENV{PERL_MM_USE_DEFAULT}=1;
BEGIN { # FullAuto© MICROSOFT WINDOWS INSTALLER

   # September 1, 2024 NOTE:  The Windows installer has NOT been
   # updated in years and is currently not functioning. There  are plans
   # to update it "soon". In the meantime, FullAuto does install
   # in Cygwin (www.cygwin.com) via the cpan commandline installer.
   # Brian Kelly

   # The code comprising 2/3 of this BEGIN block is used exclusively by
   # the FullAuto MS Windows Installer. You can download the Windows

   # All the code in this BEGIN block is used exclusively by the
   # FullAuto MS Windows Installer. You can download the Windows
   # Installer at:
   #
   #    https://sourceforge.net/projects/fullauto/files/latest/download
   #
   #       or
   #
   #    http://www.FullAuto.com
   #
   # The Windows Installer is written entirely with Perl and the
   # PAR Packager. If is a fully self contained .exe file and contains
   # everything needed to automatically install stand alone FullAuto©
   # or FullAuto© and the FullAuto© REST Web API which includes fully
   # automated TURNKEY installations of Cygwin, Catalyst and ZeroMQ.
   # Cygwin is a dependency for both FullAuto© and the FullAuto© Web
   # API on MS Windows and is installed automatically by the FullAuto©
   # Windows Installer.

   if (exists $ENV{PAR_TEMP} && $^O ne 'cygwin') {
      chdir "$ENV{PAR_TEMP}\\\\inc\\\\lib";
      my $partmp=`set`;
      my $partemp=$partmp;
      my $windir=$partmp;
      if ($partmp=~s/^.*PAR_TEMP=(.*?)\n.*$/$1/s) {
         $windir=~s/^.*windir=(.*?)\n.*$/$1/s;
         $windir=~s/\\/\\\\/g;
         $partmp=~s/\\/\\\\/g;
         my $cpancfg="$partmp\\\\inc\\\\lib\\\\CPAN\\\\Config.pm";
         my $ch=$partmp."\\\\inc\\\\cpan";
         my $cfg=`cmd /c type $cpancfg`;
         $cfg=~s/^(.*cpan_home[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$ch$2/s;
         my $ksw='keep_source_where';
         my $chi=$ch."\\\\sources";
         $cfg=~s/^(.*$ksw[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $chi=$ch."\\\\prefs";
         $cfg=~s/^(.*prefs_dir[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $chi=$ch."\\\\build";
         $cfg=~s/^(.*build_dir[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $chi=$ch."\\\\histfile";
         $cfg=~s/^(.*histfile[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $cfg=~s/^(.*use_sqlite[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/${1}0$2/s;
         $chi=$partmp."\\\\inc\\\\tools\\\\tar.exe";
         $cfg=~s/^(.*tar[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $chi=$partmp."\\\\inc\\\\tools\\\\wget.exe";
         $cfg=~s/^(.*wget[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $chi=$partmp."\\\\inc\\\\tools\\\\dmake.exe";
         $cfg=~s/^(.*make[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $chi=$partmp."\\\\inc\\\\tools\\\\less.exe";
         $cfg=~s/^(.*pager[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $chi=$partmp."\\\\inc\\\\tools\\\\unzip.exe";
         $cfg=~s/^(.*unzip[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $chi=$partmp."\\\\inc\\\\tools\\\\bzip2.exe";
         $cfg=~s/^(.*bzip2[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $chi=$partmp."\\\\inc\\\\tools\\\\patch.exe";
         $cfg=~s/^(.*patch[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $chi=$partmp."\\\\inc\\\\tools\\\\gzip.exe";
         $cfg=~s/^(.*gzip[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$chi$2/s;
         $cfg=~s/^(.*gpg[']?\s*[=][>]\s*q[[])[^]]+([]].*)$/$1$2/s;
         open(CF,">$cpancfg");
         print CF $cfg;
         close CF;
      }
   }
   if (exists $ENV{PAR_TEMP} && $^O eq 'cygwin') {
      # This block removes the PAR lib path from @INC which
      # breaks the installation once Cygwin is available.
      my $cygpar=`/usr/bin/cygpath -u $ENV{PAR_TEMP} 2>&1`;
      foreach my $lib (@INC) {
         next if $lib eq $cygpar;
         push @TMPINC,$lib;
      }
      @INC=@TMPINC;
   }
   ### START OF NON-WINDOWS CODE
   BEGIN {
      # Bullet Proof Test for AWS EC2
      # https://serverfault.com/questions/462903/how-to-know-if-a-machine-is-an-ec2-instance
      $aws=`/bin/bash -c 'if [ -f /sys/hypervisor/uuid ];then if [ \`/bin/head -c 3 /sys/hypervisor/uuid\`=="ec2" ];then echo yes;else echo no;fi;elif [ -r /sys/devices/virtual/dmi/id/product_uuid ];then if [ \`/bin/head -c 3 /sys/devices/virtual/dmi...
      $aws=(-1<index $aws,'yes')?1:0;
      if ($aws) {
         my $token=`curl -X PUT  -s "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"`;
         my $instance_type=`curl -s -H "X-aws-ec2-metadata-token: $token" http://169.254.169.254/latest/meta-data/instance-type`;
         $amazon{instance_type}=$instance_type;
      }
      if ($amazon{instance_type}=~/nano/ &&
            exists $ENV{PERL5_CPAN_IS_RUNNING_IN_RECURSION}) {
         my $message=<<'END';
                                 _                                _          _
   __ _ __  __ _ _ _    _ _  ___| |_   ____  _ _ __ _ __  ___ _ _| |_ ___ __| |
  / _| '_ \/ _` | ' \  | ' \/ _ \  _| (_-< || | '_ \ '_ \/ _ \ '_|  _/ -_) _` |
  \__| .__/\__,_|_||_| |_||_\___/\__| /__/\_,_| .__/ .__/\___/_|  \__\___\__,_|
     |_|                                      |_|  |_|
END
         $message.=<<END;

  You are attempting to install Net::FullAuto on an Amazon AWS EC2



( run in 1.649 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )