[LON-CAPA-cvs] cvs: doc /install/fedora install.pl

raeburn lon-capa-cvs@mail.lon-capa.org
Wed, 29 Jun 2005 04:16:56 -0000


raeburn		Wed Jun 29 00:16:56 2005 EDT

  Modified files:              
    /doc/install/fedora	install.pl 
  Log:
  Mysql 4 db table (FC4) requires more fields for entry for user www, than Mysql 3 (FC1, 2 and 3). 
  
  
Index: doc/install/fedora/install.pl
diff -u doc/install/fedora/install.pl:1.7 doc/install/fedora/install.pl:1.8
--- doc/install/fedora/install.pl:1.7	Thu Mar 24 16:42:46 2005
+++ doc/install/fedora/install.pl	Wed Jun 29 00:16:54 2005
@@ -2,7 +2,7 @@
 # The LearningOnline Network 
 # Fedora installation script
 #
-# $Id: install.pl,v 1.7 2005/03/24 21:42:46 matthew Exp $
+# $Id: install.pl,v 1.8 2005/06/29 04:16:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -35,7 +35,7 @@
 # note: The filehandle LOG is global.
 open LOG,">>loncapa_install.log" || die "Unable to open log file.\n";
 
-print LOG '$Id: install.pl,v 1.7 2005/03/24 21:42:46 matthew Exp $'."\n";
+print LOG '$Id: install.pl,v 1.8 2005/06/29 04:16:54 raeburn Exp $'."\n";
 
 # Some friendly subroutines
 sub die_if_nonempty {
@@ -312,6 +312,14 @@
     }
     print_and_log("\n");
     #
+
+    my ($mysqlinfo,$mysql_ver);
+    open(PIPE,"/usr/bin/mysql -V  |");
+    $mysqlinfo = <PIPE>;
+    close(PIPE);
+    if ($mysqlinfo =~ /Distrib\s+([\d]+)\./) {
+        $mysql_ver = $1;
+    }
     my $mysql_commands = "CREATE DATABASE loncapa;\n";
     if ($setup_mysql_permissions) {
 	##
@@ -324,10 +332,20 @@
 END
         my $rootpass = <>;
 	chomp $rootpass;
-	$mysql_commands .= <<"END";
+	$mysql_commands .= <<"BLOCKONE";
 INSERT INTO user (Host, User, Password)
 VALUES ('localhost','www',password('localhostkey'));
+BLOCKONE
+        if ($mysql_ver < 4) {
+            $mysql_commands .=<<"BLOCKTWO";
 INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv) VALUES ('localhost','loncapa','www','Y','Y','Y','Y','Y','Y','N','Y','Y','Y');
+BLOCKTWO
+        } else {
+            $mysql_commands .=<<"BLOCKTHREE";
+INSERT INTO db (Host,Db,User,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Grant_priv,References_priv,Index_priv,Alter_priv,Create_tmp_table_priv,Lock_tables_priv) VALUES ('localhost','loncapa','www','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y');
+BLOCKTHREE
+        }
+        $mysql_commands .=<<"END"; 
 SET PASSWORD FOR root\@localhost=PASSWORD('$rootpass');
 DELETE FROM user WHERE host<>'localhost';
 FLUSH PRIVILEGES;