blob: ddc338107db83e607df6bd1e8586ce96cdce3ecd (
plain)
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
|
#!/usr/bin/perl -w
# $Header: /home/cvs/cvsroot/freeside/rt/tools/Attic/testdeps,v 1.1 2002-08-12 06:17:08 ivan Exp $
# Copyright 2000 Jesse Vincent <jesse@fsck.com>
# Distributed under the GNU General Public License
#
#
# This is just a basic script that checks to make sure that all
# the modules needed by RT before you can install it.
#
use strict;
use vars qw($mode $dbd $module @modules);
$mode = shift || print_help();
$dbd = shift || print_help();
@modules = qw(
Digest::MD5
Storable
DBI 1.18
DBIx::DataSource 0.02
DBIx::SearchBuilder 0.48
HTML::Entities
MLDBM
Net::Domain
Net::SMTP
Params::Validate 0.02
HTML::Mason 1.02
CGI::Cookie 1.20
Apache::Cookie
Apache::Session 1.53
Date::Parse
Date::Format
MIME::Entity 5.108
Mail::Mailer 1.20
Getopt::Long 2.24
Tie::IxHash
Text::Wrapper
Text::Template
File::Spec 0.8
Errno
FreezeThaw
File::Temp
Log::Dispatch 1.6
);
if ($dbd =~ /mysql/i) {
push @modules, ('DBD::mysql','2.0416');
}
elsif ($dbd =~ /oracle/i) {
push @modules, ('DBD::Oracle','');
}
elsif ($dbd =~ /pg/i) {
push @modules, ('DBD::Pg','');
}
use CPAN;
while ($module= shift @modules) {
my $version = "";
$version = " ". shift (@modules) . " " if ($modules[0] =~ /^([\d\.]*)$/);
print "Checking for $module$version";
eval "use $module$version" ;
if ($@) {
&resolve_dependency($module, $version)
}
else {
print "...found\n";
}
}
sub print_help {
print <<EOF;
$0 FLAG DBTYPE
$0 is a tool for RT that will tell you if you've got all
the modules RT depends on properly installed.
Flags: (only one flag is valid for a given run)
-quiet will check to see if we've got everything we need
and will exit with a return code of (1) if we don't.
-warn will tell you what isn't properly installed
-fix will use CPAN to magically make everything better
DBTYPE is one of:
oracle, pg, mysql
EOF
exit(0);
}
sub resolve_dependency {
my $module = shift;
my $version = shift;
print "....$module$version not installed.";
if ($mode =~ /-f/) {
$module = "DBD::mysql::Install" if ($module =~ /DBD::mysql/);
print "Installing with CPAN...";
CPAN::install($module);
}
print "\n";
exit(1) if ($mode =~ /-q/);
}
|