-
Notifications
You must be signed in to change notification settings - Fork 0
/
proserver_dev_netinstall.pl
178 lines (137 loc) · 4.26 KB
/
proserver_dev_netinstall.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#!/usr/bin/perl
=head1 NAME
proserver_dev_netinstall.pl
=head1 SYNOPSIS
proserver_dev_netinstall.pl
options:
-h|--help Show this message
-s|--skip_start Don't wait for 'Enter' at program start
=head1 DESCRIPTION
Net-based installer of ProServer.
[sudo] perl proserver_dev_netinstall.pl
This script is based on the gbrowse net-based Installer Script at http://gmod.org/wiki/index.php/GBrowse.
The project site is here: http://github.com/nakao/proserver-netinstaller/tree/master
=cut
use warnings;
use strict;
use CPAN;
use Config;
use Getopt::Long;
use Pod::Usage;
use File::Copy 'cp';
use File::Temp qw(tempdir);
use LWP::Simple;
use Cwd;
my ( $show_help, $make, $working_dir, $tmpdir, $skip_start, $perl, $version );
BEGIN {
GetOptions(
'h|help' => \$show_help, # Show help and exit
'skip_start' => \$skip_start,
)
or pod2usage(2);
pod2usage(2) if $show_help;
print STDERR "\nAbout to install ProServer and all its prerequisites.\n",
"\nPress return when you are ready to start!\n";
my $h = <> unless $skip_start;
print STDERR "*** Installing Perl files needed for a net-based install ***\n";
eval "CPAN::Config->load";
eval "CPAN::Config->commit";
$working_dir = getcwd;
$tmpdir = tempdir(CLEANUP=>1) or die "Could't create temporary directory: $!";
$make = $Config{'make'};
$perl = $^X;
eval "use Archive::Zip ':ERROR_CODES',':CONSTANTS'";
my @pkgs = ('YAML',
'Archive::Zip',
'HTML::Tagset',
'LWP::Simple',
'Archive::Tar',
'Digest::SHA',
);
foreach (@pkgs) {
CPAN::Shell->install($_);
}
1;
};
use Archive::Tar;
use CPAN '!get';
use constant GD_REQUIRES => '2.31';
use constant BIOPERL_REQUIRES => '1.005002';
use constant PROSERVER_DEFAULT => '2.8';
$version = GD_REQUIRES;
CPAN::Shell->install('GD') unless ( eval "use GD $version; 1" );
print STDERR "\n*** Installing prerequisites for BioPerl ***\n";
my @pkgs = ('GD::SVG',
'IO::String',
'Text::Shellwords',
'CGI::Session',
'File::Temp',
'Class::Base',
'Digest::MD5',
'Statistics::Descriptive',
);
foreach (@pkgs) {
CPAN::Shell->install($_);
}
$version = BIOPERL_REQUIRES;
if (!(eval "use Bio::Perl $version; 1")) {
print STDERR "\n*** Installing BioPerl ***\n";
CPAN::Shell->install('Module::Build');
chdir $tmpdir;
my $package_name = 'bioperl-1.5.2_102';
my $bioperl_core_tar_gz = 'http://bioperl.org/DIST/current_core_unstable.tar.gz';
my $cmd = "curl -O $bioperl_core_tar_gz";
print STDERR "Downloading $package_name...\n";
system($cmd) == 0 or die "Failed to download the BioPerl Core: $!\n";
system("tar zxvf current_core_unstable.tar.gz") == 0 or die "Failed to open the archive: $!\n";
chdir "./$package_name";
my $build_str = './Build';
system("$perl $build_str.PL --yes=1") == 0
or die "Couldn't run $perl Build.PL command\n";
system("$build_str install --uninst 1");
} else {
print STDERR "BioPerl is up to date.\n";
}
print STDERR "\n *** Installing ProServer (Bio-Das-ProServer) ***\n";
@pkgs = ('File::Spec',
'POSIX',
'CGI',
'Socket',
'POE',
'Getopt::Long',
'Sys::Hostname',
'POE::Filter::HTTPD',
'POE::Wheel::ReadWrite',
'POE::Wheel::SocketFactory',
'HTTP::Request', 'HTTP::Response', 'HTTP::Date',
'Config::IniFiles',
# 'Compress::Zlib',
'HTML::Entities',
'DBI',
'LWP::UserAgent',
'Cache::FileCache',
'Net::IP',
'Bio::Das::Lite',
# 'Bio::DB::Flat::OBDAIndex', # 'Bio::DB::Flat'
# 'Bio::SeqIO',
# 'Bio::EnsEMBL::DBSQL::DBAdaptor',
# 'Bio::EnsEMBL::Registry',
# 'Bio::Pfam::Structure::Chainset',
);
foreach (@pkgs) {
CPAN::Shell->install($_);
}
my $package_name = 'Bio-Das-ProServer';
my $svn_co = "svn co https://proserver.svn.sf.net/svnroot/proserver/trunk $package_name";
print STDERR "Checking out $package_name...\n";
chdir $tmpdir;
system($svn_co) == 0 or die "Failed to check out the ProServer from SVN: $!\n";
chdir "./$package_name";
system("$perl Makefile.PL") == 0 or die "Couldn't run $perl Makefile.PL command\n";
system("$make install UNINST=1");
print "\n\n\n* You can start proserver:\n\n",
" perl eg/proserver -x\n",
" and open http://localhost:9000\n\n";
exit 0;
END {
}