File:  [LON-CAPA] / doc / loncapafiles / bash_config_check.piml
Revision 1.6: download - view: text, annotated - select for diffs
Fri Nov 15 16:25:30 2024 UTC (6 days, 11 hours ago) by raeburn
Branches: MAIN
CVS tags: version_2_12_X, version_2_11_X, HEAD
- - Support Fedora 41

<!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN" 
	"http://lpml.sourceforge.net/DTD/piml.dtd">
<!-- bash_config_check.piml -->

<!-- $Id: bash_config_check.piml,v 1.6 2024/11/15 16:25:30 raeburn Exp $ -->

<!--

This file is part of the LearningOnline Network with CAPA (LON-CAPA).

LON-CAPA is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

LON-CAPA is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with LON-CAPA; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

/home/httpd/html/adm/gpl.txt

http://www.lon-capa.org/

-->

<piml>
<targetroot>/</targetroot>
<files>
<file>
<target dist="default">/home/httpd/perl</target>
<perlscript mode="fg" dist="fedora34 fedora35 fedora36 fedora37 fedora38 fedora39 fedora40 fedora41 debian12 ubuntu22 ubuntu24 centos9-stream rhes9 oracle9 rocky9 alma9">

use strict;

my ($bracketed_warning,$run_modify_config);
if (open(PIPE,"/bin/su -s /bin/bash -c 'bind -V 2&gt;&1' www |grep enable-bracketed-paste |")) {
    my $info = &lt;PIPE&gt;;
    chomp($info);
    my ($bracketed) = ($info =~ /^\Qenable-bracketed-paste\E\s+is\s+set\s+to\s+\W(on|off)\W$/);
    close(PIPE);
    if ($bracketed eq 'on') {
        my $bash_www_cnf = '/home/www/.inputrc';
        if (!-e $bash_www_cnf) {
            $bracketed_warning = 1;
        } elsif (open(my $fh,'&lt;',$bash_www_cnf)) {
            my (%bracketed_paste_on,%bracketed_paste_off,$condition);
            $condition = '';
            while (my $line=&lt;$fh&gt;) {
                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 {
    print "Unable to check if bracketed paste is set to off for www user's shell for R application (lonr).\n";
}

if ($bracketed_warning) {
    print &lt;&lt;'END';
**** ERROR: Problems which include calls to R statistics engine will not work.
You need to create a file: /home/www/.inputrc containing the following lines:
$if R
    set enable-bracketed-paste off
$endif
END
} elsif ($run_modify_config) {
    print &lt;&lt;'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
}

</perlscript>
</file>
</files>
</piml>

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