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

raeburn raeburn at source.lon-capa.org
Sun Jul 7 19:37:55 EDT 2019


raeburn		Sun Jul  7 23:37:55 2019 EDT

  Modified files:              (Branch: version_2_11_X)
    /doc/install/linux	install.pl 
  Log:
  - For 2.11
    Backport 1.53, 1.54, 1.55, 1.56, 1.57
  
  
-------------- next part --------------
Index: doc/install/linux/install.pl
diff -u doc/install/linux/install.pl:1.45.2.2 doc/install/linux/install.pl:1.45.2.3
--- doc/install/linux/install.pl:1.45.2.2	Tue Feb 19 19:24:28 2019
+++ doc/install/linux/install.pl	Sun Jul  7 23:37:54 2019
@@ -75,7 +75,7 @@
           &mt('Stopping execution.')."\n";
     exit;
 } else {
-    print LOG '$Id: install.pl,v 1.45.2.2 2019/02/19 19:24:28 raeburn Exp $'."\n";
+    print LOG '$Id: install.pl,v 1.45.2.3 2019/07/07 23:37:54 raeburn Exp $'."\n";
 }
 
 #
@@ -164,7 +164,18 @@
 sub get_distro {
     my ($distro,$gotprereqs,$updatecmd,$packagecmd,$installnow,$unknown);
     $packagecmd = '/bin/rpm -q LONCAPA-prerequisites ';
-    if (-e '/etc/redhat-release') {
+    if (-e '/etc/oracle-release') {
+        open(IN,'</etc/oracle-release');
+        my $versionstring=<IN>;
+        chomp($versionstring);
+        close(IN);
+        if ($versionstring =~ /^Oracle Linux Server release (\d+)/) {
+            my $version = $1;
+            $distro = 'oracle'.$1;
+            $updatecmd = 'yum install LONCAPA-prerequisites';
+            $installnow = 'yum -y install LONCAPA-prerequisites';
+        }
+    } elsif (-e '/etc/redhat-release') {
         open(IN,'</etc/redhat-release');
         my $versionstring=<IN>;
         chomp($versionstring);
@@ -194,6 +205,10 @@
             $distro = 'rhes'.$1;
             $updatecmd = 'yum install LONCAPA-prerequisites';
             $installnow = 'yum -y install LONCAPA-prerequisites';
+        } elsif ($versionstring =~ /Red Hat Enterprise Linux release (\d+)/) {
+            $distro = 'rhes'.$1;
+            $updatecmd = 'dnf install LONCAPA-prerequisites';
+            $installnow = 'dnf -y install LONCAPA-prerequisites';
         } elsif ($versionstring =~ /CentOS(?:| Linux) release (\d+)/) {
             $distro = 'centos'.$1;
             $updatecmd = 'yum install LONCAPA-prerequisites';
@@ -306,7 +321,7 @@
                 $unknown = 1;
             }
         } else {
-            print &mt('Unknown installation: expecting a debian, ubuntu, suse, sles, redhat, fedora or scientific linux system.')."\n";
+            print &mt('Unknown installation: expecting a debian, ubuntu, suse, sles, redhat, fedora, scientific linux, or oracle linux system.')."\n";
         }
     }
     return ($distro,$packagecmd,$updatecmd,$installnow);
@@ -372,7 +387,7 @@
             print &mt('Failed to open: [_1], default locale not checked.',
                       '/etc/sysconfig/i18n');
         }
