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

raeburn raeburn at source.lon-capa.org
Fri Aug 28 02:28:39 EDT 2026


raeburn		Fri Aug 28 06:28:39 2026 EDT

  Modified files:              
    /doc/loncapafiles	updatequery.piml 
  Log:
  - Add use Cwd declaration so cwd() can be used.
  - If "Accessibility Checking Available" set to 'Y' during configuration:
    RHEL/Oracle/CentOS 7 check for loncapa-nodejs repo so an rpm for node.js:24
    built with glibc-2.17 can be installed.
  - RHEL/Oracle/CentOS 7 use headless chromium instead of firefox.
  
  
-------------- next part --------------
Index: doc/loncapafiles/updatequery.piml
diff -u doc/loncapafiles/updatequery.piml:1.105 doc/loncapafiles/updatequery.piml:1.106
--- doc/loncapafiles/updatequery.piml:1.105	Thu Aug 20 20:58:11 2026
+++ doc/loncapafiles/updatequery.piml	Fri Aug 28 06:28:39 2026
@@ -1,6 +1,6 @@
 <!-- updatequery.piml -->
 
-<!-- $Id: updatequery.piml,v 1.105 2026/08/20 20:58:11 raeburn Exp $ -->
+<!-- $Id: updatequery.piml,v 1.106 2026/08/28 06:28:39 raeburn Exp $ -->
 
 <!--
 
@@ -44,6 +44,7 @@
 use Term::ReadKey;
 use Locale::Country;
 use IPC::Cmd qw(can_run);
