Cleaned up installation script.
This commit is contained in:
1 parent
81e92eb79e
commit
2b4e2bf960
2 files changed
+54
-22
No files matched your search
@@ -8,11 +8,12 @@ use warnings;
|
|||||||
use English qw(-no_match_vars);
|
use English qw(-no_match_vars);
|
||||||
use FindBin qw($Bin);
|
use FindBin qw($Bin);
|
||||||
our $Bin = $Bin;
|
our $Bin = $Bin;
|
||||||
BEGIN { unshift(@INC, "$Bin/src"); }
|
BEGIN { unshift(@INC, "$Bin/lib"); }
|
||||||
use Lib::Install;
|
use Lib::Install;
|
||||||
|
|
||||||
# Installation script.
|
# Installation script.
|
||||||
our $VERSION = 1.00;
|
our $VERSION = 1.00;
|
||||||
|
our $ERROR = 0;
|
||||||
|
|
||||||
# Iterate through the arguments passed to us.
|
# Iterate through the arguments passed to us.
|
||||||
my $features = "base ssl";
|
my $features = "base ssl";
|
||||||
@@ -41,6 +42,12 @@ if (defined $ARGV[0]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check Perl version.
|
||||||
|
println "Checking Perl version..... $^V";
|
||||||
|
eval {
|
||||||
|
require 5.010_000;
|
||||||
|
} or println "This version of Perl is too old. Upgrade to Perl 5.10.0 or later and try again." and exit;
|
||||||
|
|
||||||
# Check operating system.
|
# Check operating system.
|
||||||
print "Checking operating system..... $OSNAME - ";
|
print "Checking operating system..... $OSNAME - ";
|
||||||
if ($OSNAME =~ /dos/i) {
|
if ($OSNAME =~ /dos/i) {
|
||||||
@@ -71,44 +78,56 @@ else {
|
|||||||
print "Unknown operating system. Contact support.\r\n";
|
print "Unknown operating system. Contact support.\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check Perl version.
|
# Check for Perl core modules.
|
||||||
print "Checking Perl version..... $] - ";
|
println "Checking for core Perl modules.....";
|
||||||
if ($] >= 5.010000) {
|
checkcore();
|
||||||
println "OK";
|
println "\0";
|
||||||
|
if ($ERROR) {
|
||||||
|
println "This Perl install is missing some core modules. Consider reinstalling Perl.";
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
println "Incompatible";
|
println "All good.";
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check for required CPAN modules.
|
# Check for required CPAN modules.
|
||||||
println "\0";
|
println "\0";
|
||||||
println "--- CPAN Modules ---";
|
println '*** CPAN Modules ***';
|
||||||
|
println "\0";
|
||||||
#modfind("Mouse");
|
#modfind("Mouse");
|
||||||
modfind("DBI");
|
modfind('DBI');
|
||||||
modfind("DBD::SQLite");
|
modfind('DBD::SQLite');
|
||||||
modfind("Class::Unload");
|
modfind('Class::Unload');
|
||||||
modfind("IO::Socket::INET6") if $features =~ /ipv6/;
|
modfind('IO::Socket::INET6') if $features =~ /ipv6/;
|
||||||
modfind("IO::Socket::SSL") if $features =~ /ssl/;
|
modfind('IO::Socket::SSL') if $features =~ /ssl/;
|
||||||
modfind("MIME::Base64") if $features =~ /sasl/;
|
modfind('MIME::Base64') if $features =~ /sasl/;
|
||||||
|
println "\0";
|
||||||
|
|
||||||
|
if ($ERROR) {
|
||||||
|
println "Failed to install. Please install the missing CPAN modules and try again.";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
println "All good.";
|
||||||
|
}
|
||||||
|
|
||||||
# Create build.
|
# Create build.
|
||||||
println "\0";
|
println "\0";
|
||||||
println "Building.....";
|
println "Building.....";
|
||||||
if (!-d "$Bin/build") {
|
if (!-d "$Bin/build") {
|
||||||
system("mkdir $Bin/build");
|
system "mkdir $Bin/build";
|
||||||
}
|
}
|
||||||
if (!-e "$Bin/build/time") {
|
if (!-e "$Bin/build/time") {
|
||||||
system("touch $Bin/build/time");
|
system "touch $Bin/build/time";
|
||||||
}
|
}
|
||||||
if (!-e "$Bin/build/os") {
|
if (!-e "$Bin/build/os") {
|
||||||
system("touch $Bin/build/os");
|
system "touch $Bin/build/os";
|
||||||
}
|
}
|
||||||
if (!-e "$Bin/build/perl") {
|
if (!-e "$Bin/build/perl") {
|
||||||
system("touch $Bin/build/perl");
|
system "touch $Bin/build/perl";
|
||||||
}
|
}
|
||||||
if (!-e "$Bin/build/ver") {
|
if (!-e "$Bin/build/ver") {
|
||||||
system("touch $Bin/build/ver");
|
system "touch $Bin/build/ver";
|
||||||
}
|
}
|
||||||
|
|
||||||
build($features);
|
build($features);
|
||||||
|
|||||||
+16
-3
@@ -11,7 +11,7 @@ our $Bin = $Bin;
|
|||||||
|
|
||||||
our $VERSION = 1.00;
|
our $VERSION = 1.00;
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw(println modfind build checkver);
|
our @EXPORT = qw(println modfind build checkver checkcore);
|
||||||
|
|
||||||
sub println
|
sub println
|
||||||
{
|
{
|
||||||
@@ -31,8 +31,8 @@ sub modfind
|
|||||||
{
|
{
|
||||||
my ($mod) = @_;
|
my ($mod) = @_;
|
||||||
|
|
||||||
print "Checking for $mod..... ";
|
print " $mod: ";
|
||||||
eval('require '.$mod.'; 1;') and println "OK" or println "Not Found" and exit;
|
eval('require '.$mod.'; 1;') and println "Found" or println "Not Found" and $Install::ERROR = 1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -99,3 +99,16 @@ sub checkver
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub checkcore
|
||||||
|
{
|
||||||
|
println "Checking for Perl core modules.....";
|
||||||
|
println "\0";
|
||||||
|
modfind('Carp');
|
||||||
|
modfind('FindBin');
|
||||||
|
modfind('feature');
|
||||||
|
modfind('IO::Socket');
|
||||||
|
modfind('Sys::Hostname');
|
||||||
|
modfind('POSIX');
|
||||||
|
modfind('Time::Local');
|
||||||
|
}
|
||||||
Reference in new issue
Block a user