summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2006-11-26 20:35:29 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2006-11-26 20:35:29 +0000
commit065e129d47bd651ee8636eb053a2e740637ebf50 (patch)
tree53f75a58c094434b3f9510314b09e24dd90cf1fa /Build/source
parent09b5e127a07e9a9bb4b61622f741ff16a9099a11 (diff)
update getnonfreefonts, add wget binary and psf2dsc for win32.
git-svn-id: svn://tug.org/texlive/trunk@2545 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/texlive/Makefile.in2
-rw-r--r--Build/source/texk/texlive/getnonfreefonts341
-rw-r--r--Build/source/texk/texlive/getnonfreefonts-sys.man1
-rw-r--r--Build/source/texk/texlive/getnonfreefonts.man202
4 files changed, 260 insertions, 286 deletions
diff --git a/Build/source/texk/texlive/Makefile.in b/Build/source/texk/texlive/Makefile.in
index 3eb263485c7..3ffc23fbc85 100644
--- a/Build/source/texk/texlive/Makefile.in
+++ b/Build/source/texk/texlive/Makefile.in
@@ -11,7 +11,7 @@ LIVESCRIPTS = altpdftex simpdftex \
ALTPDFTEXCOPIES = altpdfaleph altpdfamstex altpdfcont-en altpdfcont-nl \
altpdfetex altpdflambda altpdflatex altpdfomega
-manpgs = getnonfreefonts
+manpgs = getnonfreefonts getnonfreefonts-sys
all: $(LIVESCRIPTS)
default: all
diff --git a/Build/source/texk/texlive/getnonfreefonts b/Build/source/texk/texlive/getnonfreefonts
index 21dd7a0fff8..4072a0917fe 100644
--- a/Build/source/texk/texlive/getnonfreefonts
+++ b/Build/source/texk/texlive/getnonfreefonts
@@ -1,7 +1,7 @@
-#!/bin/sh
+#!/usr/bin/env perl
## getnonfreefonts
-## Copyright 2005 Reinhard Kotucha <reinhard.kotucha@web.de>
+## Copyright 2006 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
@@ -11,156 +11,193 @@
#
# The current maintainer is Reinhard Kotucha.
+my $TL_version='2006';
-# invoke the right shell (code from Thomas Esser):
-test -f /bin/ksh && test -z "$RUNNING_KSH" \
- && { UNAMES=`uname -s`; test "x$UNAMES" = xULTRIX; } 2>/dev/null \
- && { RUNNING_KSH=true; export RUNNING_KSH; exec /bin/ksh $0 ${1+"$@"}; }
-unset RUNNING_KSH
-
-test -f /bin/bsh && test -z "$RUNNING_BSH" \
- && { UNAMES=`uname -s`; test "x$UNAMES" = xAIX; } 2>/dev/null \
- && { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; }
-unset RUNNING_BSH
-
-
-URL="${URL-ftp://tug.org/tex/getnonfreefonts/getfont}"
-
-die () { echo "$1." 1>&2; exit 1; }
-
-OLDIFS=$IFS
-IFS=:
-BINDIRS=`echo $PATH`
-IFS=$OLDIFS
-
-for BINDIR in $BINDIRS; do
- if test "$BINDIR" != "."; then
- for FTP_CLIENT in wget lftp ncftpget curl snarf gftp; do
- test -x $BINDIR/$FTP_CLIENT && FTP=$FTP_CLIENT && break
- done
- fi
-done
-
-test -n "$FTP" || die "No ftp client found"
-
-export FTP
-
-case $0 in
- *-sys) SYS=true; GETFONT=getfont-sys;;
- *) SYS=false; GETFONT=getfont;;
-esac
-export SYS GETFONT
-
-ALL=true
-RUNSHELL=false
-
-ARGS_FROM_GETNONFREEFONTS="$@"
-export ARGS_FROM_GETNONFREEFONTS
-
-for ARG in "$@"; do
- case $ARG in
- -*)
- case $ARG in
- -shell|--shell) RUNSHELL=true;;
- -ftp-client=*|--ftp-client=*)
- FTP=`echo "$ARG" | sed 's/.*=//'`;;
- -url=*|--url=*)
- URL=`echo "$ARG" | sed 's/.*=//'`;;
- -h|-help|--help) ALL=false;;
- esac;;
- *) ALL=false;;
- esac
-done
-
-export URL
-
-tmpdir=${TMPDIR-${TEMP-${TMP-/tmp}}}/getnonfreefonts.$$
-(umask 077; mkdir "${tmpdir}") || die "Can't mkdir ${tmpdir}"
-trap 'rm -rf ${tmpdir}' 0 1 2 3 7 13 15
-
-download () {
- echo "Downloading: $1"
- case ${FTP} in
- wget) wget "$1" || die "$1: Download failed";;
- lftp) lftp -c "get $1" || die "$1: Download failed";;
- ncftpget) ncftpget "$1" || die "$1: Download failed";;
- curl) curl -O "$1" || die "$1: Download failed";;
- snarf) snarf "$1" || die "$1: Download failed";;
- gftp) gftp -d "$1" || die "$1: Download failed";;
- *) die "This can't happen";;
- esac
+my $getfont_url="ftp://tug.org/tex/getnonfreefonts/getfont2006";
+
+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] [-f|--force] [-l|--lsfonts]
+ [-v|--verbose] [font1] [font2] ...
+
+ getnonfreefonts installs fonts in $TEXMFHOME.
+ getnonfreefonts-sys installs fonts in $TEXMFLOCAL.
+
+ Options:
+ -a|--all Install all fonts.
+
+ -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.
+
+EOF
+;
+}
+
+unless (@ARGV) {
+ usage;
+ exit 1;
+}
+
+GetOptions
+ "all|a",
+ "debug|d",
+ "force|f",
+ "help|h",
+ "lsfonts|l",
+ "verbose|v",
+ "sys";
+
+$^W=1 if $opt_debug;
+
+my $sys=($0=~/-sys$/)? 1:0;
+$sys=1 if $opt_sys;
+
+@allpackages=@ARGV;
+
+sub message {
+ my $message=shift;
+ if ($message=~/^\[/) {
+ print "$message\n";
+ } else {
+ printf "%-60s", $message;
+ }
+}
+
+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;
+}
+
+if ($sys) {
+ $INSTALLROOT=expand_var 'TEXMFLOCAL';
+} else {
+ $INSTALLROOT=expand_var 'TEXMFHOME';
+}
+
+# get TMP|TEMP|TMPDIR environment variable
+
+if (defined $ENV{'TMP'}) {
+ $systmp="$ENV{'TMP'}";
+} elsif (defined $ENV{'TEMP'}) {
+ $systmp="$ENV{'TEMP'}";
+} elsif (defined $ENV{'TMPDIR'}) {
+ $systmp="$ENV{'SYSTMP'}";
+} else {
+ $systmp="/tmp";
+}
+
+# Windows usually uses backslashes though forward slashes are probably
+# allowed. Perl always needs forward slashes.
+
+# We convert backslashes to forward slashes if it looks like a Windows
+# directory.
+$systmp=~s/\\/\//g if ($systmp=~/^.:\\/); # c:\abc\def
+$systmp=~s/\\/\//g if ($systmp=~/^\\\\/); # \\abc\def
+
+die "! ERROR: The directory '$systmp' doesn't exist.\n"
+ unless (-d "$systmp");
+
+die "! ERROR: The directory '$systmp' is not writable.\n"
+ unless (-w "$systmp");
+
+$INSTALLROOT=~s/\\/\//g if ($INSTALLROOT=~/^.:\\/); # c:\abc\def
+$INSTALLROOT=~s/\\/\//g if ($INSTALLROOT=~/^\\\\/); # \\abc\def
+
+die "! ERROR: The directory '$INSTALLROOT' is not writable.\n"
+ unless (-w "$INSTALLROOT");
+
+if ($opt_help) {
+ usage;
+ print <<"ENDUSAGE";
+ Directories:
+ temporary: '$systmp/getfont-<PID>'
+ install: '$INSTALLROOT'
+
+ENDUSAGE
+exit 0;
}
-cd "${tmpdir}" || die "Can't cd ${tmpdir}"
-
-echo -------------------------------------------------------
-echo "FTP client: ${FTP}"
-echo "Temporary dir: ${tmpdir}"
-echo "URL: ${URL}"
-echo -------------------------------------------------------
-
-download ${URL}
-
-chmod 700 getfont
-ln -s getfont getfont-sys
-PATH=${tmpdir}:${PATH}
-export PATH
-
-UPDMAP_NEEDED=false
-
-if ${RUNSHELL}; then
- if ${SYS}; then
- PS1='[getfont-sys]\$ '
- else
- PS1='[getfont]\$ '
- fi
- export PS1
- echo -------------------------------------------------------
- echo "FTP client: ${FTP}"
- echo "Temporary dir: ${tmpdir}"
- echo "URL: ${URL}"
- echo "SYS: ${SYS}"
- echo "ARGS: ${ARGS_FROM_GETNONFREEFONTS}"
- echo -------------------------------------------------------
- echo "Run program \"getfont\" or \"getfont-sys\" for each font you want to install."
- echo; echo "Supported fonts are:"
- for f in `getfont --lsfonts`; do
- echo " $f"
- done
- echo; echo "Type \"getfont --help\" for more information."
- echo "Type \"exit\" to leave this shell."; echo
-
-# Start the shell. We start a shell even if someone has
-# SHELL=/sbin/shutdown in his environment.
-
- test -z ${SHELL} || SHELL="/bin/sh"
- case ${SHELL} in
- /bin/bash) /bin/bash;;
- /bin/ksh) /bin/ksh;;
- /bin/ksh) /bin/ksh;;
- *) /bin/sh;;
- esac
-
- echo "Please run \"updmap\" or \"updmap-sys\" now if necessary."
-else # no shell
- if ${ALL} ; then
- for font in `getfont --lsfonts`; do
- ${GETFONT} ${ARGS_FROM_GETNONFREEFONTS} ${font} && UPDMAP_NEEDED=true
- done
- else
- ${GETFONT} ${ARGS_FROM_GETNONFREEFONTS} && UPDMAP_NEEDED=true
- fi
-
- if ${UPDMAP_NEEDED}; then
- if ${SYS}; then
- updmap-sys
- else
- updmap
- fi
- fi
-fi
-
-cd /
-rm -rf "${tmpdir}"
-
-exit 0
+
+my $tmpdir="$systmp/getfont-$$";
+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 for UNIX, maybe ignored by Windows.
+
+$SIG{INT} =\&remove_tmpdir;
+$SIG{QUIT}=\&remove_tmpdir;
+$SIG{BUS} =\&remove_tmpdir;
+$SIG{PIPE}=\&remove_tmpdir;
+$SIG{TERM}=\&remove_tmpdir;
+$SIG{ABRT}=\&remove_tmpdir;
+$SIG{SEGV}=\&remove_tmpdir;
+
+system ('wget', "$getfont_url");
+
+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, '--verbose' if $opt_verbose;
+push @getfont, '--sys' if $sys;
+push @getfont, '--all' if $opt_all;
+push @getfont, @allpackages;
+
+system @getfont;
+my $exit_code=$?;
+my $exit_status=int($exit_code/256);
+
+
+if ($exit_status==2) {
+ print "\n";
+ system 'texhash', "$INSTALLROOT";
+ $updmap_command=($sys)? 'updmap-sys':'updmap';
+ @updmap=("$updmap_command");
+ push @updmap, '--quiet' unless $opt_verbose;
+ message "\nUpdating map files ($updmap_command)...";
+ system @updmap;
+
+ message $?? '[failed]':'[done]';
+}
+
+remove_tmpdir;
+
+__END__
diff --git a/Build/source/texk/texlive/getnonfreefonts-sys.man b/Build/source/texk/texlive/getnonfreefonts-sys.man
new file mode 100644
index 00000000000..b402933bfce
--- /dev/null
+++ b/Build/source/texk/texlive/getnonfreefonts-sys.man
@@ -0,0 +1 @@
+.so man1/getnonfreefonts.1
diff --git a/Build/source/texk/texlive/getnonfreefonts.man b/Build/source/texk/texlive/getnonfreefonts.man
index c7506d616d1..ea039466572 100644
--- a/Build/source/texk/texlive/getnonfreefonts.man
+++ b/Build/source/texk/texlive/getnonfreefonts.man
@@ -1,182 +1,118 @@
-.TH getnonfreefonts 1 "October 2005" "TeXLive" "TeXLive"
+.TH getnonfreefonts 1 "November 2006" "TeXLive" "TeXLive"
.SH NAME
getnonfreefonts \- download and install fonts which cannot be
distributed on a CD
.LP
getnonfreefonts-sys \- download and install fonts system\-wide which
cannot be distributed on a CD
+
.SH SYNOPSIS
-.B getnonfreefonts
-.RI
-[options] [font]
-.LP
-.B getnonfreefonts-sys
-.RI
-[options] [font]
+
+.BI "getnonfreefonts [" options "] [" fontlist ]
+.sp
+.BI "getnonfreefonts-sys [" options "] [" fontlist ]
+
.SH DESCRIPTION
Some font suppliers provided fonts which can be used freely but they
disallow that money is charged for the distribution. Hence, for
distributions on CD or DVD it is usually impossible to include
these fonts.
-.BI getnonfreefonts
+.B "getnonfreefonts"
is a script which downloads and installs these fonts. Actually, it
first downloads the program
-.BI getfont
-from CTAN which is then executed.
-.BI getfont
+.BI "getfont"<year>
+from tug.org which is then executed.
+.BI "getfont"<year>
does the real work. It will be updated occasionally to support more
-fonts.
+fonts.
+.I <year>
+denotes the TeXLive release.
-.BI getnonfreefonts
+.B getnonfreefonts
and
-.BI getnonfreefonts-sys
+.B getnonfreefonts-sys
are identical except that
-.BI getnonfreefonts
-installs files to
-.RI $TEXMFHOME
+.B getnonfreefonts
+installs files to $TEXMFHOME
while
-.BI getnonfreefonts-sys
-installs files to
-.RI $TEXMFLOCAL
-\.
+.B getnonfreefonts-sys
+installs files to $TEXMFLOCAL.
-.BI getfont
+.BI "getfont"<year>
will not be installed permanently on your system. It only
-exists while
-.BI getnonfreefonts
-is running.
+exists in a temporary directory while
.BI getnonfreefonts
-passes all arguments to
-.BI getfont.
+is running.
-If a font is specified, only this font will be installed, otherwise
-all supported fonts will be installed.
-
-To get a list of supported fonts, run
-.BI getnonfreefonts
-.BI --lsfonts
+Run
+.B getnonfreefonts --lsfonts
+to get a list of supported fonts.
.SH OPTIONS
-Only the options evaluated by
-.BI getnonfreefonts
-are described here. Run
-.BI getnonfreefonts
-.BI --help
-to get a complete list.
-
-.TP
-.B --ctan=<CTAN-node>
-.rg
-.B <CTAN-node>
-can be either
-.B
-de
-for ftp://ftp.dante.de (Hamburg, Germany),
-.B
-uk
-for ftp://tex.ac.uk (Cambridge, UK),
-or
-.B us
-for ftp://ctan.tug.org (Colchester, VT, US)
-
-The default is ftp://tex.ac.uk.
.TP
-.B --afm
+.BR "-a" , " --all"
.rg
-Install AFM files as well. They are not installed by default. You do
-not need them if you don't know what they are good for.
+Install all fonts.
.TP
-.B -n, --noinstall
+.BR "-f" , " --force"
.rg
-Do not install anything. Useful to check whether fonts are available
-which are not installed yet.
-
+Install fonts even if they are installed already.
.TP
-.B --shell
+.BR "-h" , " --help"
.rg
-Run
-.BI getnonfreefonts
-in a shell.
-.BI getfont
-can be called directly and will exist on your system until you leave
-the shell. If your internet connection is very slow, you can save some time.
-Run
-.BI getfont --help
-first.
-
+Print a help message. Nothing is installed but the directories where
+the fonts will be installed and the temporary directory are shown.
+.BI "<" PID ">"
+will be replaced by the process ID of the current
+process.
.TP
-.B -h, --help
+.BR "-l" , " --lsfonts"
.rg
-Get a complete list of options. This list will be more complete and
-more up-to-date than this manual page.
+List all available fonts and tell whether they are installed already.
-.SH ENVIRONMENT
-If the environt variable
-.BI CTAN
-is set to
-.B ftp://<CTAN-node>
-then this will be the default. The argument is an URL.
-
-.BI Example:
-If your
-.BI ~/.profile
-contains the line
-.BI CTAN=ftp://ftp.dante.de
-then this will be the default.
-If you are at a university which mirrors CTAN, you can set
-.BI CTAN
-to this mirror. It will work only if the mirror has the same
-directory structure as CTAN, i.e if the directory
-.BI tex-archive
-is not omitted.
-
-.SH EXAMPLES
.TP
-.B getnonfreefonts --help
+.B --sys
.rg
-Display all options and a list of supported fonts. Note that the
-program
-.B getfont
-is installed temporarily and executed. You get more information than
-this manual page can provide.
-
-.TP
+If you call
.B getnonfreefonts
-.rg
-Install all supported fonts which are not installed yet.
-
-.TP
-.B getnonfreefonts utopia
-.rg
-Install Adobe Utopia if it is not installed yet.
-
-.TP
-.B getnonfreefonts --force --afm utopia
-.rg
-Install Adobe Utopia and the corresponding AFM files even if Utopia is
-already installed.
+with the
+.B --sys
+option it behaves exactly like
+.BR "getnonfreefonts-sys".
.TP
-.B getnonfreefonts --noinstall
+.BR "-v" , " --verbose"
.rg
-No fonts will be installed. Instead you are told which fonts are
-available and which of them are already installed.
-
-.TP
-.B getnonfreefonts --shell
-.rg
-No fonts are installed. You'll get an interactive shell where you can
-invoke
-.BI getfont
-manually. Run
-.B getfont --help
-first.
+Be more verbose. This option is only needed for debugging.
+.SH ENVIRONMENT
+One of the environment variables
+.BR "TMP" , " TEMP" ,
+or
+.B TMPDIR
+must exist. They are used to determine where to put the temporary
+files. The directory must exist and must be writable.
+.B /tmp
+will be used if none of the variables is defined.
+
+.SH REQUIREMENTS
+Though this program is supposed to be used with
+.B TeXLive
+it might work with other TeX distributions too. The programs
+.BR "wget" ,
+.BR "unzip" ,
+and
+.B kpsewhich
+have to be installed and a recent version of
+.B updmap
+is required which supports the
+.B --enable
+option.
.SH BUGS
Please send bug reports to Reinhard Kotucha <reinhard.kotucha@web.de>.