Annotation of doc/loncapafiles/bash_config_check.piml, revision 1.4

1.1       raeburn     1: <!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN" 
                      2: 	"http://lpml.sourceforge.net/DTD/piml.dtd">
                      3: <!-- bash_config_check.piml -->
                      4: 
1.4     ! raeburn     5: <!-- $Id: bash_config_check.piml,v 1.3 2024/07/10 17:39:58 raeburn Exp $ -->
1.1       raeburn     6: 
                      7: <!--
                      8: 
                      9: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                     10: 
                     11: LON-CAPA is free software; you can redistribute it and/or modify
                     12: it under the terms of the GNU General Public License as published by
                     13: the Free Software Foundation; either version 2 of the License, or
                     14: (at your option) any later version.
                     15: 
                     16: LON-CAPA is distributed in the hope that it will be useful,
                     17: but WITHOUT ANY WARRANTY; without even the implied warranty of
                     18: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     19: GNU General Public License for more details.
                     20: 
                     21: You should have received a copy of the GNU General Public License
                     22: along with LON-CAPA; if not, write to the Free Software
                     23: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     24: 
                     25: /home/httpd/html/adm/gpl.txt
                     26: 
                     27: http://www.lon-capa.org/
                     28: 
                     29: -->
                     30: 
                     31: <piml>
                     32: <targetroot>/</targetroot>
                     33: <files>
                     34: <file>
                     35: <target dist="default">/home/httpd/perl</target>
                     36: <perlscript mode="fg" dist="fedora34 fedora35 fedora36 fedora37 fedora38 fedora39 fedora40 debian12 ubuntu22 ubuntu24 centos9-stream rhes9 oracle9 rocky9 alma9">
                     37: 
                     38: use strict;
                     39: 
1.4     ! raeburn    40: my ($bracketed_warning,$run_modify_config);
1.3       raeburn    41: if (open(PIPE,"/bin/su -s /bin/bash -c 'bind -V 2>&1' www |grep enable-bracketed-paste |")) {
1.2       raeburn    42:     my $info = &lt;PIPE&gt;;
1.1       raeburn    43:     chomp($info);
                     44:     my ($bracketed) = ($info =~ /^\Qenable-bracketed-paste\E\s+is\s+set\s+to\s+\W(on|off)\W$/);
                     45:     close(PIPE);
                     46:     if ($bracketed eq 'on') {
1.4     ! raeburn    47:         my $bash_www_cnf = '/home/www/.inputrc';
        !            48:         if (!-e $bash_www_cnf) {
        !            49:             $bracketed_warning = 1;
        !            50:         } elsif (open(my $fh,'&lt;',$bash_www_cnf)) {
        !            51:             my (%bracketed_paste_on,%bracketed_paste_off,$condition);
        !            52:             $condition = '';
        !            53:             while (my $line=&lt;$fh&gt;) {
        !            54:                 chomp($line);
        !            55:                 if ($line =~ /^\$if\s+(\w+)\s*$/) {
        !            56:                     if ($1 eq 'R') {
        !            57:                         $condition = 'r';
        !            58:                     } elsif ($1 eq 'maxima') {
        !            59:                         $condition = 'maxima';
        !            60:                     } else {
        !            61:                         $condition = 'other';
        !            62:                     }
        !            63:                 } elsif ($line =~ /^\$endif\s*$/) {
        !            64:                     $condition = '';
        !            65:                 }
        !            66:                 if ($line =~ /^\s*set\s+enable\-bracketed\-paste\s+(off|on)\s*$/) {
        !            67:                     if ($1 eq 'off') {
        !            68:                         if ($condition ne '') {
        !            69:                             $bracketed_paste_off{$condition} = 1;
        !            70:                         } else {
        !            71:                             $bracketed_paste_off{all} = 1;
        !            72:                         }
        !            73:                     } else {
        !            74:                         if ($condition ne '') {
        !            75:                             $bracketed_paste_on{$condition} = 1;
        !            76:                         } else {
        !            77:                             $bracketed_paste_on{all} = 1;
        !            78:                         }
        !            79:                     }
        !            80:                 }
        !            81:             }
        !            82:             close($fh);
        !            83:             if ($bracketed_paste_on{r} || !exists($bracketed_paste_off{r})) {
        !            84:                 $run_modify_config = 1;
        !            85:             }
        !            86:         } else {
        !            87:             print "Unable to check if bracketed paste is set to off for www user's shell for R application (lonr).\n";
        !            88:         }
1.1       raeburn    89:     }
                     90: } else {
1.4     ! raeburn    91:     print "Unable to check if bracketed paste is set to off for www user's shell for R application (lonr).\n";
1.1       raeburn    92: }
                     93: 
                     94: if ($bracketed_warning) {
1.4     ! raeburn    95:     print &lt;&lt;'END';
1.2       raeburn    96: **** ERROR: Problems which include calls to R statistics engine will not work.
1.4     ! raeburn    97: You need to create a file: /home/www/.inputrc containing the following lines:
        !            98: $if R
        !            99:     set enable-bracketed-paste off
        !           100: $endif
        !           101: END
        !           102: } elsif ($run_modify_config) {
        !           103:     print &lt;&lt;'END';
        !           104: **** ERROR: Problems which include calls to R statistics engine will not work.
        !           105: Run /home/httpd/perl/modify_config_files.pl as root so the file /home/www/.inputrc
        !           106: will contain the following:
        !           107: $if R
        !           108:     set enable-bracketed-paste off
        !           109: $endif
1.1       raeburn   110: END
                    111: }
                    112: 
                    113: </perlscript>
                    114: </file>
                    115: </files>
                    116: </piml>

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