File:  [LON-CAPA] / doc / loncapafiles / latex_fixup.piml
Revision 1.3: download - view: text, annotated - select for diffs
Sat Jan 10 04:43:15 2009 UTC (15 years, 10 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_12_X, version_2_11_X, version_2_11_5_msu, version_2_11_5, version_2_11_4_uiuc, version_2_11_4_msu, version_2_11_4, version_2_11_3_uiuc, version_2_11_3_msu, version_2_11_3, version_2_11_2_uiuc, version_2_11_2_msu, version_2_11_2_educog, version_2_11_2, version_2_11_1, version_2_11_0_RC3, version_2_11_0_RC2, version_2_11_0_RC1, version_2_11_0, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, loncapaMITrelate_1, language_hyphenation_merge, language_hyphenation, bz6209-base, bz6209, HEAD, GCI_3, GCI_2, GCI_1, BZ4492-merge, BZ4492-feature_horizontal_radioresponse, BZ4492-feature_Support_horizontal_radioresponse, BZ4492-Support_horizontal_radioresponse
- RHEL4 and SLES9 both use tetex-2.0 which lacks the lmodern package.
  - For these distros, if lmodern.sty is missing - get the tarball containg fonts tc from install.loncapa.org, unpack in /tmp and copy to appropriate locations in /usr/share/texmf/.

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

<!-- $Id: latex_fixup.piml,v 1.3 2009/01/10 04:43:15 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>
<files>
<file>
<perlscript mode="fg" dist="rhes4 sles9">
    my $lmodernafmpath = '/usr/share/texmf/fonts/afm/public';
    my $lmoderntfmpath = '/usr/share/texmf/fonts/tfm/public';
    my $lmoderntype1path = '/usr/share/texmf/fonts/type1/public';
    my $lmoderndvipspath = '/usr/share/texmf/dvips';
    my $lmoderntexpath = '/usr/share/texmf/tex/latex';
    my $file = 'lmodern.sty';
    if (!-e "$lmoderntexpath/lm/$file") {
        if (!-d $lmoderntexpath) {
            if (!&create_dir("$lmoderntexpath")) {
                die("Failed to create directory: $lmoderntexpath");
            }
        }
        if (!-d $lmodernafmpath) {
            if (!&create_dir($lmodernafmpath)) {
                die("Failed to create directory: $lmodernafmpath");
            }

        }
        if (!-d $lmoderntfmpath) {
            if (!&create_dir($lmoderntfmpath)) {
                die("Failed to create directory: $lmoderntfmpath");
            }
        }
        if (!-d $lmoderntype1path) {
            if (!&create_dir($lmoderntype1path)) {
                die("Failed to create directory: $lmoderntype1path");
            }
        }
        if (!-d $lmoderndvipspath) {
            if (!&create_dir($lmoderndvipspath)) {
                die("Failed to create directory: $lmoderndvipspath");
            }
        }
        if (-d $lmoderntexpath) {
            if (!-d "/tmp/LONCAPA") {
                mkdir("/tmp/LONCAPA",0755);
                die("mkdir('/tmp/LONCAPA',0755) failed") if $?;
            }
            system("/usr/bin/wget -O /tmp/LONCAPA/LC_lmodern.tar.gz  http://install.loncapa.org/versions/tex/LC_lmodern.tar.gz  1>/dev/null 2>/dev/null");
            die("/usr/bin/wget -O /tmp/LONCAPA/LC_lmodern.tar.gz  http://install.loncapa.org/versions/tex/LC_lmodern.tar.gz failed") if $?;
            system("/bin/tar zxf /tmp/LONCAPA/LC_lmodern.tar.gz --directory /tmp/LONCAPA");
            die("/bin/tar zxf /tmp/LONCAPA/LC_lmodern.tar.gz --directory /tmp/LONCAPA failed") if $?;
            unlink('/tmp/LONCAPA/LC_lmodern.tar.gz');
            if (-d "/tmp/LONCAPA/lmodern/fonts/afm/public/lm") {
                if (-d $lmodernafmpath && !-e "$lmodernafmpath/lm/") {
                    system("mv /tmp/LONCAPA/lmodern/fonts/afm/public/lm $lmodernafmpath");
                    die("mv /tmp/LONCAPA/lmodern/fonts/afm/public/lm $lmodernafmpath failed") if $?;
                }
            } else {
                die("Fonts directory: /tmp/LONCAPA/lmodern/fonts/afm/public/lm missing");
            }
            if (-d "/tmp/LONCAPA/lmodern/fonts/tfm/public/lm") {
                if (-d $lmoderntfmpath && !-e "$lmoderntfmpath/lm/") {
                    system("mv /tmp/LONCAPA/lmodern/fonts/tfm/public/lm $lmoderntfmpath");
                    die("mv /tmp/LONCAPA/lmodern/fonts/tfm/public/lm $lmoderntfmpath failed") if $?;
                }
            } else {
               die("Fonts directory: /tmp/LONCAPA/lmodern/fonts/tfm/public/lm missing");
            }
            if (-d "/tmp/LONCAPA/lmodern/fonts/type1/public/lm") {
                if (-d $lmoderntype1path && !-e "$lmoderntype1path/lm/") {
                    system("mv /tmp/LONCAPA/lmodern/fonts/type1/public/lm $lmoderntype1path");
                    die("mv /tmp/LONCAPA/lmodern/fonts/type1/public/lm $lmoderntype1path failed") if $?;
                }
            } else {
               die("Fonts directory: /tmp/LONCAPA/lmodern/fonts/type1/public/lm missing");
            }
            if (-d "/tmp/LONCAPA/lmodern/fonts/dvips/lm") {
                if (-d $lmoderndvipspath && !-e "$lmoderndvipspath/lm/") {
                    system("mv /tmp/LONCAPA/lmodern/fonts/dvips/lm $lmoderndvipspath");
                    die("mv /tmp/LONCAPA/lmodern/fonts/dvips/lm $lmoderndvipspath failed") if $?;
                }
            } else {
               die("Fonts directory: /tmp/LONCAPA/lmodern/fonts/dvips/lm missing");
            }
            if (-d "/tmp/LONCAPA/lmodern/tex/latex/lm") {
                if (-d $lmoderntexpath && !-e "$lmoderntexpath/lm/") {
                    system("mv /tmp/LONCAPA/lmodern/tex/latex/lm $lmoderntexpath");
                    die("mv /tmp/LONCAPA/lmodern/tex/latex/lm $lmoderntexpath failed") if $?;
                }
            } else {
               die("TeX directory: /tmp/LONCAPA/lmodern/tex/latex/lm missing");
            }
            if (-e $lmoderntexpath.'/lm/'.$file) {
                system('/usr/bin/updmap --enable Map lm.map 1>/dev/null 2>/dev/null');
                die("Can't run /usr/bin/updmap --enable Map lm.map") if $?;
                system('/usr/bin/texconfig rehash  1>/dev/null 2>/dev/null');
                die("Can't run /usr/bin/texconfig rehash") if $?;
                system('/usr/bin/updmap 1>/dev/null 2>/dev/null');
                die("Can't run /usr/bin/updmap") if $?;
                print "$lmoderntexpath/lm/$file created and lmodern fonts copied.\n".
                      "/usr/bin/texconfig rehash ran successfully.\n";
            } else {
                die("Can't find $lmoderntexpath/lm/$file");
            }
        } else {
            die("Can't find $lmoderntexpath") if $?;
        }
    } else {
        print "No action required - $lmoderntexpath/lm/$file already exists.\n";
    }

sub create_dir {
    my ($dir) = @_;
    my @parts=split('/',$dir);
    my $filepath;
    foreach my $part (@parts) {
        $filepath.= '/'.$part;
        if (!-d $filepath) {
            mkdir($filepath,0755);
        }
    }
    if (-d $dir) {
        return 1;
    } else {
        return 0;
    }
}

</perlscript>
<perlscript mode="fg" dist="rhes4">
    system('/usr/bin/mktexlsr');
    die("Can't run /usr/bin/mktexlsr") if $?;
</perlscript>
</file>
</files>
</piml>

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