diff options
author | Norbert Preining <preining@logic.at> | 2008-04-30 12:49:30 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-04-30 12:49:30 +0000 |
commit | 066212d6584e077613ce96a443ac57f09a404ae2 (patch) | |
tree | dce09469c4d6361b32124e358b18a92edee64aef /Master/tlpkg/TeXLive | |
parent | 8e233884ea800533fe0e184c3655715dbec71346 (diff) |
rework postinstall stuff
git-svn-id: svn://tug.org/texlive/trunk@7738 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLConfig.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLMedia.pm | 8 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPostInstall.pm | 214 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/win-admin.pl | 2 |
4 files changed, 223 insertions, 3 deletions
diff --git a/Master/tlpkg/TeXLive/TLConfig.pm b/Master/tlpkg/TeXLive/TLConfig.pm index f5287fe9534..799e9e0ae47 100644 --- a/Master/tlpkg/TeXLive/TLConfig.pm +++ b/Master/tlpkg/TeXLive/TLConfig.pm @@ -1,4 +1,4 @@ -# $Id: TLConfig.pm 5044 2007-09-25 18:34:12Z karl $ +# $Id$ # TeXLive::TLConfig.pm - module exporting configuration stuff # Copyright 2007 Norbert Preining # This file is licensed under the GNU General Public License version 2 diff --git a/Master/tlpkg/TeXLive/TLMedia.pm b/Master/tlpkg/TeXLive/TLMedia.pm index a8e3dfa91ad..e9d0666970f 100644 --- a/Master/tlpkg/TeXLive/TLMedia.pm +++ b/Master/tlpkg/TeXLive/TLMedia.pm @@ -1,4 +1,4 @@ -# $Id: TLMedia.pm 6947 2008-03-13 00:40:12Z karl $ +# $Id$ # TeXLive::TLMedia.pm - module for accessing TeX Live Media # Copyright 2008 Norbert Preining # @@ -9,6 +9,7 @@ package TeXLive::TLMedia; use TeXLive::TLConfig; +use TeXLive::TLPostInstall; use TeXLive::TLUtils qw(tllog copy win32 dirname mkdirhier conv_to_win_path basename download_file); use TeXLive::TLPDB; use Cwd qw/abs_path/; @@ -224,6 +225,11 @@ sub install_package { } } } + # do the postinstallation actions + if (defined($PostInstall{$pkg})) { + tllog($::LOG_NORMAL, "running post install action for $pkg\n"); + &{$PostInstall{$pkg}}($totlpdb->root); + } return $ret; } } diff --git a/Master/tlpkg/TeXLive/TLPostInstall.pm b/Master/tlpkg/TeXLive/TLPostInstall.pm new file mode 100644 index 00000000000..4342715f13b --- /dev/null +++ b/Master/tlpkg/TeXLive/TLPostInstall.pm @@ -0,0 +1,214 @@ +# $Id$ +# TeXLive::TLPostInstall.pm - collection post install stuff for installation +# Copyright 2008 Norbert Preining +# This file is licensed under the GNU General Public License version 2 +# or any later version. + +package TeXLive::TLPostInstall; + +BEGIN { + use Exporter (); + use vars qw( @ISA @EXPORT_OK @EXPORT ); + @ISA = qw(Exporter); + @EXPORT_OK = qw( + %PostInstall + ); + @EXPORT = @EXPORT_OK; +} + +use TeXLive::TLUtils qw(win32 mkdirhier copy); + +our %PostInstall; + + +sub do_bin_xetex { + my ($texdir) = @_; + # + # bin-xetex installs font-config related stuff + # we have to + # - updated the installation path in bin/win32/conf/fonts.conf + # - call fc-cache -v + if (-r "$texdir/bin/win32/conf/fonts.conf") { + open(FONTSCONF, "<$texdir/bin/win32/conf/fonts.conf") + or die("Cannot open $texdir/bin/win32/conf/fonts.conf"); + my @lines = <FONTSCONF>; + close(FONTSCONF); + open(FONTSCONF, ">$texdir/bin/win32/conf/fonts.conf") + or die("Cannot open $texdir/bin/win32/conf/fonts.conf for writing"); + foreach (@lines) { + $_ =~ s!c:/Program Files/texlive/2008!$texdir!; + print FONTSCONF; + } + close(FONTSCONF); + } + # call fc-cache but only when we install on win32! + if (win32()) { + system("fc-cache","-v"); + } +} +$PostInstall{"bin-xetex"} = \&do_bin_xetex; + + +sub do_bin_xdvi { + my ($TEXDIR, $TEXMFSYSVAR) = @_; + if (!defined($TEXMFSYSVAR)) { + $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`; + chomp($TEXMFSYSVAR); + } + copy ("$TEXDIR/texmf/xdvi/XDvi", "$TEXMFSYSVAR/xdvi"); +} +$PostInstall{"bin-xdvi"} = \&do_bin_xdvi; + + +sub do_plain { + my ($TEXDIR, $TEXMFSYSVAR) = @_; + if (!defined($TEXMFSYSVAR)) { + $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`; + chomp($TEXMFSYSVAR); + } + # install some copies from texmf(-dist) into texmf-var + copy ("$TEXDIR/texmf-dist/tex/plain/config/language.def", + "$TEXMFSYSVAR/tex/plain/config"); +} +$PostInstall{"plain"} = \&do_plain; + + +sub do_bin_dvipsk { + my ($TEXDIR, $TEXMFSYSVAR) = @_; + if (!defined($TEXMFSYSVAR)) { + $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`; + chomp($TEXMFSYSVAR); + } + # those files must exist + copy ("$TEXDIR/texmf/dvips/config/config.ps", + "$TEXMFSYSVAR/dvips/config"); +} +$PostInstall{"bin-dvipsk"} = \&do_bin_dvipsk; + + +sub do_bin_dvipdfm { + my ($TEXDIR, $TEXMFSYSVAR) = @_; + if (!defined($TEXMFSYSVAR)) { + $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`; + chomp($TEXMFSYSVAR); + } + # fix up dvipdfm config file to contain the right # piping command + mkdirhier("$TEXMFSYSVAR/dvipdfm/config"); + open(DVIPDFMCONFIGDIST, "<$TEXDIR/texmf/dvipdfm/config/config") + or die("Cannot open $TEXDIR/texmf/dvipdfm/config/config"); + open(DVIPDFMCONFIGINST, ">$TEXMFSYSVAR/dvipdfm/config/config") + or die("Cannot open $TEXMFSYSVAR/dvipdfm/config/config"); + while (<DVIPDFMCONFIGDIST>) { + if (m/^D /) { + print DVIPDFMCONFIGINST 'D "epstopdf --outfile=%o --nocompress %i"', "\n"; + } else { + print DVIPDFMCONFIGINST; + } + } + close(DVIPDFMCONFIGDIST); + close(DVIPDFMCONFIGINST); +} +$PostInstall{"bin-dvipdfm"} = \&do_bin_dvipdfm; + +sub do_bin_dvipdfmx { + my ($TEXDIR, $TEXMFSYSVAR) = @_; + if (!defined($TEXMFSYSVAR)) { + $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`; + chomp($TEXMFSYSVAR); + } + # dvipdfmx.cfg + open(DVIPDFMCONFIGDIST, "<$TEXDIR/texmf/dvipdfm/dvipdfmx.cfg") + or die("Cannot open $TEXDIR/texmf/dvipdfm/dvipdfmx.cfg"); + open(DVIPDFMCONFIGINST, ">$TEXMFSYSVAR/dvipdfm/dvipdfmx.cfg") + or die("Cannot open $TEXMFSYSVAR/dvipdfm/dvipdfmx.cfg"); + while (<DVIPDFMCONFIGDIST>) { + if (m/^D /) { + print DVIPDFMCONFIGINST "%$_"; + print DVIPDFMCONFIGINST "\n%% GhostScript (TeX Live (Unix and Win32)):\n"; + print DVIPDFMCONFIGINST 'D "rungs -q -dNOPAUSE -dBATCH -sPAPERSIZE=a0 -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dUseFlateCompression=true -sOutputFile=%o %i -c quit"', "\n\n"; + } else { + print DVIPDFMCONFIGINST; + } + } + close(DVIPDFMCONFIGDIST); + close(DVIPDFMCONFIGINST); +} +$PostInstall{"bin-dvipdfmx"} = \&do_bin_dvipdfmx; + + +sub do_bin_kpathsea { + my ($TEXDIR, $TEXMFSYSVAR) = @_; + if (!defined($TEXMFSYSVAR)) { + $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`; + chomp($TEXMFSYSVAR); + } + copy ("$TEXDIR/texmf/web2c/mktex.cnf", + "$TEXMFSYSVAR/web2c"); +} +$PostInstall{"bin-kpathsea"} = \&do_bin_kpathsea; + +sub do_bin_pdftex { + my ($TEXDIR, $TEXMFSYSVAR) = @_; + if (!defined($TEXMFSYSVAR)) { + $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`; + chomp($TEXMFSYSVAR); + } + # the old installer copied from CDDIR, but shouldn't this be installed + # in ANY case since it is in bin-pdftex??? + copy ("$TEXDIR/texmf/tex/generic/config/pdftexconfig.tex", + "$TEXMFSYSVAR/tex/generic/config"); +} +$PostInstall{"bin-pdftex"} = \&do_bin_pdftex; + +sub do_context { + my ($TEXDIR, $TEXMFSYSVAR) = @_; + if (!defined($TEXMFSYSVAR)) { + $TEXMFSYSVAR = `kpsewhich -var-value=TEXMFSYSVAR`; + chomp($TEXMFSYSVAR); + } + # old installer did this, should we do this, TOO???? + copy ("$TEXDIR/texmf-dist/tex/context/config/cont-usr.tex", + "$TEXMFSYSVAR/tex/context/config"); +} +$PostInstall{"context"} = \&do_context; + + +1; + + +=head1 NAME + +C<TeXLive::TLPostInstall> -- TeX Live Post Installation Routines + +=head1 SYNOPSIS + + use TeXLive::TLPostInstall; + +=head1 DESCRIPTION + +The L<TeXLive::TLPostInstall> module exports the C<%PostInstall> hash indexed +by package names providing code references. + +These code references are called with the root of the installation as +argument (C<$SELFAUTOPARENT>). Additional arguments, but not necessarily +present, are the value of C<TEXMFSYSVAR> and C<TEXMFLOCAL>. + +=head1 SEE ALSO + +The modules L<TeXLive::TLUtils>, L<TeXLive::TLPSRC>, +L<TeXLive::TLPDB>, L<TeXLive::TLTREE>, L<TeXLive::TeXCatalogue>. + +=head1 AUTHORS AND COPYRIGHT + +This script and its documentation were written for the TeX Live +distribution (L<http://tug.org/texlive>) and both are licensed under the +GNU General Public License Version 2 or later. + +=cut + +### Local Variables: +### perl-indent-level: 2 +### tab-width: 2 +### indent-tabs-mode: nil +### End: +# vim:set tabstop=2 expandtab: # diff --git a/Master/tlpkg/TeXLive/win-admin.pl b/Master/tlpkg/TeXLive/win-admin.pl index f163b536721..2953fc717d7 100644 --- a/Master/tlpkg/TeXLive/win-admin.pl +++ b/Master/tlpkg/TeXLive/win-admin.pl @@ -1,6 +1,6 @@ #!/usr/bin/env perl -# $Id: $ +# $Id$ # win-admin.pl # # Copyright 2007 Siep Kroonenberg |