Test to ensure that libdbdpgsql.so is linked against libdbi.so
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 1 Nov 2007 02:30:45 +0000 (02:30 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 1 Nov 2007 02:30:45 +0000 (02:30 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@7953 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/support-scripts/settings-tester.pl

index 57cb58b..c27b268 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/perl
+# vim:noet:ts=4:
 
 BEGIN {
        eval "use Error qw/:try/;";
@@ -82,7 +83,6 @@ my $res = $sparser->initialize($settings_config);
 my $sconfig = $sparser->get_server_config($hostname);
 my $db_config = $sconfig->{apps}->{'open-ils.storage'}->{app_settings}->{databases}->{database};
 
-
 # grab the open-ils.storage database settings
 my $db_host = $db_config->{host};
 my $db_user = $db_config->{user};
@@ -106,11 +106,35 @@ try {
 print "* Successfully connected to database $dsn\n" unless ($de);
 $output .= ($de) ? $de : "* Successfully connected to database $dsn\n";
 
+$output .= check_libdbd();
 
 if ($gather) {
        get_debug_info( $tmpdir, $log_dir, $conf_dir, $perloutput, $output );
 }
 
+sub check_libdbd {
+       my $results;
+       my $de = undef;
+       my @location = `locate libdbdpgsql.so`;
+       if ($location > 1) {
+
+               my $res = "Found more than one location for libdbdpgsql.so.
+  We have found that system packages don't link against libdbi.so;
+  therefore, we strongly recommend compiling libdbi and libdbi-drivers from source.\n";
+               $results .= $res;
+               print $res;
+       }
+       foreach my $loc (@location) {
+               my @linkage = `ldd $loc`;
+               if (!grep(/libdbi/, @linkage)) {
+                       my $res = "libdbi.so was not linked against $loc - you probably need to compile from source.\n";
+                       $results .= $res;
+                       print $res;
+               }
+       }
+       return $results;
+}
+
 sub get_debug_info {
   my $temp_dir = shift; # place we can write files
   my $log = shift; # location of the log directory