[LON-CAPA-cvs] cvs: doc /loncapafiles webserver.piml

raeburn raeburn at source.lon-capa.org
Fri Mar 12 18:16:38 EST 2021


raeburn		Fri Mar 12 23:16:38 2021 EDT

  Modified files:              
    /doc/loncapafiles	webserver.piml 
  Log:
  - For Ubuntu 14 and newer use relative paths in symlinks for loncapa.conf
    for consistency with a2ensite, a2enconf, a2dissite, and a2disconf.
  
  
Index: doc/loncapafiles/webserver.piml
diff -u doc/loncapafiles/webserver.piml:1.55 doc/loncapafiles/webserver.piml:1.56
--- doc/loncapafiles/webserver.piml:1.55	Thu Mar 11 20:38:05 2021
+++ doc/loncapafiles/webserver.piml	Fri Mar 12 23:16:38 2021
@@ -2,7 +2,7 @@
 	"http://lpml.sourceforge.net/DTD/piml.dtd">
 <!-- webserver.piml -->
 
-<!-- $Id: webserver.piml,v 1.55 2021/03/11 20:38:05 raeburn Exp $ -->
+<!-- $Id: webserver.piml,v 1.56 2021/03/12 23:16:38 raeburn Exp $ -->
 
 <!--
 
@@ -69,6 +69,8 @@
 # Generated from doc/loncapafiles/webserver.piml
 use Socket;
 use Sys::Hostname::FQDN();
+use File::Spec;
+use Cwd();
 
 # For ubuntu 14 and later check for loncapa.conf in sites-available,
 # and conf-available, and for symlinks in sites-enabled, and conf-enabled
@@ -77,6 +79,9 @@
     if ($version > 12) {
         if (-l '/etc/apache2/conf-enabled/loncapa.conf') {
             my $linkfname = readlink('/etc/apache2/conf-enabled/loncapa.conf');
+            if ($linkfname ne '') {
+                $linkfname = Cwd::abs_path(File::Spec->rel2abs($linkfname,'/etc/apache2/conf-enabled'));
+            }
             unless ($linkfname eq '/etc/apache2/conf-available/loncapa.conf') {
                 unlink('/etc/apache2/conf-enabled/loncapa.conf');
             }
@@ -86,12 +91,21 @@
         }
         unless (-l '/etc/apache2/conf-enabled/loncapa.conf') {
             if (-e '/etc/apache2/conf-available/loncapa.conf') {
-                symlink('/etc/apache2/conf-available/loncapa.conf','/etc/apache2/conf-enabled/loncapa.conf');
+                my $currdir = Cwd::getcwd();
+                if ($currdir ne '') {
+                    chdir('/etc/apache2/conf-enabled');
+                    symlink('../conf-available/loncapa.conf','loncapa.conf');
+                    chdir($currdir);
+                }
             }
         }
         if (-l '/etc/apache2/sites-enabled/000-default.conf') {
             my $linkfname = readlink('/etc/apache2/sites-enabled/000-default.conf');
-            if ($linkfname eq '/etc/apache2/sites-available/loncapa') {
+            if ($linkfname ne '') {
+                $linkfname = Cwd::abs_path(File::Spec->rel2abs($linkfname,'/etc/apache2/sites-enabled'));
+            }
+            if (($linkfname eq '/etc/apache2/sites-available/loncapa') ||
+                ($linkname eq '/etc/apache2/sites-available/000-default.conf')) {
                 unlink('/etc/apache2/sites-enabled/000-default.conf');
             }
         }
@@ -100,13 +114,21 @@
         }
         if (-l '/etc/apache2/sites-enabled/loncapa.conf') {
             my $linkfname = readlink('/etc/apache2/sites-enabled/loncapa.conf');
+            if ($linkfname ne '') {
+                $linkfname = Cwd::abs_path(File::Spec->rel2abs($linkfname,'/etc/apache2/sites-enabled'));
+            }
             unless ($linkfname eq '/etc/apache2/sites-available/loncapa.conf') {
                 unlink('/etc/apache2/sites-enabled/loncapa.conf');
             }
         }
         unless (-l '/etc/apache2/sites-enabled/loncapa.conf') {
             if (-e '/etc/apache2/sites-available/loncapa.conf') {
-                symlink('/etc/apache2/sites-available/loncapa.conf','/etc/apache2/sites-enabled/loncapa.conf');
+                my $currdir = Cwd::getcwd();
+                if ($currdir ne '') {
+                    chdir('/etc/apache2/sites-enabled');
+                    symlink('../sites-available/loncapa.conf','loncapa.conf');
+                    chdir($currdir);
+                }
             }
         }
     }




More information about the LON-CAPA-cvs mailing list