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

raeburn raeburn at source.lon-capa.org
Fri May 1 14:29:57 EDT 2020


raeburn		Fri May  1 18:29:57 2020 EDT

  Modified files:              
    /doc/install/linux	install.pl 
  Log:
  - Replace Ubuntu's status.conf in /etc/apache2/mods-available with a loncapa
    version.
  - &copy_apache2_debconf() only modifies each apache2 config file for Ubuntu,
    if the file needs to be changed.
  
  
-------------- next part --------------
Index: doc/install/linux/install.pl
diff -u doc/install/linux/install.pl:1.63 doc/install/linux/install.pl:1.64
--- doc/install/linux/install.pl:1.63	Fri May  1 14:13:31 2020
+++ doc/install/linux/install.pl	Fri May  1 18:29:56 2020
@@ -77,7 +77,7 @@
           &mt('Stopping execution.')."\n";
     exit;
 } else {
-    print LOG '$Id: install.pl,v 1.63 2020/05/01 14:13:31 raeburn Exp $'."\n";
+    print LOG '$Id: install.pl,v 1.64 2020/05/01 18:29:56 raeburn Exp $'."\n";
 }
 
 #
@@ -1017,6 +1017,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';
@@ -3156,35 +3170,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");
 }


More information about the LON-CAPA-cvs mailing list