summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2008-03-01 14:26:22 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2008-03-01 14:26:22 +0000
commit378ba09f53c861ffa2b2dd4f993b00368c8ce968 (patch)
treeb50ea78b17a86d5a64e3d9537a74bb79e5984405
parenta3313580403f891033d312b747c953bdfc1bb8c9 (diff)
getnonfreefonts[-sys]: symlinks on UNIX, wrappers for Windows.
git-svn-id: svn://tug.org/texlive/trunk@6788 c570f23f-e606-0410-a88d-b1316a301751
l---------[-rwxr-xr-x]Master/bin/i386-linux/getnonfreefonts307
-rw-r--r--[l---------]Master/bin/i386-linux/getnonfreefonts-sys2
-rwxr-xr-xMaster/bin/win32/getnonfreefonts-sys.texlua90
-rwxr-xr-xMaster/bin/win32/getnonfreefonts.bat315
-rwxr-xr-xMaster/bin/win32/getnonfreefonts.texlua90
l---------[-rwxr-xr-x]Master/bin/x86_64-linux/getnonfreefonts307
-rw-r--r--[l---------]Master/bin/x86_64-linux/getnonfreefonts-sys2
-rwxr-xr-xMaster/texmf/scripts/texlive/getnonfreefonts.pl (renamed from Master/bin/win32/getnonfreefonts-sys.bat)17
-rw-r--r--Master/tlpkg/tlpsrc/bin-getnonfreefonts.tlpsrc3
9 files changed, 191 insertions, 942 deletions
diff --git a/Master/bin/i386-linux/getnonfreefonts b/Master/bin/i386-linux/getnonfreefonts
index 9c419e65bd7..26aadc46261 100755..120000
--- a/Master/bin/i386-linux/getnonfreefonts
+++ b/Master/bin/i386-linux/getnonfreefonts
@@ -1,306 +1 @@
-#!/usr/bin/env perl
-
-## getnonfreefonts
-## Copyright 2006-2008 Reinhard Kotucha <reinhard.kotucha@web.de>
-#
-# This work may be distributed and/or modified under the
-# conditions of the LaTeX Project Public License, either version 1.3
-# of this license or (at your option) any later version.
-# The latest version of this license is in
-# http://www.latex-project.org/lppl.txt
-#
-# The current maintainer is Reinhard Kotucha.
-
-my $TL_version='2008';
-
-my $getfont_url="ftp://tug.org/tex/getnonfreefonts/getfont$TL_version";
-
-use File::Copy;
-use Getopt::Long;
-$Getopt::Long::autoabbrev=0;
-
-$opt_lsfonts=0;
-$opt_force=0;
-
-sub usage {
- print <<'EOF';
-Usage:
- getnonfreefonts[-sys] [-a|--all] [-d|--debug] [-f|--force]
- [-l|--lsfonts] [-v|--verbose] [--version] [font1] [font2] ...
-
- getnonfreefonts installs fonts in $TEXMFHOME.
- getnonfreefonts-sys installs fonts in $TEXMFLOCAL.
-
- Options:
- -a|--all Install all fonts.
-
- -d|--debug Provide additional messages for debugging.
-
- -f|--force Install fonts even if they are installed already.
-
- -h|--help Print this message.
-
- -l|--lsfonts List all fonts available.
-
- -v|--verbose Be more verbose.
-
- --version Print version number.
-
-EOF
-;
-}
-
-@ARGS=@ARGV;
-
-GetOptions
- "all|a",
- "debug|d",
- "force|f",
- "help|h",
- "lsfonts|l",
- "verbose|v",
- "version",
- "sys";
-
-$^W=1 if $opt_debug;
-
-my $sys=($0=~/-sys$/)? 1:0;
-$sys=1 if $opt_sys;
-
-@allpackages=@ARGV;
-
-print "$TL_version\n" and exit 0 if $opt_version;
-
-if ($opt_help or !@ARGS) {
- print "\nThis is getnonfreefonts";
- print '-sys' if ($sys);
- print ", version $TL_version.\n\n";
- usage;
-}
-
-
-sub message {
- my $message=shift;
- if ($message=~/^\[/) {
- print "$message\n";
- } else {
- printf "%-60s", $message;
- }
-}
-
-
-sub debug_msg {
- my $message=shift;
- if ($opt_debug) {
- print STDERR "DEBUG: $message.\n";
- }
-}
-
-
-sub expand_var {
- my $var=shift;
-
- if (-d "/usr/bin") {
- open KPSEWHICH, 'kpsewhich --expand-var=\$' . "$var |";
- } else {
- open KPSEWHICH, 'kpsewhich --expand-var=$' . "$var |";
- }
- while (<KPSEWHICH>) {
- chop;
- return "$_";
- }
- close KPSEWHICH;
-}
-
-
-# get TMP|TEMP|TMPDIR environment variable
-
-if ($opt_debug) {
- for my $var ("TMP","TEMP","TMPDIR") {
- if (defined $ENV{$var}) {
- debug_msg "Environment variable $var='$ENV{$var}'";
- } else {
- debug_msg "Environment variable $var not set";
- }
- }
-}
-
-
-if (defined $ENV{'TMP'}) {
- $SYSTMP="$ENV{'TMP'}";
-} elsif (defined $ENV{'TEMP'}) {
- $SYSTMP="$ENV{'TEMP'}";
-} elsif (defined $ENV{'TMPDIR'}) {
- $SYSTMP="$ENV{'TMPDIR'}";
-} else {
- $SYSTMP="/tmp";
-}
-
-debug_msg "Internal variable SYSTMP set to '$SYSTMP'";
-
-# Windows usually uses backslashes though forward slashes are probably
-# allowed. Perl always needs forward slashes.
-
-# We convert backslashes to forward slashes on Windows.
-$SYSTMP=~s/\\/\//g if ($^O=~/^MSWin(32|64)/i);
-
-
-debug_msg "Internal variable SYSTMP converted to '$SYSTMP'";
-
-sub check_tmpdir{
-die "! ERROR: The temporary directory '$SYSTMP' doesn't exist.\n"
- unless (-d "$SYSTMP");
-
-die "! ERROR: The temporary directory '$SYSTMP' is not writable.\n"
- unless (-w "$SYSTMP");
-}
-
-# Determine INSTALLROOT.
-
-if ($opt_debug) {
- my @path=split ':', $ENV{PATH};
- for my $dir (@path) {
- debug_msg "Search for kpsewhich in '$dir'";
- opendir DIR, "$dir";
- my @kpsewichs=grep /^kpsewhich/, readdir DIR;
- closedir DIR;
- for (@kpsewichs) {
- debug_msg "Found $dir/$_" if /^kpsewhich/;
- }
- }
-}
-
-
-$INSTALLROOTNAME=($sys)? 'TEXMFLOCAL':'TEXMFHOME';
-
-$INSTALLROOT=expand_var "$INSTALLROOTNAME";
-
-($sys)? debug_msg "sys=true":debug_msg "sys=false";
-
-debug_msg "INSTALLROOT='$INSTALLROOT'";
-
-$INSTALLROOT=~s/\\/\//g if ($^O=~/^MSWin(32|64)/i);
-
-debug_msg "Internal variable INSTALLROOT converted to '$INSTALLROOT'";
-
-sub check_installroot {
- die "! ERROR: The variable $INSTALLROOTNAME is not set.\n"
- unless length ("$INSTALLROOT") > 0;
-
- die "! ERROR: The install directory '$INSTALLROOT' doesn't " .
- "exist.\n" .
- " If this is the correct path, please create " .
- "this directory manually.\n"
- unless (-d "$INSTALLROOT");
-
- die "! ERROR: The install directory '$INSTALLROOT' is not writable.\n"
- unless (-w "$INSTALLROOT");
-}
-
-if ($opt_help or !@ARGS) {
- print <<"ENDUSAGE";
- Directories:
- temporary: '$SYSTMP/getfont-<PID>'
- install: '$INSTALLROOT'
-
-ENDUSAGE
-check_tmpdir;
-check_installroot;
-exit 0;
-}
-
-check_tmpdir;
-check_installroot;
-
-my $tmpdir="$SYSTMP/getfont-$$";
-debug_msg "Internal variable tmpdir set to '$tmpdir'";
-
-mkdir "$tmpdir" or die "! ERROR: Can't mkdir '$tmpdir'.";
-chdir "$tmpdir" or die "! ERROR: Can't cd '$tmpdir'.";
-
-sub remove_tmpdir {
- chdir "$SYSTMP" or die "! ERROR: Can't cd '$SYSTMP'.\n";
- opendir TMPDIR, "$tmpdir"
- or print "! ERROR: Can't read directory '$tmpdir'.\n";
-
- @alltmps=readdir TMPDIR;
- closedir TMPDIR;
-
- foreach $file (@alltmps) {
- next if $file=~/^\./;
- unlink "$tmpdir/$file";
- }
- rmdir "$tmpdir" or die "! ERROR: Can't remove directory '$tmpdir'.\n";
-}
-
-# Signal handlers.
-
-my @common_signals=qw(INT ILL FPE SEGV TERM ABRT);
-my @signals_UNIX=qw(QUIT BUS PIPE);
-my @signals_Win32=qw(BREAK);
-
-
-if ($^O=~/^MSWin(32|64)$/i) {
- @signals=(@common_signals, @signals_Win32);
-} else {
- @signals=(@common_signals, @signals_UNIX);
-}
-
-debug_msg "Supported signals: @signals\n";
-
-foreach my $signal (@signals) {
- $SIG{"$signal"}=\&remove_tmpdir;
-}
-
-# Download the script from tug.org.
-
-debug_msg "Running 'wget $getfont_url'";
-
-system ('wget', "$getfont_url") == 0 or die "! Error: Can't execute wget.\n";
-
-# Download the fonts.
-
-my @getfont=('perl', "./getfont$TL_version", '--getnonfreefonts');
-push @getfont, "--installroot=$INSTALLROOT";
-push @getfont, '--lsfonts' if $opt_lsfonts;
-push @getfont, '--force' if $opt_force;
-push @getfont, '--debug' if $opt_debug;
-push @getfont, '--verbose' if $opt_verbose;
-push @getfont, '--sys' if $sys;
-push @getfont, '--all' if $opt_all;
-push @getfont, @allpackages;
-
-debug_msg "Running '@getfont'";
-
-system @getfont;
-
-# Evaluate the exit status. It will be 2 if something had been
-# installed and in this case we need to run texhash/updmap.
-
-my $exit_code=$?;
-my $exit_status=int($exit_code/256);
-
-if ($sys) {
- debug_msg "Info: Execute updmap-sys if exit status is 2";
-} else {
- debug_msg "Info: Execute updmap if exit status is 2";
-}
-
-debug_msg "Exit status of getfont$TL_version is $exit_status";
-
-if ($exit_status==2) {
- print "\n";
- system 'texhash', "$INSTALLROOT";
- $updmap_command=($sys)? 'updmap-sys':'updmap';
- @updmap=("$updmap_command");
- push @updmap, '--quiet' unless $opt_verbose;
- print "\n";
- message "Updating map files ($updmap_command)...";
- system @updmap;
-
- message $?? '[failed]':'[done]';
-}
-
-remove_tmpdir;
-
-__END__
+../../texmf/scripts/texlive/getnonfreefonts.pl \ No newline at end of file
diff --git a/Master/bin/i386-linux/getnonfreefonts-sys b/Master/bin/i386-linux/getnonfreefonts-sys
index d1e30f335dd..b3fbf603329 120000..100644
--- a/Master/bin/i386-linux/getnonfreefonts-sys
+++ b/Master/bin/i386-linux/getnonfreefonts-sys
@@ -1 +1 @@
-getnonfreefonts \ No newline at end of file
+link ../../texmf/scripts/texlive/getnonfreefonts.pl \ No newline at end of file
diff --git a/Master/bin/win32/getnonfreefonts-sys.texlua b/Master/bin/win32/getnonfreefonts-sys.texlua
new file mode 100755
index 00000000000..e0d53d93137
--- /dev/null
+++ b/Master/bin/win32/getnonfreefonts-sys.texlua
@@ -0,0 +1,90 @@
+#! /usr/bin/env texlua
+--*-Lua-*-
+-- $Id: epstopdf.texlua 6757 2008-02-26 23:31:18Z reinhardk $
+
+-- Copyright (C) 2007 Reinhard Kotucha, Norbert Preining.
+-- You may freely use, modify and/or distribute this file.
+
+-- Wrapper for scripts.
+
+function fixwin(args_unix)
+ if os.type == 'windows' then
+ local args_win={} -- new table
+ args_win[0]=args_unix[1]
+ for i=1, #args_unix do
+ args_win[i]='"'..args_unix[i]..'"'
+ end
+ return args_win
+ else
+ return args_unix
+ end
+end
+
+if string.find(arg[0], '/') then -- UNIX path
+ filename=select(1, string.gsub(arg[0], '.*/', ''))
+elseif string.find(arg[0], '\\') then -- Windows path
+ filename=select(1, string.gsub(arg[0], '.*\\', ''))
+else -- no path
+ filename=arg[0]
+end
+
+basename=select(1, string.gsub(filename, '\.texlua$', ''))
+
+sys=false
+
+if string.find(basename, '-sys$') then
+ basename=select(1, string.gsub(basename, '-sys$', ''))
+ sys=true
+end
+
+kpse.set_program_name(filename, basename)
+TEXDIR=kpse.var_value('SELFAUTOPARENT')
+BINDIR=kpse.var_value('SELFAUTOLOC')
+
+os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib')
+os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib')
+os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'..os.getenv('PATH'))
+
+if sys then
+ os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR'))
+ os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG'))
+ os.setenv('TEX_SYS_PROG', 'true')
+end
+
+if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then
+ command={BINDIR..'/'..basename..'.exe'}
+elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') then
+ command={BINDIR..'/'..basename..'-bin.exe'}
+elseif lfs.isdir(BINDIR..'/'..basename..'.pl') then
+ perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe'
+ script=BINDIR..'/'..basename..'.pl'
+ command={perlbin, script}
+elseif kpse.find_file(basename..'.pl', 'texmfscripts') then
+ perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe'
+ script=kpse.find_file(basename..'.pl', 'texmfscripts')
+ command={perlbin, script}
+elseif kpse.find_file(basename..'.rb', 'texmfscripts') then
+ script=kpse.find_file(basename..'.rb', 'texmfscripts')
+ command={'ruby', script}
+elseif kpse.find_file(basename..'.py', 'texmfscripts') then
+ script=kpse.find_file(basename..'.py', 'texmfscripts')
+ command={'python', script}
+elseif kpse.find_file(basename..'.texlua', 'texmfscripts') then
+ script=kpse.find_file(basename..'.texlua', 'texmfscripts')
+ command={'texlua', script}
+elseif kpse.find_file(basename..'.lua', 'texmfscripts') then
+ script=kpse.find_file(basename..'.lua', 'texmfscripts')
+ command={'texlua', script}
+else
+ os.stderr:write(filename..'.texlua: No interpreter found for '..
+ basename..'\n')
+end
+
+for i=1, #arg do
+ command[#command+1]=arg[i]
+end
+
+command=fixwin(command)
+
+ret=os.spawn(command)
+os.exit(ret)
diff --git a/Master/bin/win32/getnonfreefonts.bat b/Master/bin/win32/getnonfreefonts.bat
deleted file mode 100755
index 1ed804c3f53..00000000000
--- a/Master/bin/win32/getnonfreefonts.bat
+++ /dev/null
@@ -1,315 +0,0 @@
-@rem = '--*-Perl-*--
-@echo off
-perl -x -S %0 %*
-goto endofperl
-@rem ';
-#!/usr/bin/env perl
-#line 8
-#!/usr/bin/env perl
-
-## getnonfreefonts
-## Copyright 2006-2008 Reinhard Kotucha <reinhard.kotucha@web.de>
-#
-# This work may be distributed and/or modified under the
-# conditions of the LaTeX Project Public License, either version 1.3
-# of this license or (at your option) any later version.
-# The latest version of this license is in
-# http://www.latex-project.org/lppl.txt
-#
-# The current maintainer is Reinhard Kotucha.
-
-my $TL_version='2008';
-
-my $getfont_url="ftp://tug.org/tex/getnonfreefonts/getfont$TL_version";
-
-use File::Copy;
-use Getopt::Long;
-$Getopt::Long::autoabbrev=0;
-
-$opt_lsfonts=0;
-$opt_force=0;
-
-sub usage {
- print <<'EOF';
-Usage:
- getnonfreefonts[-sys] [-a|--all] [-d|--debug] [-f|--force]
- [-l|--lsfonts] [-v|--verbose] [--version] [font1] [font2] ...
-
- getnonfreefonts installs fonts in $TEXMFHOME.
- getnonfreefonts-sys installs fonts in $TEXMFLOCAL.
-
- Options:
- -a|--all Install all fonts.
-
- -d|--debug Provide additional messages for debugging.
-
- -f|--force Install fonts even if they are installed already.
-
- -h|--help Print this message.
-
- -l|--lsfonts List all fonts available.
-
- -v|--verbose Be more verbose.
-
- --version Print version number.
-
-EOF
-;
-}
-
-@ARGS=@ARGV;
-
-GetOptions
- "all|a",
- "debug|d",
- "force|f",
- "help|h",
- "lsfonts|l",
- "verbose|v",
- "version",
- "sys";
-
-$^W=1 if $opt_debug;
-
-my $sys=($0=~/-sys$/)? 1:0;
-$sys=1 if $opt_sys;
-
-@allpackages=@ARGV;
-
-print "$TL_version\n" and exit 0 if $opt_version;
-
-if ($opt_help or !@ARGS) {
- print "\nThis is getnonfreefonts";
- print '-sys' if ($sys);
- print ", version $TL_version.\n\n";
- usage;
-}
-
-
-sub message {
- my $message=shift;
- if ($message=~/^\[/) {
- print "$message\n";
- } else {
- printf "%-60s", $message;
- }
-}
-
-
-sub debug_msg {
- my $message=shift;
- if ($opt_debug) {
- print STDERR "DEBUG: $message.\n";
- }
-}
-
-
-sub expand_var {
- my $var=shift;
-
- if (-d "/usr/bin") {
- open KPSEWHICH, 'kpsewhich --expand-var=\$' . "$var |";
- } else {
- open KPSEWHICH, 'kpsewhich --expand-var=$' . "$var |";
- }
- while (<KPSEWHICH>) {
- chop;
- return "$_";
- }
- close KPSEWHICH;
-}
-
-
-# get TMP|TEMP|TMPDIR environment variable
-
-if ($opt_debug) {
- for my $var ("TMP","TEMP","TMPDIR") {
- if (defined $ENV{$var}) {
- debug_msg "Environment variable $var='$ENV{$var}'";
- } else {
- debug_msg "Environment variable $var not set";
- }
- }
-}
-
-
-if (defined $ENV{'TMP'}) {
- $SYSTMP="$ENV{'TMP'}";
-} elsif (defined $ENV{'TEMP'}) {
- $SYSTMP="$ENV{'TEMP'}";
-} elsif (defined $ENV{'TMPDIR'}) {
- $SYSTMP="$ENV{'TMPDIR'}";
-} else {
- $SYSTMP="/tmp";
-}
-
-debug_msg "Internal variable SYSTMP set to '$SYSTMP'";
-
-# Windows usually uses backslashes though forward slashes are probably
-# allowed. Perl always needs forward slashes.
-
-# We convert backslashes to forward slashes on Windows.
-$SYSTMP=~s/\\/\//g if ($^O=~/^MSWin(32|64)/i);
-
-
-debug_msg "Internal variable SYSTMP converted to '$SYSTMP'";
-
-sub check_tmpdir{
-die "! ERROR: The temporary directory '$SYSTMP' doesn't exist.\n"
- unless (-d "$SYSTMP");
-
-die "! ERROR: The temporary directory '$SYSTMP' is not writable.\n"
- unless (-w "$SYSTMP");
-}
-
-# Determine INSTALLROOT.
-
-if ($opt_debug) {
- my @path=split ':', $ENV{PATH};
- for my $dir (@path) {
- debug_msg "Search for kpsewhich in '$dir'";
- opendir DIR, "$dir";
- my @kpsewichs=grep /^kpsewhich/, readdir DIR;
- closedir DIR;
- for (@kpsewichs) {
- debug_msg "Found $dir/$_" if /^kpsewhich/;
- }
- }
-}
-
-
-$INSTALLROOTNAME=($sys)? 'TEXMFLOCAL':'TEXMFHOME';
-
-$INSTALLROOT=expand_var "$INSTALLROOTNAME";
-
-($sys)? debug_msg "sys=true":debug_msg "sys=false";
-
-debug_msg "INSTALLROOT='$INSTALLROOT'";
-
-$INSTALLROOT=~s/\\/\//g if ($^O=~/^MSWin(32|64)/i);
-
-debug_msg "Internal variable INSTALLROOT converted to '$INSTALLROOT'";
-
-sub check_installroot {
- die "! ERROR: The variable $INSTALLROOTNAME is not set.\n"
- unless length ("$INSTALLROOT") > 0;
-
- die "! ERROR: The install directory '$INSTALLROOT' doesn't " .
- "exist.\n" .
- " If this is the correct path, please create " .
- "this directory manually.\n"
- unless (-d "$INSTALLROOT");
-
- die "! ERROR: The install directory '$INSTALLROOT' is not writable.\n"
- unless (-w "$INSTALLROOT");
-}
-
-if ($opt_help or !@ARGS) {
- print <<"ENDUSAGE";
- Directories:
- temporary: '$SYSTMP/getfont-<PID>'
- install: '$INSTALLROOT'
-
-ENDUSAGE
-check_tmpdir;
-check_installroot;
-exit 0;
-}
-
-check_tmpdir;
-check_installroot;
-
-my $tmpdir="$SYSTMP/getfont-$$";
-debug_msg "Internal variable tmpdir set to '$tmpdir'";
-
-mkdir "$tmpdir" or die "! ERROR: Can't mkdir '$tmpdir'.";
-chdir "$tmpdir" or die "! ERROR: Can't cd '$tmpdir'.";
-
-sub remove_tmpdir {
- chdir "$SYSTMP" or die "! ERROR: Can't cd '$SYSTMP'.\n";
- opendir TMPDIR, "$tmpdir"
- or print "! ERROR: Can't read directory '$tmpdir'.\n";
-
- @alltmps=readdir TMPDIR;
- closedir TMPDIR;
-
- foreach $file (@alltmps) {
- next if $file=~/^\./;
- unlink "$tmpdir/$file";
- }
- rmdir "$tmpdir" or die "! ERROR: Can't remove directory '$tmpdir'.\n";
-}
-
-# Signal handlers.
-
-my @common_signals=qw(INT ILL FPE SEGV TERM ABRT);
-my @signals_UNIX=qw(QUIT BUS PIPE);
-my @signals_Win32=qw(BREAK);
-
-
-if ($^O=~/^MSWin(32|64)$/i) {
- @signals=(@common_signals, @signals_Win32);
-} else {
- @signals=(@common_signals, @signals_UNIX);
-}
-
-debug_msg "Supported signals: @signals\n";
-
-foreach my $signal (@signals) {
- $SIG{"$signal"}=\&remove_tmpdir;
-}
-
-# Download the script from tug.org.
-
-debug_msg "Running 'wget $getfont_url'";
-
-system ('wget', "$getfont_url") == 0 or die "! Error: Can't execute wget.\n";
-
-# Download the fonts.
-
-my @getfont=('perl', "./getfont$TL_version", '--getnonfreefonts');
-push @getfont, "--installroot=$INSTALLROOT";
-push @getfont, '--lsfonts' if $opt_lsfonts;
-push @getfont, '--force' if $opt_force;
-push @getfont, '--debug' if $opt_debug;
-push @getfont, '--verbose' if $opt_verbose;
-push @getfont, '--sys' if $sys;
-push @getfont, '--all' if $opt_all;
-push @getfont, @allpackages;
-
-debug_msg "Running '@getfont'";
-
-system @getfont;
-
-# Evaluate the exit status. It will be 2 if something had been
-# installed and in this case we need to run texhash/updmap.
-
-my $exit_code=$?;
-my $exit_status=int($exit_code/256);
-
-if ($sys) {
- debug_msg "Info: Execute updmap-sys if exit status is 2";
-} else {
- debug_msg "Info: Execute updmap if exit status is 2";
-}
-
-debug_msg "Exit status of getfont$TL_version is $exit_status";
-
-if ($exit_status==2) {
- print "\n";
- system 'texhash', "$INSTALLROOT";
- $updmap_command=($sys)? 'updmap-sys':'updmap';
- @updmap=("$updmap_command");
- push @updmap, '--quiet' unless $opt_verbose;
- print "\n";
- message "Updating map files ($updmap_command)...";
- system @updmap;
-
- message $?? '[failed]':'[done]';
-}
-
-remove_tmpdir;
-
-__END__
-:endofperl
-
diff --git a/Master/bin/win32/getnonfreefonts.texlua b/Master/bin/win32/getnonfreefonts.texlua
new file mode 100755
index 00000000000..e0d53d93137
--- /dev/null
+++ b/Master/bin/win32/getnonfreefonts.texlua
@@ -0,0 +1,90 @@
+#! /usr/bin/env texlua
+--*-Lua-*-
+-- $Id: epstopdf.texlua 6757 2008-02-26 23:31:18Z reinhardk $
+
+-- Copyright (C) 2007 Reinhard Kotucha, Norbert Preining.
+-- You may freely use, modify and/or distribute this file.
+
+-- Wrapper for scripts.
+
+function fixwin(args_unix)
+ if os.type == 'windows' then
+ local args_win={} -- new table
+ args_win[0]=args_unix[1]
+ for i=1, #args_unix do
+ args_win[i]='"'..args_unix[i]..'"'
+ end
+ return args_win
+ else
+ return args_unix
+ end
+end
+
+if string.find(arg[0], '/') then -- UNIX path
+ filename=select(1, string.gsub(arg[0], '.*/', ''))
+elseif string.find(arg[0], '\\') then -- Windows path
+ filename=select(1, string.gsub(arg[0], '.*\\', ''))
+else -- no path
+ filename=arg[0]
+end
+
+basename=select(1, string.gsub(filename, '\.texlua$', ''))
+
+sys=false
+
+if string.find(basename, '-sys$') then
+ basename=select(1, string.gsub(basename, '-sys$', ''))
+ sys=true
+end
+
+kpse.set_program_name(filename, basename)
+TEXDIR=kpse.var_value('SELFAUTOPARENT')
+BINDIR=kpse.var_value('SELFAUTOLOC')
+
+os.setenv('PERL5LIB', TEXDIR..'/tlpkg/tlperl/lib')
+os.setenv('GS_LIB', TEXDIR..'/tlpkg/tlgs/lib')
+os.setenv('PATH', TEXDIR..'/tlpkg/tlgs/bin;'..os.getenv('PATH'))
+
+if sys then
+ os.setenv('TEXMFVAR', kpse.var_value('TEXMFSYSVAR'))
+ os.setenv('TEXMFCONFIG', kpse.var_value('TEXMFSYSCONFIG'))
+ os.setenv('TEX_SYS_PROG', 'true')
+end
+
+if sys and lfs.isfile(BINDIR..'/'..basename..'.exe') then
+ command={BINDIR..'/'..basename..'.exe'}
+elseif lfs.isfile(BINDIR..'/'..basename..'-bin.exe') then
+ command={BINDIR..'/'..basename..'-bin.exe'}
+elseif lfs.isdir(BINDIR..'/'..basename..'.pl') then
+ perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe'
+ script=BINDIR..'/'..basename..'.pl'
+ command={perlbin, script}
+elseif kpse.find_file(basename..'.pl', 'texmfscripts') then
+ perlbin=TEXDIR..'/tlpkg/tlperl/bin/perl.exe'
+ script=kpse.find_file(basename..'.pl', 'texmfscripts')
+ command={perlbin, script}
+elseif kpse.find_file(basename..'.rb', 'texmfscripts') then
+ script=kpse.find_file(basename..'.rb', 'texmfscripts')
+ command={'ruby', script}
+elseif kpse.find_file(basename..'.py', 'texmfscripts') then
+ script=kpse.find_file(basename..'.py', 'texmfscripts')
+ command={'python', script}
+elseif kpse.find_file(basename..'.texlua', 'texmfscripts') then
+ script=kpse.find_file(basename..'.texlua', 'texmfscripts')
+ command={'texlua', script}
+elseif kpse.find_file(basename..'.lua', 'texmfscripts') then
+ script=kpse.find_file(basename..'.lua', 'texmfscripts')
+ command={'texlua', script}
+else
+ os.stderr:write(filename..'.texlua: No interpreter found for '..
+ basename..'\n')
+end
+
+for i=1, #arg do
+ command[#command+1]=arg[i]
+end
+
+command=fixwin(command)
+
+ret=os.spawn(command)
+os.exit(ret)
diff --git a/Master/bin/x86_64-linux/getnonfreefonts b/Master/bin/x86_64-linux/getnonfreefonts
index 9c419e65bd7..26aadc46261 100755..120000
--- a/Master/bin/x86_64-linux/getnonfreefonts
+++ b/Master/bin/x86_64-linux/getnonfreefonts
@@ -1,306 +1 @@
-#!/usr/bin/env perl
-
-## getnonfreefonts
-## Copyright 2006-2008 Reinhard Kotucha <reinhard.kotucha@web.de>
-#
-# This work may be distributed and/or modified under the
-# conditions of the LaTeX Project Public License, either version 1.3
-# of this license or (at your option) any later version.
-# The latest version of this license is in
-# http://www.latex-project.org/lppl.txt
-#
-# The current maintainer is Reinhard Kotucha.
-
-my $TL_version='2008';
-
-my $getfont_url="ftp://tug.org/tex/getnonfreefonts/getfont$TL_version";
-
-use File::Copy;
-use Getopt::Long;
-$Getopt::Long::autoabbrev=0;
-
-$opt_lsfonts=0;
-$opt_force=0;
-
-sub usage {
- print <<'EOF';
-Usage:
- getnonfreefonts[-sys] [-a|--all] [-d|--debug] [-f|--force]
- [-l|--lsfonts] [-v|--verbose] [--version] [font1] [font2] ...
-
- getnonfreefonts installs fonts in $TEXMFHOME.
- getnonfreefonts-sys installs fonts in $TEXMFLOCAL.
-
- Options:
- -a|--all Install all fonts.
-
- -d|--debug Provide additional messages for debugging.
-
- -f|--force Install fonts even if they are installed already.
-
- -h|--help Print this message.
-
- -l|--lsfonts List all fonts available.
-
- -v|--verbose Be more verbose.
-
- --version Print version number.
-
-EOF
-;
-}
-
-@ARGS=@ARGV;
-
-GetOptions
- "all|a",
- "debug|d",
- "force|f",
- "help|h",
- "lsfonts|l",
- "verbose|v",
- "version",
- "sys";
-
-$^W=1 if $opt_debug;
-
-my $sys=($0=~/-sys$/)? 1:0;
-$sys=1 if $opt_sys;
-
-@allpackages=@ARGV;
-
-print "$TL_version\n" and exit 0 if $opt_version;
-
-if ($opt_help or !@ARGS) {
- print "\nThis is getnonfreefonts";
- print '-sys' if ($sys);
- print ", version $TL_version.\n\n";
- usage;
-}
-
-
-sub message {
- my $message=shift;
- if ($message=~/^\[/) {
- print "$message\n";
- } else {
- printf "%-60s", $message;
- }
-}
-
-
-sub debug_msg {
- my $message=shift;
- if ($opt_debug) {
- print STDERR "DEBUG: $message.\n";
- }
-}
-
-
-sub expand_var {
- my $var=shift;
-
- if (-d "/usr/bin") {
- open KPSEWHICH, 'kpsewhich --expand-var=\$' . "$var |";
- } else {
- open KPSEWHICH, 'kpsewhich --expand-var=$' . "$var |";
- }
- while (<KPSEWHICH>) {
- chop;
- return "$_";
- }
- close KPSEWHICH;
-}
-
-
-# get TMP|TEMP|TMPDIR environment variable
-
-if ($opt_debug) {
- for my $var ("TMP","TEMP","TMPDIR") {
- if (defined $ENV{$var}) {
- debug_msg "Environment variable $var='$ENV{$var}'";
- } else {
- debug_msg "Environment variable $var not set";
- }
- }
-}
-
-
-if (defined $ENV{'TMP'}) {
- $SYSTMP="$ENV{'TMP'}";
-} elsif (defined $ENV{'TEMP'}) {
- $SYSTMP="$ENV{'TEMP'}";
-} elsif (defined $ENV{'TMPDIR'}) {
- $SYSTMP="$ENV{'TMPDIR'}";
-} else {
- $SYSTMP="/tmp";
-}
-
-debug_msg "Internal variable SYSTMP set to '$SYSTMP'";
-
-# Windows usually uses backslashes though forward slashes are probably
-# allowed. Perl always needs forward slashes.
-
-# We convert backslashes to forward slashes on Windows.
-$SYSTMP=~s/\\/\//g if ($^O=~/^MSWin(32|64)/i);
-
-
-debug_msg "Internal variable SYSTMP converted to '$SYSTMP'";
-
-sub check_tmpdir{
-die "! ERROR: The temporary directory '$SYSTMP' doesn't exist.\n"
- unless (-d "$SYSTMP");
-
-die "! ERROR: The temporary directory '$SYSTMP' is not writable.\n"
- unless (-w "$SYSTMP");
-}
-
-# Determine INSTALLROOT.
-
-if ($opt_debug) {
- my @path=split ':', $ENV{PATH};
- for my $dir (@path) {
- debug_msg "Search for kpsewhich in '$dir'";
- opendir DIR, "$dir";
- my @kpsewichs=grep /^kpsewhich/, readdir DIR;
- closedir DIR;
- for (@kpsewichs) {
- debug_msg "Found $dir/$_" if /^kpsewhich/;
- }
- }
-}
-
-
-$INSTALLROOTNAME=($sys)? 'TEXMFLOCAL':'TEXMFHOME';
-
-$INSTALLROOT=expand_var "$INSTALLROOTNAME";
-
-($sys)? debug_msg "sys=true":debug_msg "sys=false";
-
-debug_msg "INSTALLROOT='$INSTALLROOT'";
-
-$INSTALLROOT=~s/\\/\//g if ($^O=~/^MSWin(32|64)/i);
-
-debug_msg "Internal variable INSTALLROOT converted to '$INSTALLROOT'";
-
-sub check_installroot {
- die "! ERROR: The variable $INSTALLROOTNAME is not set.\n"
- unless length ("$INSTALLROOT") > 0;
-
- die "! ERROR: The install directory '$INSTALLROOT' doesn't " .
- "exist.\n" .
- " If this is the correct path, please create " .
- "this directory manually.\n"
- unless (-d "$INSTALLROOT");
-
- die "! ERROR: The install directory '$INSTALLROOT' is not writable.\n"
- unless (-w "$INSTALLROOT");
-}
-
-if ($opt_help or !@ARGS) {
- print <<"ENDUSAGE";
- Directories:
- temporary: '$SYSTMP/getfont-<PID>'
- install: '$INSTALLROOT'
-
-ENDUSAGE
-check_tmpdir;
-check_installroot;
-exit 0;
-}
-
-check_tmpdir;
-check_installroot;
-
-my $tmpdir="$SYSTMP/getfont-$$";
-debug_msg "Internal variable tmpdir set to '$tmpdir'";
-
-mkdir "$tmpdir" or die "! ERROR: Can't mkdir '$tmpdir'.";
-chdir "$tmpdir" or die "! ERROR: Can't cd '$tmpdir'.";
-
-sub remove_tmpdir {
- chdir "$SYSTMP" or die "! ERROR: Can't cd '$SYSTMP'.\n";
- opendir TMPDIR, "$tmpdir"
- or print "! ERROR: Can't read directory '$tmpdir'.\n";
-
- @alltmps=readdir TMPDIR;
- closedir TMPDIR;
-
- foreach $file (@alltmps) {
- next if $file=~/^\./;
- unlink "$tmpdir/$file";
- }
- rmdir "$tmpdir" or die "! ERROR: Can't remove directory '$tmpdir'.\n";
-}
-
-# Signal handlers.
-
-my @common_signals=qw(INT ILL FPE SEGV TERM ABRT);
-my @signals_UNIX=qw(QUIT BUS PIPE);
-my @signals_Win32=qw(BREAK);
-
-
-if ($^O=~/^MSWin(32|64)$/i) {
- @signals=(@common_signals, @signals_Win32);
-} else {
- @signals=(@common_signals, @signals_UNIX);
-}
-
-debug_msg "Supported signals: @signals\n";
-
-foreach my $signal (@signals) {
- $SIG{"$signal"}=\&remove_tmpdir;
-}
-
-# Download the script from tug.org.
-
-debug_msg "Running 'wget $getfont_url'";
-
-system ('wget', "$getfont_url") == 0 or die "! Error: Can't execute wget.\n";
-
-# Download the fonts.
-
-my @getfont=('perl', "./getfont$TL_version", '--getnonfreefonts');
-push @getfont, "--installroot=$INSTALLROOT";
-push @getfont, '--lsfonts' if $opt_lsfonts;
-push @getfont, '--force' if $opt_force;
-push @getfont, '--debug' if $opt_debug;
-push @getfont, '--verbose' if $opt_verbose;
-push @getfont, '--sys' if $sys;
-push @getfont, '--all' if $opt_all;
-push @getfont, @allpackages;
-
-debug_msg "Running '@getfont'";
-
-system @getfont;
-
-# Evaluate the exit status. It will be 2 if something had been
-# installed and in this case we need to run texhash/updmap.
-
-my $exit_code=$?;
-my $exit_status=int($exit_code/256);
-
-if ($sys) {
- debug_msg "Info: Execute updmap-sys if exit status is 2";
-} else {
- debug_msg "Info: Execute updmap if exit status is 2";
-}
-
-debug_msg "Exit status of getfont$TL_version is $exit_status";
-
-if ($exit_status==2) {
- print "\n";
- system 'texhash', "$INSTALLROOT";
- $updmap_command=($sys)? 'updmap-sys':'updmap';
- @updmap=("$updmap_command");
- push @updmap, '--quiet' unless $opt_verbose;
- print "\n";
- message "Updating map files ($updmap_command)...";
- system @updmap;
-
- message $?? '[failed]':'[done]';
-}
-
-remove_tmpdir;
-
-__END__
+../../texmf/scripts/texlive/getnonfreefonts.pl \ No newline at end of file
diff --git a/Master/bin/x86_64-linux/getnonfreefonts-sys b/Master/bin/x86_64-linux/getnonfreefonts-sys
index d1e30f335dd..b3fbf603329 120000..100644
--- a/Master/bin/x86_64-linux/getnonfreefonts-sys
+++ b/Master/bin/x86_64-linux/getnonfreefonts-sys
@@ -1 +1 @@
-getnonfreefonts \ No newline at end of file
+link ../../texmf/scripts/texlive/getnonfreefonts.pl \ No newline at end of file
diff --git a/Master/bin/win32/getnonfreefonts-sys.bat b/Master/texmf/scripts/texlive/getnonfreefonts.pl
index 1ed804c3f53..382a6f9c290 100755
--- a/Master/bin/win32/getnonfreefonts-sys.bat
+++ b/Master/texmf/scripts/texlive/getnonfreefonts.pl
@@ -1,10 +1,3 @@
-@rem = '--*-Perl-*--
-@echo off
-perl -x -S %0 %*
-goto endofperl
-@rem ';
-#!/usr/bin/env perl
-#line 8
#!/usr/bin/env perl
## getnonfreefonts
@@ -73,6 +66,7 @@ $^W=1 if $opt_debug;
my $sys=($0=~/-sys$/)? 1:0;
$sys=1 if $opt_sys;
+$sys=1 if (defined $ENV{'TEX_SYS_PROG'});
@allpackages=@ARGV;
@@ -107,10 +101,10 @@ sub debug_msg {
sub expand_var {
my $var=shift;
- if (-d "/usr/bin") {
- open KPSEWHICH, 'kpsewhich --expand-var=\$' . "$var |";
- } else {
+ if ($^O=~/^MSWin(32|64)/i) {
open KPSEWHICH, 'kpsewhich --expand-var=$' . "$var |";
+ } else {
+ open KPSEWHICH, 'kpsewhich --expand-var=\$' . "$var |";
}
while (<KPSEWHICH>) {
chop;
@@ -119,7 +113,6 @@ sub expand_var {
close KPSEWHICH;
}
-
# get TMP|TEMP|TMPDIR environment variable
if ($opt_debug) {
@@ -311,5 +304,3 @@ if ($exit_status==2) {
remove_tmpdir;
__END__
-:endofperl
-
diff --git a/Master/tlpkg/tlpsrc/bin-getnonfreefonts.tlpsrc b/Master/tlpkg/tlpsrc/bin-getnonfreefonts.tlpsrc
index ab3194602e6..cfe95fa5753 100644
--- a/Master/tlpkg/tlpsrc/bin-getnonfreefonts.tlpsrc
+++ b/Master/tlpkg/tlpsrc/bin-getnonfreefonts.tlpsrc
@@ -1,5 +1,8 @@
name bin-getnonfreefonts
category TLCore
+runpattern f texmf/scripts/texlive/getnonfreefonts.pl
docpattern f texmf/doc/man/man1/getnonfreefonts*.1
binpattern f bin/${ARCH}/getnonfreefonts
binpattern f bin/${ARCH}/getnonfreefonts-sys
+binpattern f bin/win32/getnonfreefonts.texlua
+binpattern f bin/win32/getnonfreefonts-sys.texlua