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

raeburn raeburn at source.lon-capa.org
Fri Mar 12 19:04:36 EST 2021


raeburn		Sat Mar 13 00:04:36 2021 EDT

  Modified files:              
    /doc/install/linux	install.pl 
  Log:
  - For Ubuntu 14 and newer use relative paths in symlinks for loncapa.conf
    for consistency with a2ensite, a2enconf, a2dissite, and a2disconf.
  
  
Index: doc/install/linux/install.pl
diff -u doc/install/linux/install.pl:1.69 doc/install/linux/install.pl:1.70
--- doc/install/linux/install.pl:1.69	Thu Mar 11 20:59:34 2021
+++ doc/install/linux/install.pl	Sat Mar 13 00:04:36 2021
@@ -29,6 +29,7 @@
 use Socket;
 use Sys::Hostname::FQDN();
 use DBI;
+use File::Spec;
 use Cwd();
 use File::Basename();
 use lib File::Basename::dirname(Cwd::abs_path($0));
@@ -77,7 +78,7 @@
           &mt('Stopping execution.')."\n";
     exit;
 } else {
-    print LOG '$Id: install.pl,v 1.69 2021/03/11 20:59:34 raeburn Exp $'."\n";
+    print LOG '$Id: install.pl,v 1.70 2021/03/13 00:04:36 raeburn Exp $'."\n";
 }
 
 #
@@ -3216,10 +3217,15 @@
                     copy("$apache2_conf_available_dir/loncapa","$apache2_conf_available_dir/loncapa.conf.original");
                 } else {
                     copy("$apache2_conf_available_dir/loncapa","$apache2_conf_available_dir/loncapa.conf");
-                    symlink("$apache2_conf_available_dir/loncapa.conf","$defaultconf");
+                    chdir($apache2_conf_enabled_dir);
+                    symlink('../conf-available/loncapa.conf','loncapa.conf');
+                    chdir($instdir);
                 }
                 if (-l $defaultconf) {
                     my $linkfname = readlink($defaultconf);
+                    if ($linkfname ne '') {
+                        $linkfname = Cwd::abs_path(File::Spec->rel2abs($linkfname,$apache2_conf_enabled_dir));
+                    }
                     if ($linkfname eq "$apache2_conf_available_dir/loncapa") {
                         unlink($defaultconf);
                     }
@@ -3237,6 +3243,9 @@
                 }
                 if (-l $defaultconf) {
                     my $linkfname = readlink($defaultconf);
+                    if ($linkfname ne '') {
+                        $linkfname = Cwd::abs_path(File::Spec->rel2abs($linkfname,$apache2_conf_enabled_dir));
+                    }
                     if ($linkfname eq "$apache2_conf_available_dir/loncapa.conf") {
                         unless ($diffres) {
                             $skipconf = 1;
@@ -3252,7 +3261,9 @@
             if (-l $defaultconf) {
                 unlink($defaultconf);
             }
-            symlink("$apache2_conf_available_dir/loncapa.conf","$defaultconf");
+            chdir($apache2_conf_enabled_dir);
+            symlink('../conf-available/loncapa.conf','loncapa.conf');
+            chdir($instdir);
         }
         my $stdsite = "$instdir/debian-ubuntu/ubuntu14/loncapa_site";
         if ((-e $stdsite) && (-e "$apache2_sites_available_dir/loncapa")) {
@@ -3267,6 +3278,9 @@
                 }
                 if (-l $defaultconfig) {
                     my $linkfname = readlink($defaultconfig);
+                    if ($linkfname ne '') {
+                        $linkfname = Cwd::abs_path(File::Spec->rel2abs($linkfname,$apache2_sites_enabled_dir));
+                    }
                     if ($linkfname eq "$apache2_sites_available_dir/loncapa") {
                         unlink($defaultconfig);
                     }
@@ -3284,7 +3298,10 @@
                 }
                 if (-l $defaultsite) {
                     my $linkfname = readlink($defaultsite);
-                    if ($linkfname eq "$apache2_conf_available_dir/loncapa.conf") {
+                    if ($linkfname ne '') {
+                        $linkfname = Cwd::abs_path(File::Spec->rel2abs($linkfname,$apache2_sites_enabled_dir));
+                    }
+                    if ($linkfname eq "$apache2_sites_available_dir/loncapa.conf") {
                         unless ($diffres) {
                             $skipsite = 1;
                         }
@@ -3296,11 +3313,16 @@
             print_and_log(&mt('Copying loncapa [_1] site file to [_2] and pointing [_3] to it from sites-enabled.',"'apache2'","'/etc/apache2/sites-available'","'loncapa.conf symlink'")."\n");
             copy("$instdir/debian-ubuntu/ubuntu14/loncapa_site","$apache2_sites_available_dir/loncapa.conf");
             chmod(0444,"$apache2_sites_available_dir/loncapa.conf");
-            symlink("$apache2_sites_available_dir/loncapa.conf","$defaultsite");
+            chdir($apache2_sites_enabled_dir);
+            symlink('../sites-available/loncapa.conf','loncapa.conf');
+            chdir($instdir);
         }
-        if (-l defaultconfig) {
+        if (-l $defaultconfig) {
             my $linkfname = readlink($defaultconfig);
-            if ($linkfname eq "$apache2_sites_available_dir/000-default") {
+            if ($linkfname ne '') {
+                $linkfname = Cwd::abs_path(File::Spec->rel2abs($linkfname,$apache2_sites_enabled_dir));
+            }
+            if ($linkfname eq "$apache2_sites_available_dir/000-default.conf") {
                 unlink($defaultconfig);
             }
         }




More information about the LON-CAPA-cvs mailing list