summaryrefslogtreecommitdiff
path: root/Master/tlpkg/dev/mktextex.pl
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2009-09-15 09:40:04 +0000
committerNorbert Preining <preining@logic.at>2009-09-15 09:40:04 +0000
commit60d44731afa4954a7324f3bbe3e111598874afd2 (patch)
treeb44918fd5babb878b576cdf2a688af6542fcf7e8 /Master/tlpkg/dev/mktextex.pl
parent568f2a84fedd5654cc87f3408d72bd32b4363df3 (diff)
move howto-translations to doc, and rename etc to dev in tlpkg
git-svn-id: svn://tug.org/texlive/trunk@15293 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/dev/mktextex.pl')
-rwxr-xr-xMaster/tlpkg/dev/mktextex.pl73
1 files changed, 73 insertions, 0 deletions
diff --git a/Master/tlpkg/dev/mktextex.pl b/Master/tlpkg/dev/mktextex.pl
new file mode 100755
index 00000000000..1dd107ada9c
--- /dev/null
+++ b/Master/tlpkg/dev/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: #