3 # $Header: /home/cvs/cvsroot/freeside/rt/tools/Attic/testdeps,v 1.1 2002-08-12 06:17:08 ivan Exp $
5 # Copyright 2000 Jesse Vincent <jesse@fsck.com>
6 # Distributed under the GNU General Public License
10 # This is just a basic script that checks to make sure that all
11 # the modules needed by RT before you can install it.
16 use vars qw($mode $dbd $module @modules);
18 $mode = shift || print_help();
19 $dbd = shift || print_help();
26 DBIx::SearchBuilder 0.48
52 if ($dbd =~ /mysql/i) {
53 push @modules, ('DBD::mysql','2.0416');
55 elsif ($dbd =~ /oracle/i) {
56 push @modules, ('DBD::Oracle','');
58 elsif ($dbd =~ /pg/i) {
59 push @modules, ('DBD::Pg','');
63 while ($module= shift @modules) {
65 $version = " ". shift (@modules) . " " if ($modules[0] =~ /^([\d\.]*)$/);
66 print "Checking for $module$version";
67 eval "use $module$version" ;
69 &resolve_dependency($module, $version)
82 $0 is a tool for RT that will tell you if you've got all
83 the modules RT depends on properly installed.
85 Flags: (only one flag is valid for a given run)
87 -quiet will check to see if we've got everything we need
88 and will exit with a return code of (1) if we don't.
90 -warn will tell you what isn't properly installed
92 -fix will use CPAN to magically make everything better
102 sub resolve_dependency {
105 print "....$module$version not installed.";
107 $module = "DBD::mysql::Install" if ($module =~ /DBD::mysql/);
109 print "Installing with CPAN...";
110 CPAN::install($module);
113 exit(1) if ($mode =~ /-q/);