Diff for /doc/loncapafiles/bash_config_check.piml between versions 1.1 and 1.5

version 1.1, 2024/07/08 23:46:05 version 1.5, 2024/07/30 13:58:58
Line 37  http://www.lon-capa.org/ Line 37  http://www.lon-capa.org/
   
 use strict;  use strict;
   
 my $bracketed_warning;  my ($bracketed_warning,$run_modify_config);
 if (open(PIPE,"/bin/su -s /bin/bash -c 'bind -V' www 2>&1 |grep enable-bracketed-paste |")) {  if (open(PIPE,"/bin/su -s /bin/bash -c 'bind -V 2>&1' www |grep enable-bracketed-paste |")) {
     my $info = <PIPE>      my $info = <PIPE>;
     chomp($info);      chomp($info);
     my ($bracketed) = ($info =~ /^\Qenable-bracketed-paste\E\s+is\s+set\s+to\s+\W(on|off)\W$/);      my ($bracketed) = ($info =~ /^\Qenable-bracketed-paste\E\s+is\s+set\s+to\s+\W(on|off)\W$/);
     close(PIPE);      close(PIPE);
     if ($bracketed eq 'on') {      if ($bracketed eq 'on') {
         $bracketed_warning = 1;          my $bash_www_cnf = '/home/www/.inputrc';
           if (!-e $bash_www_cnf) {
               $bracketed_warning = 1;
           } elsif (open(my $fh,'<',$bash_www_cnf)) {
               my (%bracketed_paste_on,%bracketed_paste_off,$condition);
               $condition = '';
               while (my $line=<$fh>) {
                   chomp($line);
                   if ($line =~ /^\$if\s+(\w+)\s*$/) {
                       if ($1 eq 'R') {
                           $condition = 'r';
                       } elsif ($1 eq 'maxima') {
                           $condition = 'maxima';
                       } else {
                           $condition = 'other';
                       }
                   } elsif ($line =~ /^\$endif\s*$/) {
                       $condition = '';
                   }
                   if ($line =~ /^\s*set\s+enable\-bracketed\-paste\s+(off|on)\s*$/) {
                       if ($1 eq 'off') {
                           if ($condition ne '') {
                               $bracketed_paste_off{$condition} = 1;
                           } else {
                               $bracketed_paste_off{all} = 1;
                           }
                       } else {
                           if ($condition ne '') {
                               $bracketed_paste_on{$condition} = 1;
                           } else {
                               $bracketed_paste_on{all} = 1;
                           }
                       }
                   }
               }
               close($fh);
               if ($bracketed_paste_on{r} || !exists($bracketed_paste_off{r})) {
                   $run_modify_config = 1;
               }
           } else {
               print "Unable to check if bracketed paste is set to off for www user's shell for R application (lonr).\n";
           }
     }      }
 } else {  } else {
     print "Unable to check if bracketed paste is set to off for www user's shell\n";       print "Unable to check if bracketed paste is set to off for www user's shell for R application (lonr).\n";
 }  }
   
 if ($bracketed_warning) {  if ($bracketed_warning) {
     print <<"END";      print <<'END';
 **** ERROR: Problems will include calls to R statistics engine will not work.  **** ERROR: Problems which include calls to R statistics engine will not work.
 You need to create a file: /home/www/.inputrc containing th efollowing line:  You need to create a file: /home/www/.inputrc containing the following lines:
 set enable-bracketed-paste to off  $if R
       set enable-bracketed-paste off
   $endif
   END
   } elsif ($run_modify_config) {
       print <<'END';
   **** ERROR: Problems which include calls to R statistics engine will not work.
   Run /home/httpd/perl/modify_config_files.pl as root so the file /home/www/.inputrc
   will contain the following:
   $if R
       set enable-bracketed-paste off
   $endif
 END  END
 }  }
   

Removed from v.1.1  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>