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

raeburn raeburn at source.lon-capa.org
Sat May 2 20:48:28 EDT 2020


raeburn		Sun May  3 00:48:28 2020 EDT

  Modified files:              (Branch: version_2_11_X)
    /doc/install/linux	install.pl 
  Log:
  - For 2.11
    Backport 1.63, 1.64, 1.65, 1.66
  
  
-------------- next part --------------
Index: doc/install/linux/install.pl
diff -u doc/install/linux/install.pl:1.45.2.6 doc/install/linux/install.pl:1.45.2.7
--- doc/install/linux/install.pl:1.45.2.6	Tue Dec  3 21:55:02 2019
+++ doc/install/linux/install.pl	Sun May  3 00:48:28 2020
@@ -75,7 +75,7 @@
           &mt('Stopping execution.')."\n";
     exit;
 } else {
-    print LOG '$Id: install.pl,v 1.45.2.6 2019/12/03 21:55:02 raeburn Exp $'."\n";
+    print LOG '$Id: install.pl,v 1.45.2.7 2020/05/03 00:48:28 raeburn Exp $'."\n";
 }
 
 #
@@ -357,23 +357,26 @@
 
 sub check_locale {
     my ($distro) = @_;
-    my ($fh,$langvar,$command);
+    my ($fh,$langvar,$command,$earlyout);
     $langvar = 'LANG';
     if ($distro =~ /^(ubuntu|debian)/) {
         if (!open($fh,"</etc/default/locale")) {
             print &mt('Failed to open: [_1], default locale not checked.',
                       '/etc/default/locale');
+            $earlyout = 1;
         }
     } elsif ($distro =~ /^(suse|sles)(\d+)/) {
         if (($1 eq 'sles') && ($2 >= 15)) {
             if (!open($fh,"</etc/locale.conf")) {
                 print &mt('Failed to open: [_1], default locale not checked.',
                           '/etc/locale.conf');
+                $earlyout = 1;
             }
         } else {
             if (!open($fh,"</etc/sysconfig/language")) {
                 print &mt('Failed to open: [_1], default locale not checked.',
                           '/etc/sysconfig/language');
+                $earlyout = 1;
             }
             $langvar = 'RC_LANG';
         }
@@ -382,27 +385,33 @@
             if (!open($fh,"</etc/locale.conf")) {
                 print &mt('Failed to open: [_1], default locale not checked.',
                           '/etc/locale.conf');
+                $earlyout = 1;
             }
         } elsif (!open($fh,"</etc/sysconfig/i18n")) {
             print &mt('Failed to open: [_1], default locale not checked.',
                       '/etc/sysconfig/i18n');
+            $earlyout = 1;
         }
     } 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.',
                           '/etc/locale.conf');
+                $earlyout = 1;
             }
         } elsif (!open($fh,"</etc/sysconfig/i18n")) {
             print &mt('Failed to open: [_1], default locale not checked.',
                       '/etc/sysconfig/i18n');
+            $earlyout = 1;
         }
     } else {
         if (!open($fh,"</etc/sysconfig/i18n")) {
             print &mt('Failed to open: [_1], default locale not checked.',
                       '/etc/sysconfig/i18n');
+            $earlyout = 1;
         }
     }
+    return if ($earlyout);
     my @data = <$fh>;
     chomp(@data);
     foreach my $item (@data) {
@@ -920,6 +929,20 @@
                 }
             }
         }
