summaryrefslogtreecommitdiff
path: root/Master/tlpkg/etc
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-04-29 18:40:00 +0000
committerNorbert Preining <preining@logic.at>2009-04-29 18:40:00 +0000
commite6c34d631f01f05936410577b9014765521652ba (patch)
tree532c6741e68a1b1387b091c588a777110e09639e /Master/tlpkg/etc
parentac79ca419a8d8b43c8ac562a0a26816fa856a0f4 (diff)
proof of concept, mktextex which actually also works
(with plain tex/pdftex, latex is checking first with openin, and that is not captured) git-svn-id: svn://tug.org/texlive/trunk@12870 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/etc')
-rwxr-xr-xMaster/tlpkg/etc/mktextex.pl73
1 files changed, 73 insertions, 0 deletions
diff --git a/Master/tlpkg/etc/mktextex.pl b/Master/tlpkg/etc/mktextex.pl
new file mode 100755
index 00000000000..1dd107ada9c
--- /dev/null
+++ b/Master/tlpkg/etc/mktextex.pl
@@ -0,0 +1,73 @@
+#!/usr/bin/env perl
+# $Id: mktextex.pl 12269 2009-03-01 16:55:53Z trzeciak $
+#
+# Copyright 2009 Norbert Preining
+# This file is licensed under the GNU General Public License version 2
+# or any later version.
+#
+#
+
+my $svnrev = '$Revision: 12269 $';
+my $datrev = '$Date: 2009-03-01 17:55:53 +0100 (Sun, 01 Mar 2009) $';
+
+our $Master;
+
+BEGIN {
+ $^W = 1;
+ # make subprograms (including kpsewhich) have the right path:
+ $mydir = $0;
+ $mydir =~ s,/[^/]*$,,;
+ if (!$^O=~/^MSWin(32|64)$/i) {
+ $ENV{"PATH"} = "$mydir:$ENV{PATH}";
+ }
+ #
+ chomp($Master = `kpsewhich -var-value=SELFAUTOPARENT`);
+ #
+ # make Perl find our packages first:
+ unshift (@INC, "$Master/tlpkg");
+ unshift (@INC, "$Master/texmf/scripts/texlive");
+}
+
+use Cwd qw/abs_path/;
+use strict;
+
+use TeXLive::TLConfig;
+use TeXLive::TLPDB;
+
+my $localtlpdb = TeXLive::TLPDB->new ("root" => $Master);
+die("cannot find tlpdb in $Master") unless (defined($localtlpdb));
+my $instloc = $localtlpdb->option_location;
+my $mediatlpdb = TeXLive::TLPDB->new ("root" => $instloc);
+die("cannot find tlpdb in $instloc.") unless defined($mediatlpdb);
+
+
+my $fn = shift @ARGV;
+
+printf STDERR "searching tlpdb fof $fn\n";
+
+my @found = $mediatlpdb->find_file($fn);
+
+if ($#found == 0) {
+ # we found only one package, so install it
+ my ($pkg,$file) = split ":", $found[0];
+ printf STDERR "installing $pkg for $file\n";
+ system("tlmgr install $pkg >&2");
+ print "$Master/$file\n";
+} elsif ($#found >= 0) {
+ # too many packages found:
+ printf STDERR "too many packages provide $fn:\n";
+ for my $f (@found) {
+ printf STDERR "$f\n";
+ }
+} else {
+ printf STDERR "$fn not found in tlpdb\n";
+}
+
+exit 1;
+
+### Local Variables:
+### perl-indent-level: 2
+### tab-width: 2
+### indent-tabs-mode: nil
+### End:
+# vim:set tabstop=2 expandtab: #