+use Cwd;
 
 sub get_new_sslkeypass {
     my $sslkeypass;
@@ -747,9 +748,9 @@
                 }
             }
         } elsif ($version == 7) {
-            $browser = '/usr/bin/firefox';
+            $browser = '/usr/bin/chromium-browser';
             unless (($nodejs) && ($nodeversion >= 24)) {
-                $installref->{'nodejs'} = 1;
+                $installref->{'nodesource'} = 1;
             }
         }
     } elsif ($dist eq 'centos-stream') {
@@ -798,8 +799,8 @@
 sub enable_nodesource {
     my ($dist,$version,$arch) = @_;
     my $repo_enabled;
-    my ($sep,$title,$nodesource,$gpgkey, at keyorder, at currorder,%expected,%actual,%origcase,
-        %actual,%origcase,%wrongvalue,%missing,%extra,%modifyextra);
+    my ($sep,$title,$gottitle,$nodesource,$needtitle,$gpgkey, at keyorder, at currorder,
+        %expected,%actual,%origcase,%wrongvalue,%missing,%extra,%modifyextra);
     return unless($dist =~ /^(ubuntu|debian|fedora|rhes|oracle|alma|rocky|centos|centos\-stream|scientific)$/);
     if (($dist eq 'ubuntu') || ($dist eq 'debian')) {
         $sep = ':';
@@ -823,30 +824,56 @@
         $nodesource = '/etc/apt/sources.list.d/nodesource.sources';
     } elsif ($dist =~ /^(fedora|rhes|oracle|alma|rocky|centos|centos\-stream|scientific)$/) {
         $sep = '=';
-        $nodesource = '/etc/yum.repos.d/nodesource-nodejs.repo';
         $gpgkey = '';
-        $title = '[nodesource-nodejs]';
-        @keyorder = qw(name baseurl priority enabled gpgcheck gpgkey module_hotfixes);
-        %expected = (
-                       name            => 'Node.js Packages for Linux RPM based distros -'.$arch,
-                       baseurl         => 'https://rpm.nodesource.com/pub_24.x/nodistro/nodejs/'.$arch,
-                       priority        => 9,
-                       enabled         => 1,
-                       gpgcheck        => 1, 
-                       gpgkey          => 'https://rpm.nodesource.com/gpgkey/ns-operations-public.key',
-                       module_hotfixes => 1,
+        if ($version == 7) {
+            $nodesource = '/etc/yum.repos.d/loncapa-nodejs.repo';
+            $title = '[loncapa-nodejs-basearch]';
+            @keyorder = qw(name baseurl priority enabled gpgcheck gpgkey);
+            %expected = (
+                           name            => 'Node.js Package for EL7 -'.$arch,
+                           baseurl         => 'https://install.loncapa.org/el7/nodejs/'.$arch,
+                           priority        => 9,
+                           enabled         => 1,
+                           gpgcheck        => 1,
+                           gpgkey          => 'https://install.loncapa.org/versions/el7/RPM-GPG-KEY-loncapa',
+                        );
+            if (open(my $pipe, '-|',"rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} -- %{summary}\n'")) {
+                while (my $line = <$pipe>) {
+                    chomp($line);
+                    if ($line =~ /<certificate\@loncapa\.org>/) {
+                        if ($line =~ /^(\Qgpg-pubkey-\E[\S]+)\s+/) {
+                            $gpgkey = $1;
+                        }
+                        last;
+                    }
+                }
+                close($pipe);
+            }
+        } else {
+            $nodesource = '/etc/yum.repos.d/nodesource-nodejs.repo';
+            $title = '[nodesource-nodejs]';
+            @keyorder = qw(name baseurl priority enabled gpgcheck gpgkey module_hotfixes);
+            %expected = (
+                           name            => 'Node.js Packages for Linux RPM based distros -'.$arch,
+                           baseurl         => 'https://rpm.nodesource.com/pub_24.x/nodistro/nodejs/'.$arch,
+                           priority        => 9,
+                           enabled         => 1,
+                           gpgcheck        => 1, 
+                           gpgkey          => 'https://rpm.nodesource.com/gpgkey/ns-operations-public.key',
+                           module_hotfixes => 1,
                     );
-        if (open(my $pipe, '-|',"rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} -- %{summary}\n'")) {
-            while (my $line = <$pipe>) {
-                chomp($line);
-                if ($line =~ /<operations\@nodesource\.com>/) {
-                    if ($line =~ /^(\Qgpg-pubkey-\E[\S]+)\s+/) {
-                        $gpgkey = $1;
+            if (open(my $pipe, '-|',"rpm -q gpg-pubkey --qf '%{name}-%{version}-%{release} -- %{summary}\n'")) {
+                while (my $line = <$pipe>) {
+                    chomp($line);
+                    if ($line =~ /<operations\@nodesource\.com>/) {
+                        if ($line =~ /^(\Qgpg-pubkey-\E[\S]+)\s+/) {
+                            $gpgkey = $1;
+                        }
+                        last;
                     }
-                    last;
                 }
+                close($pipe);
             }
-            close($pipe);
         }
         unless ($gpgkey) {
             if ($expected{'gpgkey'} ne '') {
@@ -860,14 +887,22 @@
     if (-e $nodesource) {
         if (open(my $fh,'<',$nodesource)) {
             while (my $line = <$fh>) {
-                my ($key,$value) = split(/\Q$sep\E/,$line,2);
-                $key =~ s/(^\s+|\s+$)//g;
-                $value = s/(^\s+|\s+$)//g;
-                my $lckey = lc($key);
-                push(@currorder,$lckey);
-                $actual{$lckey} = $value;
-                if ($lckey ne $key) {
-                    $origcase{$lckey} = $key;
+                chomp($line);
+                unless (($dist eq 'ubuntu') || ($dist eq 'debian')) {
+                    if ($line eq $title) {
+                        $gottitle = 1;
+                    }
+                }
+                if ($line =~ /\Q$sep\E/) {
+                    my ($key,$value) = split(/\Q$sep\E/,$line,2);
+                    $key =~ s/(^\s+|\s+$)//g;
+                    $value = s/(^\s+|\s+$)//g;
+                    my $lckey = lc($key);
+                    push(@currorder,$lckey);
+                    $actual{$lckey} = $value;
+                    if ($lckey ne $key) {
+                        $origcase{$lckey} = $key;
+                    }
                 }
             }
             close($fh);
@@ -890,9 +925,14 @@
             }
             if ($dist =~ /^(ubuntu|debian)/) {
                 $sep .= ' ';
+            } elsif (!$gottitle) {
+                $needtitle = $title;
             }
-            if ((keys(%wrongvalue)) || (keys(%missing)) || (keys(%modifyextra))) {
+            if ((keys(%wrongvalue)) || (keys(%missing)) || (keys(%modifyextra)) || ($needtitle)) {
                 if (open(my $fh,'>',$nodesource)) {
+                    if ($title ne '') {
+                        print $fh "$title\n";
+                    }
                     if (@currorder) {
                         foreach my $key (@currorder) {
                             if (exists($origcase{$key})) {
@@ -932,6 +972,9 @@
         }
     } else {
         if (open(my $fh,'>',$nodesource)) {
+            if ($title ne '') {
+                print $fh "$title\n";
+            }
             foreach my $key (@keyorder) {
                 print $fh $key.$sep.$expected{$key}."\n";
             }
@@ -2291,8 +2334,10 @@
     }
     if ($choice2 eq 'Y') {
         $perlvar{'lonAxeUse'}=1;
+        $showAxeUse = 'Y';
     } else {
         $perlvar{'lonAxeUse'}=0;
+        $showAxeUse = 'N';
     }
 
     if (($choice2 eq 'Y') && (!$curr_axe)) {
@@ -2604,7 +2649,9 @@
                     my $command;
                     if ($dist =~ /^(ubuntu|debian)$/) {
                         $command = 'apt-get -y install nodejs';
-                    } elsif ($dist =~ /^(fedora|rhes|oracle|alma|rocky|centos|centos-stream)$/) {
+                    } elsif (($dist =~ /^rhes|oracle|centos|scientific$/) && ($version <= 7)) {
+                        $command = 'yum install nodejs -y';
+                    } elsif ($dist =~ /^fedora|rhes|oracle|alma|rocky|centos|centos-stream$/) {
                         $command = 'dnf install nodejs -y';
                     }
                     if ($command ne '') {
@@ -2616,9 +2663,11 @@
                         }
                     }
                 } else {
-                    if ($dist =~ /^(ubuntu|debian)$/) {
+                    if (($dist =~ /^rhes|oracle|centos|scientific$/) && ($version <= 7)) {
+                        print "Could not install $packagelist because a loncapa-nodejs.repo file could not be created.\n";
+                    } elsif ($dist =~ /^ubuntu|debian$/) {
                         print "Could not install $packagelist using nodesource because a nodesource.sources file could not be created.\n";
-                    } elsif ($dist =~ /^(fedora|rhes|oracle|alma|rocky|centos|centos-stream)$/) {
+                    } elsif ($dist =~ /^fedora|rhes|oracle|alma|rocky|centos|centos-stream$/) {
                         print "Could not install $packagelist using nodesource because a nodesource.repo file could not be created.\n";
                     }
                 }
@@ -2726,7 +2775,6 @@
                         }
                     } elsif ($version == 7) {
                         my $command = 'yum';
-                        #FIXME use node-v24.19.0-lts from https://github.com/sbwml/node-latest-centos/releases
                     }
                 }
             }


More information about the LON-CAPA-cvs mailing list