Net-FullAuto
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
# 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
$amazon{instance_type} instance. The cpan utility requires more
memory to function successfully than this instance provides. To
install Net::FullAuto, use the "Complete" installer that bundles
all dependencies. This installer has much lower resource demands
than the cpan commandline utility. Download the installer bundle
here:
https://sourceforge.net/projects/fullauto/files/Net-FullAuto-Complete-$VERSION.tar.gz
END
print $message;
exit 1;
} elsif ($amazon{instance_type}=~/nano|micro/ and
$ENV{USER} ne 'root') {
my $message=<<'END';
__ __ _ _ _
| \/ |_ _ __| |_ | |__ ___ _ _ ___ ___| |_
| |\/| | || (_-< _| | '_ \/ -_) | '_/ _ \/ _ \ _|
|_| |_|\_,_/__/\__| |_.__/\___| |_| \___/\___/\__|
Makefile.PL view on Meta::CPAN
# Most Linux systems need a lot of helper software like compilers
# to install all module dependencies. It is assumed users attempting
# to install Net::FullAuto on a Linux system have consented to this,
# especially since Admin privileges are needed to do this.
my $message=<<'END';
======================================================================
This message times out in two minutes so FullAuto Install can continue
======================================================================
___ _ _ _ _ _ _
| __| _| | | /_\ _ _| |_ ___ ___ _ _ | | (_)_ _ _ ___ __
| _| || | | |/ _ \ || | _/ _ \ / _ \ ' \ | |__| | ' \ || \ \ /
|_| \_,_|_|_/_/ \_\_,_|\__\___/ \___/_||_| |____|_|_||_\_,_/_\_\
In order to install FullAuto on Linux servers, a number of
prerequisite dependencies must be installed or present. Allow
FullAuto Setup to validate and install any missing dependencies?
(Default is 'yes')
END
my $timeout=120;
my $fae="No (FullAuto Setup will exit)";
{
local $SIG{__DIE__}; # No sigdie handler
eval {
local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required
alarm $timeout;
my $menu1 = [
$message,
[ "Yes", sub{ return 'Yes' } ],
[ $fae, sub{ return 'No' } ],
];
my $selection=&menu($menu1);
exit 0 if $selection eq ']quit[';
exit 0 if -1<index $selection, 'No';
alarm 0;
};
}
print "\n\n FullAuto install continues . . .\n\n";
fa_system("sudo yum -y install wget openssl-devel zlib-devel");
install_figlet();
fa_system("sudo yum -y install 'nano'");
} elsif (!can_cc() && (exists $amazon{'suse'})) {
# Most Amazon images need a lot of helper software like compilers
# to install all module dependencies. It is assumed users attempting
# to install Net::FullAuto on an EC2 image have consented to this,
# especially since Admin privileges are needed to do this.
# Manual Setup openSuSE host before CPAN:
#
# zypper ar -f -n openSUSE:13.1
# http://download.opensuse.org/distribution/13.1/repo/oss/ openSUSE:13.1
# zypper -n --gpg-auto-import-keys install --force-resolution wget
# zypper -n --gpg-auto-import-keys install --force-resolution figlet
# zypper -n --gpg-auto-import-keys install --force-resolution nano
# zypper -n install --type pattern Basis-Devel
# zypper -n install openssl-devel
# wget http://www.cpan.org/src/5.0/perl-5.20.0.tar.gz
# tar zxvf perl-5.20.0.tar.gz
# cd perl-5.20.0
# ./Configure -d -Dnoextensions=ODBM_File
# make install
# cpan
#
my $zypper=`/bin/zypper packages -i`;
if (0 && -1==index $zypper,'gcc') {
fa_system("zypper -n install --type pattern Basis-Devel");
fa_system("zypper -n install openssl-devel");
my $repos='zypper ar -f -n openSUSE:13.1 '.
'openSUSE:13.1 http://download.'.
'opensuse.org/distribution/13.1'.
'/repo/oss/ openSUSE:13.1';
fa_system($repos);
my $figlet="zypper -n --gpg-auto-import-keys install".
" --force-resolution figlet";
fa_system($figlet);
my $nano="zypper -n --gpg-auto-import-keys install".
" --force-resolution nano";
fa_system($nano);
}
} elsif (!can_cc() && (exists $amazon{'ubuntu'})) {
# Most Amazon images need a lot of helper software like compilers
# to install all module dependencies. It is assumed users attempting
# to install Net::FullAuto on an EC2 image have consented to this,
# especially since Admin privileges are needed to do this.
my $message=<<'END';
This message times out in two minutes so FullAuto Install can continue
_ _ _ _ _
/_\ _ __ __ _ ______ _ _ | | | | |__ _ _ _ _| |_ _ _
/ _ \| ' \/ _` |_ / _ \ ' \ | |_| | '_ \ || | ' \ _| || |
/_/ \_\_|_|_\__,_/__\___/_||_| \___/|_.__/\_,_|_||_\__|\_,_|
In order to install FullAuto on Amazon Ubuntu servers, a number of
prerequisite dependencies must be installed or present. Allow
FullAuto Setup to validate and install any missing dependencies?
(Default is 'yes')
END
my $timeout=120;
my $fae="No (FullAuto Setup will exit)";
{
local $SIG{__DIE__}; # No sigdie handler
eval {
local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required
alarm $timeout;
my $menu1 = [
$message,
[ "Yes", sub{ return 'Yes' } ],
[ $fae, sub{ return 'No' } ],
];
my $selection=&menu($menu1);
exit 0 if $selection eq ']quit[';
exit 0 if -1<index $selection, 'No';
alarm 0;
};
}
print "\n\n FullAuto install continues . . .\n\n";
my $dpkg=`/bin/dpckg -l`;
my $update_flag=0;
if (-1==index $dpkg,'unzip') {
fa_system('sudo apt-get -y install unzip');
}
if (-1==index $dpkg,'build-essential') {
fa_system("sudo apt-get -y update");
$update_flag==1;
fa_system("sudo apt-get -y install 'build-essential'");
}
if (-1==index $dpkg,'libssl-dev') {
unless ($update_flag) {
fa_system("sudo apt-get -y update");
}
( run in 0.682 second using v1.01-cache-2.11-cpan-df04353d9ac )