Annotation of doc/loncapafiles/latex_fixup.piml, revision 1.3
1.1 raeburn 1: <!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN"
2: "http://lpml.sourceforge.net/DTD/piml.dtd">
3: <!-- latex_fixup.piml -->
4: <!-- Stuart Raeburn -->
5:
1.3 ! raeburn 6: <!-- $Id: latex_fixup.piml,v 1.2 2008/04/05 11:57:01 raeburn Exp $ -->
1.1 raeburn 7:
8: <!--
9:
10: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
11:
12: LON-CAPA is free software; you can redistribute it and/or modify
13: it under the terms of the GNU General Public License as published by
14: the Free Software Foundation; either version 2 of the License, or
15: (at your option) any later version.
16:
17: LON-CAPA is distributed in the hope that it will be useful,
18: but WITHOUT ANY WARRANTY; without even the implied warranty of
19: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20: GNU General Public License for more details.
21:
22: You should have received a copy of the GNU General Public License
23: along with LON-CAPA; if not, write to the Free Software
24: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25:
26: /home/httpd/html/adm/gpl.txt
27:
28: http://www.lon-capa.org/
29:
30: -->
31:
32: <piml>
33: <files>
34: <file>
1.3 ! raeburn 35: <perlscript mode="fg" dist="rhes4 sles9">
! 36: my $lmodernafmpath = '/usr/share/texmf/fonts/afm/public';
! 37: my $lmoderntfmpath = '/usr/share/texmf/fonts/tfm/public';
! 38: my $lmoderntype1path = '/usr/share/texmf/fonts/type1/public';
! 39: my $lmoderndvipspath = '/usr/share/texmf/dvips';
! 40: my $lmoderntexpath = '/usr/share/texmf/tex/latex';
! 41: my $file = 'lmodern.sty';
! 42: if (!-e "$lmoderntexpath/lm/$file") {
! 43: if (!-d $lmoderntexpath) {
! 44: if (!&create_dir("$lmoderntexpath")) {
! 45: die("Failed to create directory: $lmoderntexpath");
! 46: }
! 47: }
! 48: if (!-d $lmodernafmpath) {
! 49: if (!&create_dir($lmodernafmpath)) {
! 50: die("Failed to create directory: $lmodernafmpath");
! 51: }
! 52:
! 53: }
! 54: if (!-d $lmoderntfmpath) {
! 55: if (!&create_dir($lmoderntfmpath)) {
! 56: die("Failed to create directory: $lmoderntfmpath");
! 57: }
! 58: }
! 59: if (!-d $lmoderntype1path) {
! 60: if (!&create_dir($lmoderntype1path)) {
! 61: die("Failed to create directory: $lmoderntype1path");
! 62: }
! 63: }
! 64: if (!-d $lmoderndvipspath) {
! 65: if (!&create_dir($lmoderndvipspath)) {
! 66: die("Failed to create directory: $lmoderndvipspath");
! 67: }
! 68: }
! 69: if (-d $lmoderntexpath) {
! 70: if (!-d "/tmp/LONCAPA") {
! 71: mkdir("/tmp/LONCAPA",0755);
! 72: die("mkdir('/tmp/LONCAPA',0755) failed") if $?;
! 73: }
! 74: 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");
! 75: die("/usr/bin/wget -O /tmp/LONCAPA/LC_lmodern.tar.gz http://install.loncapa.org/versions/tex/LC_lmodern.tar.gz failed") if $?;
! 76: system("/bin/tar zxf /tmp/LONCAPA/LC_lmodern.tar.gz --directory /tmp/LONCAPA");
! 77: die("/bin/tar zxf /tmp/LONCAPA/LC_lmodern.tar.gz --directory /tmp/LONCAPA failed") if $?;
! 78: unlink('/tmp/LONCAPA/LC_lmodern.tar.gz');
! 79: if (-d "/tmp/LONCAPA/lmodern/fonts/afm/public/lm") {
! 80: if (-d $lmodernafmpath && !-e "$lmodernafmpath/lm/") {
! 81: system("mv /tmp/LONCAPA/lmodern/fonts/afm/public/lm $lmodernafmpath");
! 82: die("mv /tmp/LONCAPA/lmodern/fonts/afm/public/lm $lmodernafmpath failed") if $?;
! 83: }
! 84: } else {
! 85: die("Fonts directory: /tmp/LONCAPA/lmodern/fonts/afm/public/lm missing");
! 86: }
! 87: if (-d "/tmp/LONCAPA/lmodern/fonts/tfm/public/lm") {
! 88: if (-d $lmoderntfmpath && !-e "$lmoderntfmpath/lm/") {
! 89: system("mv /tmp/LONCAPA/lmodern/fonts/tfm/public/lm $lmoderntfmpath");
! 90: die("mv /tmp/LONCAPA/lmodern/fonts/tfm/public/lm $lmoderntfmpath failed") if $?;
! 91: }
! 92: } else {
! 93: die("Fonts directory: /tmp/LONCAPA/lmodern/fonts/tfm/public/lm missing");
! 94: }
! 95: if (-d "/tmp/LONCAPA/lmodern/fonts/type1/public/lm") {
! 96: if (-d $lmoderntype1path && !-e "$lmoderntype1path/lm/") {
! 97: system("mv /tmp/LONCAPA/lmodern/fonts/type1/public/lm $lmoderntype1path");
! 98: die("mv /tmp/LONCAPA/lmodern/fonts/type1/public/lm $lmoderntype1path failed") if $?;
! 99: }
! 100: } else {
! 101: die("Fonts directory: /tmp/LONCAPA/lmodern/fonts/type1/public/lm missing");
! 102: }
! 103: if (-d "/tmp/LONCAPA/lmodern/fonts/dvips/lm") {
! 104: if (-d $lmoderndvipspath && !-e "$lmoderndvipspath/lm/") {
! 105: system("mv /tmp/LONCAPA/lmodern/fonts/dvips/lm $lmoderndvipspath");
! 106: die("mv /tmp/LONCAPA/lmodern/fonts/dvips/lm $lmoderndvipspath failed") if $?;
! 107: }
! 108: } else {
! 109: die("Fonts directory: /tmp/LONCAPA/lmodern/fonts/dvips/lm missing");
! 110: }
! 111: if (-d "/tmp/LONCAPA/lmodern/tex/latex/lm") {
! 112: if (-d $lmoderntexpath && !-e "$lmoderntexpath/lm/") {
! 113: system("mv /tmp/LONCAPA/lmodern/tex/latex/lm $lmoderntexpath");
! 114: die("mv /tmp/LONCAPA/lmodern/tex/latex/lm $lmoderntexpath failed") if $?;
! 115: }
! 116: } else {
! 117: die("TeX directory: /tmp/LONCAPA/lmodern/tex/latex/lm missing");
! 118: }
! 119: if (-e $lmoderntexpath.'/lm/'.$file) {
! 120: system('/usr/bin/updmap --enable Map lm.map 1>/dev/null 2>/dev/null');
! 121: die("Can't run /usr/bin/updmap --enable Map lm.map") if $?;
! 122: system('/usr/bin/texconfig rehash 1>/dev/null 2>/dev/null');
! 123: die("Can't run /usr/bin/texconfig rehash") if $?;
! 124: system('/usr/bin/updmap 1>/dev/null 2>/dev/null');
! 125: die("Can't run /usr/bin/updmap") if $?;
! 126: print "$lmoderntexpath/lm/$file created and lmodern fonts copied.\n".
! 127: "/usr/bin/texconfig rehash ran successfully.\n";
! 128: } else {
! 129: die("Can't find $lmoderntexpath/lm/$file");
! 130: }
! 131: } else {
! 132: die("Can't find $lmoderntexpath") if $?;
! 133: }
! 134: } else {
! 135: print "No action required - $lmoderntexpath/lm/$file already exists.\n";
! 136: }
! 137:
! 138: sub create_dir {
! 139: my ($dir) = @_;
! 140: my @parts=split('/',$dir);
! 141: my $filepath;
! 142: foreach my $part (@parts) {
! 143: $filepath.= '/'.$part;
! 144: if (!-d $filepath) {
! 145: mkdir($filepath,0755);
! 146: }
! 147: }
! 148: if (-d $dir) {
! 149: return 1;
! 150: } else {
! 151: return 0;
! 152: }
! 153: }
! 154:
! 155: </perlscript>
1.1 raeburn 156: <perlscript mode="fg" dist="rhes4">
157: system('/usr/bin/mktexlsr');
158: die("Can't run /usr/bin/mktexlsr") if $?;
159: </perlscript>
160: </file>
161: </files>
162: </piml>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>