-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.PL
More file actions
129 lines (106 loc) · 3.41 KB
/
Makefile.PL
File metadata and controls
129 lines (106 loc) · 3.41 KB
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
# $Id: Makefile.PL,v 1.30 2008/10/02 18:53:25 turnstep Exp $
use strict;
use 5.006;
use ExtUtils::MakeMaker qw(prompt WriteMakefile);
my %prereq = (
'Digest::MD5' => 0,
'IO::Socket' => 0,
);
my %SSH_PREREQ = (
1 => {
'String::CRC32' => '1.2',
'Math::GMP' => '1.04',
'Scalar::Util' => 0,
},
2 => {
'Digest::SHA1' => '2.10',
'Digest::HMAC_MD5' => 0,
'Digest::HMAC_SHA1' => 0,
'Crypt::DSA' => '0.11',
'Crypt::DH' => '0.01',
'Math::Pari' => '2.001804',
'MIME::Base64' => 0,
'Convert::PEM' => '0.05',
},
);
$SSH_PREREQ{3} = { map %{$SSH_PREREQ{$_}}, 1..2 };
print<<MSG;
This is Net::SSH::Perl.
As of version 1.00, Net::SSH::Perl supports both the SSH1 and
SSH2 protocols natively. The two protocols have different
module prerequisitives, so you need to decide which protocol(s)
you plan to use. If you use one or the other, only those modules
for your chosen protocol will be installed; if you choose both,
all of the supporting modules will be installed. Please choose
the protocols you'd like to use from the following list ("Both"
is the default).
MSG
printf " [%d] SSH%d\n", $_, $_ for 1..2;
printf " [3] Both SSH1 and SSH2\n";
my $p = prompt("\nWhich protocol(s) do you plan to use?", 3);
print "\n";
@prereq{keys %{$SSH_PREREQ{$p}}} = values %{$SSH_PREREQ{$p}};
my @cryptmod = (
[ 'IDEA', 'Crypt::IDEA' ],
[ 'DES','Crypt::DES' ],
[ 'DES3', 'Crypt::DES' ],
[ 'Blowfish', 'Crypt::Blowfish' ],
[ 'RC4', '' ],
);
print<<MSG;
Some of the Net::SSH::Perl ciphers depend on a Crypt:: module from
CPAN. You may already have the necessary modules installed, in which
case you don't need to bother with this step. Otherwise you'll need
to install at least one cipher to use Net::SSH::Perl. Please choose
at least one from the following list (Crypt::IDEA is the default).
MSG
my $i = 1;
for my $ciph(sort { $a->[0] <=> $b->[0] } @cryptmod) {
printf " [%d] %s\n", $i++, $ciph->[0];
}
my $c = prompt("\nEnter your choices, separated by spaces:", 1);
print "\n";
for my $id(split /\s+/, $c) {
next unless $cryptmod[$id-1]->[1];
$prereq{$cryptmod[$id-1]->[1]} = '0';
}
print "Checking for optional modules\n\n";
unless (have_module('Digest::BubbleBabble', 0.01)) {
print<<MSG, "\n";
Digest::BubbleBabble is required if you want to generate bubble babble
key fingerprints with pssh-keygen.
MSG
if (read_yes_or_no("Would you like to install it? (y/n)", "y")) {
$prereq{'Digest::BubbleBabble'} = '0.01';
}
print "\n";
}
unless (have_module('Crypt::RSA', 1.37)) {
print<<MSG, "\n";
Crypt::RSA is required if you wish to use the ssh-rsa public
key algorithm (ssh-dss is used by default).
MSG
if (read_yes_or_no("Would you like to install it? (y/n)", "y")) {
$prereq{'Crypt::RSA'} = '1.37';
}
print "\n";
}
WriteMakefile(
NAME => 'Net::SSH::Perl',
DISTNAME => 'Net-SSH-Perl',
VERSION_FROM => 'lib/Net/SSH/Perl.pm',
PREREQ_PM => \%prereq,
AUTHOR => 'David Robins <dbrobins@cpan.org>',
ABSTRACT => 'Perl client interface to SSH',
NO_META => 1,
);
sub read_yes_or_no {
my($prompt, $def) = @_;
my $ans = prompt($prompt, $def);
$ans =~ /^y/i;
}
sub have_module {
my($name, $ver) = @_;
eval("use $name" . ($ver ? " $ver;" : ";"));
!$@;
}