-    } elsif ($distro =~ /^(?:rhes|centos|scientific)(\d+)/) {
+    } elsif ($distro =~ /^(?:rhes|centos|scientific|oracle)(\d+)/) {
         if ($1 >= 7) {
             if (!open($fh,"</etc/locale.conf")) {
                 print &mt('Failed to open: [_1], default locale not checked.',
@@ -401,9 +416,13 @@
                     $command = 'sudo locale-gen en_US.UTF-8'."\n".
                                'sudo update-locale LANG=en_US.UTF-8';
                 } elsif ($distro =~ /^(suse|sles)/) {
-                    $command = 'yast language'; 
-                } else {
+                    $command = 'yast language';
+                } elsif (-e '/usr/bin/system-config-language') {
                     $command = 'system-config-language';
+                } elsif (-e '/usr/bin/localectl') {
+                    $command = 'localectl set-locale en_US.UTF-8';
+                } else {
+                    $command = 'No standard command found';
                 }
             }
             last;
@@ -499,7 +518,7 @@
         if ($1 >= 19) {
             $mysqldaemon ='mariadb';
         }
-    } elsif ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) {
+    } elsif ($distro =~ /^(?:centos|rhes|scientific|oracle)(\d+)/) {
         if ($1 >= 7) {
             $mysqldaemon ='mariadb';
             $process = 'mysqld';
@@ -640,7 +659,7 @@
         if ($version >= 19) {
             $daemon{'mysql'} = 'mariadb';
         }
-    } elsif ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) {
+    } elsif ($distro =~ /^(?:centos|rhes|scientific|oracle)(\d+)/) {
         my $version = $1;
         if ($version >= 7) {
             $uses_systemctl{'ntp'} = 1;
@@ -650,6 +669,9 @@
             $uses_systemctl{'cups'} = 1;
             $daemon{'mysql'} = 'mariadb';
         }
+        if (($version >= 8) || ($distro eq 'oracle7')) {
+            $daemon{'ntp'} = 'chronyd';
+        }
     }
     my $nocheck;
     if (! -x $checker_bin) {
@@ -744,7 +766,7 @@
 
 sub uses_firewalld {
     my ($distro) = @_;
-    my ($inuse, $checkfirewalld);
+    my ($inuse,$checkfirewalld,$zone);
     if ($distro =~ /^(suse|sles)([\d\.]+)$/) {
         if (($1 eq 'sles') && ($2 >= 15)) {
             $checkfirewalld = 1;
@@ -753,7 +775,7 @@
         if ($1 >= 18) {
             $checkfirewalld = 1;
         }
-    } elsif ($distro =~ /^(?:centos|rhes|scientific)(\d+)/) {
+    } elsif ($distro =~ /^(?:centos|rhes|scientific|oracle)(\d+)/) {
         if ($1 >= 7) {
             $checkfirewalld = 1;
         }
@@ -774,9 +796,18 @@
         }
         if (($loaded eq 'loaded') || ($active eq 'active')) {
             $inuse = 1;
+            my $cmd = 'firewall-cmd --get-default-zone';
+            if (open(PIPE,"$cmd |")) {
+                my $result = <PIPE>;
+                chomp($result);
+                close(PIPE);
+                if ($result =~ /^\w+$/) {
+                    $zone = $result;
+                }
+            }
         }
     }
-    return $inuse;
+    return ($inuse,$zone);
 }
 
 sub chkfirewall {
@@ -787,19 +818,20 @@
                     https => 443,
                 );
     my %activefw;
-    if (&firewall_is_active()) {
-        if (&uses_firewalld($distro)) {
-            my %current;
-            if (open(PIPE,'firewall-cmd --permanent --zone=public --list-services |')) {
-                my $svc = <PIPE>;
-                close(PIPE);
-                chomp($svc);
-                map { $current{$_} = 1; } (split(/\s+/,$svc));
-            }
-            if ($current{'http'} && $current{'https'}) {
-                $configfirewall = 0;
-            }
-        } else {
+    my ($firewalld,$zone) = &uses_firewalld($distro);
+    if ($firewalld) {
+        my %current;
+        if (open(PIPE,'firewall-cmd --permanent --zone='.$zone.' --list-services |')) {
+            my $svc = <PIPE>;
+            close(PIPE);
+            chomp($svc);
+            map { $current{$_} = 1; } (split(/\s+/,$svc));
+        }
+        if ($current{'http'} && $current{'https'}) {
+            $configfirewall = 0;
+        }
+    } else {
+        if (&firewall_is_active()) {
             my $iptables = &get_pathto_iptables();
             if ($iptables eq '') {
                 print &mt('Firewall not checked as path to iptables not determined.')."\n";
@@ -821,9 +853,9 @@
                     print &mt('Firewall not checked as iptables Chains not identified.')."\n";
                 }
             }
+        } else {
+            print &mt('Firewall not enabled.')."\n";
         }
-    } else {
-        print &mt('Firewall not enabled.')."\n";
     }
     return ($configfirewall,\%activefw);
 }
@@ -921,7 +953,7 @@
         }
     } else {
         my $configfile = 'httpd.conf';
-        if ($distro =~ /^(?:centos|rhes|scientific)(\d+)$/) {
+        if ($distro =~ /^(?:centos|rhes|scientific|oracle)(\d+)$/) {
             if ($1 >= 7) {
                 $configfile = 'apache2.4/httpd.conf';
             } elsif ($1 > 5) {
@@ -1407,7 +1439,7 @@
     print "\n".&mt('Linux distribution could not be verified as a supported distribution.')."\n".
           &mt('The following are supported: [_1].',
               'CentOS, RedHat Enterprise, Fedora, Scientific Linux, '.
-              'openSuSE, SLES, Ubuntu LTS, Debian')."\n\n".
+              'Oracle Linux, openSuSE, SLES, Ubuntu LTS, Debian')."\n\n".
           &mt('Stopping execution.')."\n";
     exit;
 }
@@ -1608,9 +1640,10 @@
 }
 
 if ($callsub{'firewall'}) {
-    if (&uses_firewalld($distro)) {
+    my ($firewalld,$zone) = &uses_firewalld($distro);
+    if ($firewalld) {
         my (%current,%added);
-        if (open(PIPE,'firewall-cmd --permanent --zone=public --list-services |')) {
+        if (open(PIPE,"firewall-cmd --permanent --zone=$zone --list-services |")) {
             my $svc = <PIPE>;
             close(PIPE);
             chomp($svc);
@@ -1618,7 +1651,7 @@
         }
         foreach my $service ('http','https') {
             unless ($current{$service}) {
-                if (open(PIPE,"firewall-cmd --permanent --zone=public --add-service=$service |")) {
+                if (open(PIPE,"firewall-cmd --permanent --zone=$zone --add-service=$service |")) {
                     my $result = <PIPE>;
                     if ($result =~ /^success/) {
                         $added{$service} = 1;
@@ -1636,7 +1669,7 @@
         }
         unless ($current{'ssh'}) {
             print &mt('If you would the like to allow access to ssh from outside, use the command[_1].',
-                  'firewall-cmd --permanent --zone=public --add-service=ssh')."\n";
+                  "firewall-cmd --permanent --zone=$zone --add-service=ssh")."\n";
         }
     } elsif ($distro =~ /^(suse|sles)/) {
         print &mt('Use [_1] to configure the firewall to allow access for [_2].',
@@ -1658,14 +1691,24 @@
                 }
             }
         }
-    } elsif ($distro =~ /^scientific/) {
+    } elsif ($distro =~ /^(scientific|oracle)/) {
         print &mt('Use [_1] to configure the firewall to allow access for [_2].',
                   'system-config-firewall-tui -- Customize',
                   'ssh, http')."\n";
     } else {
-        print &mt('Use [_1] to configure the firewall to allow access for [_2].',
-                  'setup -- Firewall configuration -> Customize',
-                  'ssh, http, https')."\n";
+        my $version;
+        if ($distro =~ /^(redhat|centos)(\d+)$/) {
+            $version = $1;
+        }
+        if ($version > 5) {
+            print &mt('Use [_1] to configure the firewall to allow access for [_2].',
+                  'system-config-firewall-tui -- Customize',
+                  'ssh, http')."\n";
+        } else {
+            print &mt('Use [_1] to configure the firewall to allow access for [_2].',
+                      'setup -- Firewall configuration -> Customize',
+                      'ssh, http, https')."\n";
+        }
     }
 } else {
     &print_and_log(&mt('Skipping Firewall configuration.')."\n");
@@ -2098,7 +2141,7 @@
 sub copy_httpd_conf {
     my ($instdir,$distro) = @_;
     my $configfile = 'httpd.conf';
-    if ($distro =~ /^(?:centos|rhes|scientific)(\d+)$/) {
+    if ($distro =~ /^(?:centos|rhes|scientific|oracle)(\d+)$/) {
         if ($1 >= 7) {
             $configfile = 'apache2.4/httpd.conf';
         } elsif ($1 > 5) {


More information about the LON-CAPA-cvs mailing list