[LON-CAPA-cvs] cvs: loncom /metadata_database configure_mysql_db.pl

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 22 Aug 2003 22:30:50 -0000


albertel		Fri Aug 22 18:30:50 2003 EDT

  Modified files:              
    /loncom/metadata_database	configure_mysql_db.pl 
  Log:
  - should run on the latest rawhide release correctly now (along with 7.3)
  - (rawhide is using MySQL 4.X)
     - 2 more permissions were added
     - new rpm package name added
  - eval "use DBI;" seems to not really use it, need to do another use if the first use succeeds
  
  
  
Index: loncom/metadata_database/configure_mysql_db.pl
diff -u loncom/metadata_database/configure_mysql_db.pl:1.2 loncom/metadata_database/configure_mysql_db.pl:1.3
--- loncom/metadata_database/configure_mysql_db.pl:1.2	Tue Jul 22 15:24:35 2003
+++ loncom/metadata_database/configure_mysql_db.pl	Fri Aug 22 18:30:50 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network 
 # Red Hat 7.3 installation script
 #
-# $Id: configure_mysql_db.pl,v 1.2 2003/07/22 19:24:35 matthew Exp $
+# $Id: configure_mysql_db.pl,v 1.3 2003/08/22 22:30:50 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -32,8 +32,13 @@
 if (! defined($runstatus)) {
     $runstatus = 'firstrun';
 }
-
-my $rpmname = "perl-DBD-MySQL-1.2216-4.i386.rpm";
+my $rhver=`perl ../build/distprobe`;
+my $rpmname;
+if ($rhver eq 'redhat9') {
+    $rpmname = "perl-DBD-MySQL-2.9002-1.i386.rpm";
+} else {
+    $rpmname = "perl-DBD-MySQL-1.2216-4.i386.rpm";
+}
 
 my $perlvar = &LONCAPA::Configuration::read_conf('loncapa.conf');
 delete($perlvar->{'lonReceipt'}); # remove since sensitive and not needed
@@ -79,6 +84,8 @@
     chomp $rootpass;
     print("\n");
 
+    my $extraargs;
+    if ($rhver eq 'redhat9') { $extraargs=",'Y','Y'"; }
     print("Starting mysql client and setting up permissions\n");
     open MYSQL, "|mysql -u root mysql" || die "Unable to start mysql\n";
     print MYSQL <<"ENDMYSQLPERMISSIONINIT";
@@ -87,7 +94,7 @@
 INSERT IGNORE INTO user (Host, User, Password)
     VALUES ('localhost','www',password('localhostkey'));
 INSERT IGNORE INTO db VALUES ('localhost','loncapa','www',
-    'Y','Y','Y','Y','Y','Y','N','Y','Y','Y');
+    'Y','Y','Y','Y','Y','Y','N','Y','Y','Y'$extraargs);
 SET PASSWORD FOR root\@localhost=PASSWORD('$rootpass');
 DELETE FROM user WHERE host<>'localhost';
 FLUSH PRIVILEGES;
@@ -101,6 +108,8 @@
     print "Your system is misconfigured.  ".
         "You are missing the perl DBI package\n";
     exit 1;
+} else {
+    use DBI;
 }
 
 my $dbh;