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

raeburn raeburn at source.lon-capa.org
Fri Apr 26 23:13:56 EDT 2024


raeburn		Sat Apr 27 03:13:56 2024 EDT

  Modified files:              
    /doc/install/linux	install.pl 
  Log:
  - Separate major version and minor version in version number for mariadb 
    and mysql, so correct actions are taken (e.g., for mariadb 10.11.6). 
  
  
Index: doc/install/linux/install.pl
diff -u doc/install/linux/install.pl:1.86 doc/install/linux/install.pl:1.87
--- doc/install/linux/install.pl:1.86	Sat Apr 27 02:56:13 2024
+++ doc/install/linux/install.pl	Sat Apr 27 03:13:56 2024
@@ -78,7 +78,7 @@
           &mt('Stopping execution.')."\n";
     exit;
 } else {
-    print LOG '$Id: install.pl,v 1.86 2024/04/27 02:56:13 raeburn Exp $'."\n";
+    print LOG '$Id: install.pl,v 1.87 2024/04/27 03:13:56 raeburn Exp $'."\n";
 }
 
 #
@@ -1553,8 +1553,8 @@
     my ($instdir,$dsn,$distro) = @_;
     my ($mysqlsetup,$has_pass,$mysql_unix_socket,$mysql_has_wwwuser);
     my $dbh = DBI->connect($dsn,'root','',{'PrintError'=>0});
-    my ($mysqlversion,$mysqlsubver,$mysqlname) = &get_mysql_version();
-    if (($mysqlname =~ /^MariaDB/i) && ($mysqlversion >= 10.4)) {
+    my ($mysqlversion,$mysqlminorversion,$mysqlsubver,$mysqlname) = &get_mysql_version();
+    if (($mysqlname =~ /^MariaDB/i) && (($mysqlversion == 10 && $mysqlminorversion >= 4) || ($mysqlversion >= 11))) {
         if ($dbh) {
             my $sth = $dbh->prepare("SELECT Priv FROM mysql.global_priv WHERE (User = 'root' AND Host ='localhost')");
             $sth->execute();
@@ -1575,7 +1575,7 @@
     }
     if ($dbh) {
         $mysqlsetup = 'noroot';
-        if (($mysqlname !~ /^MariaDB/i) && ($mysqlversion >= 5.7)) {
+        if (($mysqlname !~ /^MariaDB/i) && (($mysqlversion == 5 && $mysqlminorversion >= 7) || ($mysqlversion >= 6))) {
             my $sth = $dbh->prepare("SELECT plugin from mysql.user where User='root'");
             $sth->execute();
             while (my $priv = $sth->fetchrow_array) {
@@ -2653,21 +2653,23 @@
 
 sub setup_mysql_permissions {
     my ($dbh,$has_pass,$mysql_unix_socket, at mysql_lc_commands) = @_;
-    my ($mysqlversion,$mysqlsubver,$mysqlname) = &get_mysql_version();
+    my ($mysqlversion,$mysqlminorversion,$mysqlsubver,$mysqlname) = &get_mysql_version();
     my ($usescreate,$usesauth,$is_mariadb,$hasauthcol, at mysql_commands);
     if ($mysqlname =~ /^MariaDB/i) {
         $is_mariadb = 1;
-        if ($mysqlversion >= 10.4) {
+        if ((($mysqlversion == 10) && ($mysqlminorversion >= 4)) || ($mysqlversion >= 11)) {
             $usescreate = 1;
-        } elsif ($mysqlversion >= 10.2) {
+        } elsif (($mysqlversion == 10) && ($mysqlminorversion >= 2)) { 
             $usesauth = 1;
-        } elsif ($mysqlversion >= 5.5) {
+        } elsif (($mysqlversion == 5) && ($mysqlminorversion >= 5)) {
             $hasauthcol = 1;
         }
     } else {
-        if (($mysqlversion > 5.7) || (($mysqlversion == 5.7) && ($mysqlsubver > 5))) {
+        if (($mysqlversion > 5) || (($mysqlminorversion == 5) && ($mysqlminorversion > 7)) ||
+            (($mysqlversion == 5) && ($mysqlminorversion == 7) && ($mysqlsubver > 5))) {
             $usesauth = 1;
-        } elsif (($mysqlversion >= 5.6) || (($mysqlversion == 5.5) && ($mysqlsubver >= 7))) {
+        } elsif (($mysqlversion == 5) &&
+                 (($mysqlminorversion >= 6) || (($mysqlminorversion == 5) && ($mysqlsubver >= 7)))) {
             $hasauthcol = 1;
         }
     }
@@ -2781,17 +2783,17 @@
 }
 
 sub get_mysql_version {
-    my ($version,$subversion,$name);
+    my ($version,$minorversion,$subversion,$name);
     if (open(PIPE," mysql -V |")) {
         my $info = <PIPE>;
         chomp($info);
         close(PIPE);
-        ($version,$subversion,$name) = ($info =~ /(\d+\.\d+)\.(\d+)(?:\-?(\w*),|)/);
+        ($version,$minorversion,$subversion,$name) = ($info =~ /(\d+)\.(\d+)\.(\d+)(?:\-?(\w*),|)/);
     } else {
         print &mt('Could not determine which version of MySQL is installed.').
               "\n";
     }
-    return ($version,$subversion,$name);
+    return ($version,$minorversion,$subversion,$name);
 }
 
 ###########################################################




More information about the LON-CAPA-cvs mailing list