-
Notifications
You must be signed in to change notification settings - Fork 0
/
INSTALL.pl
executable file
·265 lines (199 loc) · 7.73 KB
/
INSTALL.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#!/usr/bin/perl
use v5.12;
use Pod::Usage;
my $OS = $ARGV[0];
my $sudo = 'sudo ' if $ENV{USER} ne 'root';
system 'apt-get'; #-- check if apt-get is installed
my $deb_cmd = ($? ? 'aptitude' : 'apt-get' ) . ' install';
my @base = qw/
YAML
AnyEvent
Coro
Data::Random
Getopt::Long
HTML::Entities
List::MoreUtils
List::Util
Term::ANSIColor
Data::Random
File::Find::Rule
File::Which
LWP::Protocol::https
LWP::Protocol::socks
/;
my @webui = qw/
Mojolicious::Lite
HTML::FromANSI
/;
my @proxychecker = qw/
WWW::ProxyChecker
/;
my %H = (
debian => {
base => {
$sudo .$deb_cmd => [ qw/
libyaml-libyaml-perl
libanyevent-perl
libcoro-perl
libdata-random-perl
libgetopt-long-descriptive-perl
libhtml-parser-perl
liblist-moreutils-perl
libscalar-list-utils-perl
ruby-term-ansicolor
libdata-random-perl
libfile-find-rule-perl-perl
libwww-perl
liblwp-protocol-https-perl
liblwp-protocol-socks-perl
libstring-shellquote-perl
libfile-which-perl
/
]
},
webui => {
$sudo .$deb_cmd => [ 'libmojolicious-perl' ],
$sudo .'cpan' => [ 'HTML::FromANSI' ],
},
proxychecker => {
$sudo .'cpan' => [ @proxychecker ]
}
},
arch => {
base => {
$sudo .'yaourt -S' => [ qw/
perl-yaml-syck
perl-anyevent
perl-carp-clan
perl-coro
perl-data-random
perl-getopt-long
perl-html-parser
perl-list-moreutils
perl-params-util
ruby-term-ansicolor
perl-data-random
perl-file-find-rule
perl-libwww
perl-lwp-protocol-https
perl-lwp-protocol-socks
perl-string-shellquote
perl-file-which
/
]
},
webui => { $sudo .'cpan' => [ @webui ] },
proxychecker => { $sudo .'cpan' => [ @proxychecker ] },
},
gentoo => {
base => { $sudo ."g-cpan -i" => [ @base, 'String::ShellQuote' ] },
webui => { $sudo ."g-cpan -i" => [ @webui ] },
proxychecker => { $sudo ."g-cpan -i" => [ @proxychecker ] },
},
windows => {
base => { 'cpan' => [ @base, 'Win32::ShellQuote' ] },
proxychecker => { 'cpan' => [ @proxychecker ] },
},
other => {
base => { $sudo ."cpan" => [ @base, 'String::ShellQuote' ] },
proxychecker => { $sudo ."cpan" => [ @proxychecker ] },
webui => { $sudo ."cpan" => [ @webui ] },
}
);
pod2usage(-verbose => 2) if !$OS or !(map { $OS =~ /^$_$/ } keys(%H));
my @parts = ();
my %parts = (
base => 'Would you like to install base modules (they all are necessary)? [y/n] ',
webui => 'Modules for web-interface? [y/n] ',
proxychecker => 'Modules for proxychecker? [y/n] ',
);
for my $p (keys %{ $H{$OS} } )
{
print $parts{$p};
yesno(sub { push @parts, $p; }, sub {} );
}
for (@parts)
{
say "---- Now installing $_ modules ----";
for my $cmd (keys %{ $H{$OS}->{$_} })
{
my @mod = @{ $H{$OS}->{$_}{$cmd} };
say "$cmd @mod\n";
system "$cmd @mod";
if ($?)
{
print "\n'$cmd @mod' exited abnormally with code $? \nContinue? [y/n] ";
yesno( sub {}, sub { exit; } );
}
}
}
sub yesno(&&)
{
my ($yes, $no) = @_;
while (1)
{
my $a = <STDIN>;
given ($a)
{
when (/y/) { return &$yes }
when (/n/) { return &$no; }
default { say 'Please answer y or n'; }
}
}
}
__END__
=head1 NAME
Install script
=head1 SYNOPSIS
./INSTALL.pl [debian|gentoo|arch|other]
perl .\INSTALL.pl windows
=head1 Linux
=over
=item *
Perl needs to be updated to 5.12 or above.
=item *
Install tesseract or tesseract-ocr (program will be used to solve captcha) and imagemagick from repositories.
Something like that
sudo apt-get install tesseract-ocr imagemagick
sudo emerge imagemagick tesseract
=item *
Install v8 library from repositories.
sudo apt-get install libv8
sudo emerge v8
=item *
If you use debian-based distro, install libssl-dev lib (is necessary for socks-proxy, https and some other things):
sudo apt-get install libssl-dev
Don't know its name in other distros. Everything is ok without this library on gentoo.
=back
=over
=item B<Install all required perl packages>
=over
=item I<Debian/Ubuntu/... (via apt and cpan)>
./INSTALL.pl debian
=item I<Gentoo (required g-cpan)
Not sure if it works.
./INSTALL.pl gentoo
=item I<Arch (via yaourt and cpan)>
./INSTALL.pl arch
=item I<Everything else (via cpan)>
Probably the best choice.
./INSTALL.pl other
=back
=back
=head2
Checked out on Gentoo (perl v5.16.2)
=head1 Windows
=head2 DOES NOT WORK
Install these programs:
=over
=item B<Perl>
http://strawberryperl.com/ or http://www.activestate.com/activeperl/downloads
=item B<Imagemagick>
http://www.imagemagick.org/script/binary-releases.php#windows
=item B<Tesseract-OCR>
http://code.google.com/p/tesseract-ocr/downloads/list
=back
=over
=item B<Install all required perl packages>
perl \.INSTALL.pl windows
=back