+        if ((!$fixapache) && ($distname eq 'ubuntu')) {
+            my $sitestatus = "/etc/apache2/mods-available/status.conf";
+            my $stdstatus = "$instdir/debian-ubuntu/status.conf";
+            if ((-e $stdstatus) && (-e $sitestatus)) {
+                if (open(PIPE, "diff --brief $stdstatus $sitestatus |")) {
+                    my $diffres = <PIPE>;
+                    close(PIPE);
+                    chomp($diffres);
+                    if ($diffres) {
+                        $fixapache = 1;
+                    }
+                }
+            }
+        }
     } elsif ($distro =~ /^(suse|sles)([\d\.]+)$/) {
         my ($name,$version) = ($1,$2);
         my $apache = 'apache';
@@ -2145,7 +2168,7 @@
         my $info = <PIPE>;
         chomp($info);
         close(PIPE);
-        ($version,$subversion,$name) = ($info =~ /(\d+\.\d+)\.(\d+)\-?(\w*),/);
+        ($version,$subversion,$name) = ($info =~ /(\d+\.\d+)\.(\d+)(?:\-?(\w*),|)/);
     } else {
         print &mt('Could not determine which version of MySQL is installed.').
               "\n";
@@ -2256,35 +2279,116 @@
     if (($distname eq 'ubuntu') && ($version > 12)) {
         $defaultconfig = "$apache2_sites_enabled_dir/000-default.conf";
     }
-    if (-l $defaultconfig) {
-        unlink($defaultconfig);
-    }
+    my ($skipconf,$skipsite,$skipstatus);
     if (($distname eq 'ubuntu') && ($version > 12)) {
-        print_and_log(&mt('Copying loncapa [_1] config file to [_2] and pointing [_3] to it from conf-enabled.',"'apache2'","'/etc/apache2/conf-available'","'loncapa.conf symlink'")."\n");
         my $apache2_conf_enabled_dir = '/etc/apache2/conf-enabled';
         my $apache2_conf_available_dir = '/etc/apache2/conf-available';
-        if (-e "$apache2_conf_available_dir/loncapa") {
-            copy("$apache2_conf_available_dir/loncapa","$apache2_conf_available_dir/loncapa.original");
-        }
         my $defaultconf = $apache2_conf_enabled_dir.'/loncapa.conf';
-        copy("$instdir/debian-ubuntu/ubuntu14/loncapa_conf","$apache2_conf_available_dir/loncapa");
-        chmod(0444,"$apache2_conf_available_dir/loncapa");
-        if (-l $defaultconf) {
-            unlink($defaultconf);
-        }
-        symlink("$apache2_conf_available_dir/loncapa","$defaultconf");
-        print_and_log(&mt('Copying loncapa [_1] site file to [_2] and pointing [_3] to it from sites-enabled.',"'apache2'","'/etc/apache2/sites-available'","'000-default.conf symlink'")."\n");
-        copy("$instdir/debian-ubuntu/ubuntu14/loncapa_site","$apache2_sites_available_dir/loncapa");
-        chmod(0444,"$apache2_sites_available_dir/loncapa");
-        symlink("$apache2_sites_available_dir/loncapa","$defaultconfig");
-    } else {
-        print_and_log(&mt('Copying loncapa [_1] config file to [_2] and pointing [_3] to it from sites-enabled.',"'apache2'","'/etc/apache2/sites-available'","'000-default symlink'")."\n");
-        if (-e "$apache2_sites_available_dir/loncapa") {
-            copy("$apache2_sites_available_dir/loncapa","$apache2_sites_available_dir/loncapa.original");
-        }
-        copy("$instdir/debian-ubuntu/loncapa","$apache2_sites_available_dir/loncapa");
-        chmod(0444,"$apache2_sites_available_dir/loncapa");
-        symlink("$apache2_sites_available_dir/loncapa","$apache2_sites_enabled_dir/000-default");
+        if ((-e "$apache2_conf_available_dir/loncapa") && (-e "$instdir/debian-ubuntu/ubuntu14/loncapa_conf")) {
+            if (open(PIPE, "diff --brief $apache2_conf_available_dir/loncapa $instdir/debian-ubuntu/ubuntu14/loncapa_conf" |")) {
+                my $diffres = <PIPE>;
+                close(PIPE);
+                chomp($diffres);
+                if ($diffres) {
+                    copy("$apache2_conf_available_dir/loncapa","$apache2_conf_available_dir/loncapa.original");
+                }
+                if (-l $defaultconf) {
+                    my $linkfname = readlink($defaultconf);
+                    if ($linkfname eq "$apache2_conf_available_dir/loncapa") {
+                        unless ($diffres) {
+                            $skipconf = 1;
+                        }
+                    }
+                }
+            }
+        }
+        unless ($skipconf) {
+            print_and_log(&mt('Copying loncapa [_1] config file to [_2] and pointing [_3] to it from conf-enabled.',"'apache2'","'/etc/apache2/conf-available'","'loncapa.conf symlink'")."\n");
+            copy("$instdir/debian-ubuntu/ubuntu14/loncapa_conf","$apache2_conf_available_dir/loncapa");
+            chmod(0444,"$apache2_conf_available_dir/loncapa");
+            if (-l $defaultconf) {
+                unlink($defaultconf);
+            }
+            symlink("$apache2_conf_available_dir/loncapa","$defaultconf");
+        }
+        my $stdsite = "$instdir/debian-ubuntu/ubuntu14/loncapa_site";
+        if ((-e $stdsite) && (-e "$apache2_sites_available_dir/loncapa")) {
+            if (open(PIPE, "diff --brief $stdsite $apache2_sites_available_dir/loncapa |")) {
+                my $diffres = <PIPE>;
+                close(PIPE);
+                chomp($diffres);
+                if ($diffres) {
+                    copy("$apache2_sites_available_dir/loncapa","$apache2_sites_available_dir/loncapa.original");
+                }
+                if (-l $defaultconfig) {
+                    my $linkfname = readlink($defaultconfig);
+                    if ($linkfname eq "$apache2_sites_available_dir/loncapa") {
+                        unless ($diffres) {
+                            $skipsite = 1;
+                        }
+                    }
+                }
+            }
+        }
+        unless ($skipsite) {
+            print_and_log(&mt('Copying loncapa [_1] site file to [_2] and pointing [_3] to it from sites-enabled.',"'apache2'","'/etc/apache2/sites-available'","'000-default.conf symlink'")."\n");
+            copy("$instdir/debian-ubuntu/ubuntu14/loncapa_site","$apache2_sites_available_dir/loncapa");
+            chmod(0444,"$apache2_sites_available_dir/loncapa");
+            symlink("$apache2_sites_available_dir/loncapa","$defaultconfig");
+        }
+    } else {
+        if ((-e "$instdir/debian-ubuntu/loncapa") && (-e "$apache2_sites_available_dir/loncapa")) {
+            if (open(PIPE, "diff --brief $instdir/debian-ubuntu/loncapa $apache2_sites_available_dir/loncapa |")) {
+                my $diffres = <PIPE>;
+                close(PIPE);
+                chomp($diffres);
+                if ($diffres) {
+                    copy("$apache2_sites_available_dir/loncapa","$apache2_sites_available_dir/loncapa.original");
+                }
+                if (-l $defaultconfig) {
+                    my $linkfname = readlink($defaultconfig);
+                    if ($linkfname eq "$apache2_sites_available_dir/loncapa") {
+                        unless ($diffres) {
+                            $skipsite = 1;
+                        }
+                    }
+                }
+            }
+        }
+        unless ($skipsite) {
+            if (-l $defaultconfig) {
+                unlink($defaultconfig);
+            }
+            print_and_log(&mt('Copying loncapa [_1] config file to [_2] and pointing [_3] to it from sites-enabled.',"'apache2'","'/etc/apache2/sites-available'","'000-default symlink'")."\n");
+            if (-e "$instdir/debian-ubuntu/loncapa") {
+                copy("$instdir/debian-ubuntu/loncapa","$apache2_sites_available_dir/loncapa");
+                chmod(0444,"$apache2_sites_available_dir/loncapa");
+                symlink("$apache2_sites_available_dir/loncapa","$apache2_sites_enabled_dir/000-default");
+            }
+        }
+    }
+    if ($distname eq 'ubuntu') {
+        my $sitestatus = "$apache2_mods_available_dir/status.conf";
+        my $stdstatus = "$instdir/debian-ubuntu/status.conf";
+        if ((-e $sitestatus) && (-e $stdstatus)) {
+            if (open(PIPE, "diff --brief $stdstatus $sitestatus |")) {
+                my $diffres = <PIPE>;
+                close(PIPE);
+                chomp($diffres);
+                if ($diffres) {
+                    copy("$apache2_mods_available_dir/status.conf","$apache2_mods_available_dir/status.conf.original");
+                } else {
+                    $skipstatus = 1;
+                }
+            }
+        }
+        unless ($skipstatus) {
+            if (-e $stdstatus) {
+                print_and_log(&mt('Copying loncapa [_1] file to [_2],',"'status.conf'","'/etc/apache2/mods-available/status.conf'")."\n");
+                copy($stdstatus,$sitestatus);
+                chmod(0644,$sitestatus);
+            }
+        }
     }
     print_and_log("\n");
 }
@@ -2484,7 +2588,7 @@
         print &mt('LON-CAPA source files extracted.')."\n".
               &mt('It remains for you to execute the following commands:')."
 
-cd /root/loncapa-N.N     (N.N should correspond to a version number like '0.4')
+cd /root/loncapa-X.Y.Z     (X.Y.Z should correspond to a version number like '2.11.3')
 ./UPDATE
 
 ".&mt('If you have any trouble, please see [_1] and [_2]',


More information about the LON-CAPA-cvs mailing list