--- doc/install/linux/install.pl 2020/11/11 21:06:14 1.45.2.9 +++ doc/install/linux/install.pl 2021/03/11 21:00:36 1.45.2.10 @@ -75,7 +75,7 @@ if (!open(LOG,">>loncapa_install.log")) &mt('Stopping execution.')."\n"; exit; } else { - print LOG '$Id: install.pl,v 1.45.2.9 2020/11/11 21:06:14 raeburn Exp $'."\n"; + print LOG '$Id: install.pl,v 1.45.2.10 2021/03/11 21:00:36 raeburn Exp $'."\n"; } # @@ -896,10 +896,10 @@ sub chkapache { } else { my ($configfile,$sitefile); if (($distname eq 'ubuntu') && ($version > 12)) { - $sitefile = '/etc/apache2/sites-available/loncapa'; - $configfile = "/etc/apache2/conf-available/loncapa"; + $sitefile = '/etc/apache2/sites-available/loncapa.conf'; + $configfile = '/etc/apache2/conf-available/loncapa.conf'; } else { - $configfile = "/etc/apache2/sites-available/loncapa"; + $configfile = '/etc/apache2/sites-available/loncapa'; } if (($configfile ne '') && (-e $configfile) && (-e $stdconf)) { if (open(PIPE, "diff --brief $stdconf $configfile |")) { @@ -2301,6 +2301,7 @@ sub copy_apache2_debconf { my $apache2_sites_enabled_dir = '/etc/apache2/sites-enabled'; my $apache2_sites_available_dir = '/etc/apache2/sites-available'; my $defaultconfig = "$apache2_sites_enabled_dir/000-default"; + my $defaultsite = "$apache2_sites_enabled_dir/loncapa.conf"; my ($distname,$version); if ($distro =~ /^(debian|ubuntu)(\d+)$/) { $distname = $1; @@ -2320,11 +2321,31 @@ sub copy_apache2_debconf { close(PIPE); chomp($diffres); if ($diffres) { - copy("$apache2_conf_available_dir/loncapa","$apache2_conf_available_dir/loncapa.original"); + 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"); } if (-l $defaultconf) { my $linkfname = readlink($defaultconf); if ($linkfname eq "$apache2_conf_available_dir/loncapa") { + unlink($defaultconf); + } + } + unlink("$apache2_conf_available_dir/loncapa"); + } + } + if ((-e "$apache2_conf_available_dir/loncapa.conf") && (-e "$instdir/debian-ubuntu/ubuntu14/loncapa_conf")) { + if (open(PIPE, "diff --brief $apache2_conf_available_dir/loncapa.conf $instdir/debian-ubuntu/ubuntu14/loncapa_conf |")) { + my $diffres = ; + close(PIPE); + chomp($diffres); + if ($diffres) { + copy("$apache2_conf_available_dir/loncapa.conf","$apache2_conf_available_dir/loncapa.conf.original"); + } + if (-l $defaultconf) { + my $linkfname = readlink($defaultconf); + if ($linkfname eq "$apache2_conf_available_dir/loncapa.conf") { unless ($diffres) { $skipconf = 1; } @@ -2334,12 +2355,12 @@ sub copy_apache2_debconf { } 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"); + copy("$instdir/debian-ubuntu/ubuntu14/loncapa_conf","$apache2_conf_available_dir/loncapa.conf"); + chmod(0444,"$apache2_conf_available_dir/loncapa.conf"); if (-l $defaultconf) { unlink($defaultconf); } - symlink("$apache2_conf_available_dir/loncapa","$defaultconf"); + symlink("$apache2_conf_available_dir/loncapa.conf","$defaultconf"); } my $stdsite = "$instdir/debian-ubuntu/ubuntu14/loncapa_site"; if ((-e $stdsite) && (-e "$apache2_sites_available_dir/loncapa")) { @@ -2348,11 +2369,30 @@ sub copy_apache2_debconf { close(PIPE); chomp($diffres); if ($diffres) { - copy("$apache2_sites_available_dir/loncapa","$apache2_sites_available_dir/loncapa.original"); + copy("$apache2_sites_available_dir/loncapa","$apache2_sites_available_dir/loncapa.conf.original"); + } else { + copy("$apache2_sites_available_dir/loncapa","$apache2_sites_available_dir/loncapa.conf"); } if (-l $defaultconfig) { my $linkfname = readlink($defaultconfig); if ($linkfname eq "$apache2_sites_available_dir/loncapa") { + unlink($defaultconfig); + } + } + unlink("$apache2_sites_available_dir/loncapa"); + } + } + if ((-e $stdsite) && (-e "$apache2_sites_available_dir/loncapa.conf")) { + if (open(PIPE, "diff --brief $stdsite $apache2_sites_available_dir/loncapa.conf |")) { + my $diffres = ; + close(PIPE); + chomp($diffres); + if ($diffres) { + copy("$apache2_sites_available_dir/loncapa.conf","$apache2_sites_available_dir/loncapa.conf.original"); + } + if (-l $defaultsite) { + my $linkfname = readlink($defaultsite); + if ($linkfname eq "$apache2_conf_available_dir/loncapa.conf") { unless ($diffres) { $skipsite = 1; } @@ -2361,10 +2401,16 @@ sub copy_apache2_debconf { } } 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"); + 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"); + } + if (-l defaultconfig) { + my $linkfname = readlink($defaultconfig); + if ($linkfname eq "$apache2_sites_available_dir/000-default") { + unlink($defaultconfig); + } } } else { if ((-e "$instdir/debian-ubuntu/loncapa") && (-e "$apache2_sites_available_dir/loncapa")) {