From 265aeea9b25c71222c89fc8d4d19cb0b53e78a5b Mon Sep 17 00:00:00 2001 From: Reinhard Kotucha Date: Wed, 18 Jun 2008 21:21:35 +0000 Subject: getnonfreefonts: Try curl if wget is not installed on Unix systems. git-svn-id: svn://tug.org/texlive/trunk@8853 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/texlive/getnonfreefonts.man | 6 ++-- .../texk/texlive/linked_scripts/getnonfreefonts.pl | 36 ++++++++++++++++++++-- 2 files changed, 37 insertions(+), 5 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/texlive/getnonfreefonts.man b/Build/source/texk/texlive/getnonfreefonts.man index b15235f8524..655d9a71584 100644 --- a/Build/source/texk/texlive/getnonfreefonts.man +++ b/Build/source/texk/texlive/getnonfreefonts.man @@ -113,9 +113,11 @@ will be used if none of the variables is defined. .SH REQUIREMENTS Though this program is supposed to be used with -.B TeXLive +.B TeX Live it might work with other TeX distributions too. The programs -.BR "wget" , +.BR "wget" +or +.BR "curl" , .BR "unzip" , and .B kpsewhich diff --git a/Build/source/texk/texlive/linked_scripts/getnonfreefonts.pl b/Build/source/texk/texlive/linked_scripts/getnonfreefonts.pl index aeb53aab337..457ce1e25a6 100755 --- a/Build/source/texk/texlive/linked_scripts/getnonfreefonts.pl +++ b/Build/source/texk/texlive/linked_scripts/getnonfreefonts.pl @@ -97,6 +97,19 @@ sub debug_msg { } } +sub which { + my $prog=shift; + my @PATH; + my $PATH=$ENV{'PATH'}; + @PATH=split ':', $PATH; + for my $dir (@PATH) { + if (-x "$dir/$prog") { + return "$dir/$prog"; + } + } + return 0; +} + sub expand_var { my $var=shift; @@ -248,7 +261,7 @@ if ($^O=~/^MSWin(32|64)$/i) { @signals=(@common_signals, @signals_UNIX); } -debug_msg "Supported signals: @signals\n"; +debug_msg "Supported signals: @signals"; foreach my $signal (@signals) { $SIG{"$signal"}=\&remove_tmpdir; @@ -256,9 +269,25 @@ foreach my $signal (@signals) { # Download the script from tug.org. -debug_msg "Running 'wget $getfont_url'"; +my $has_wget=0; + +if ($^O=~/^MSWin(32|64)$/i) { + $has_wget=1; ## shipped with TL. +} elsif (which "wget") { + $has_wget=1; +} + +debug_msg "No wget binary found on your system, trying curl" unless ($has_wget); -system ('wget', "$getfont_url") == 0 or die "! Error: Can't execute wget.\n"; +if ($has_wget) { + debug_msg "Running 'wget $getfont_url'"; + system ('wget', "$getfont_url") == 0 + or die "! Error: Can't execute wget.\n"; +} else { + debug_msg "Running 'curl -O $getfont_url'"; + system ('curl', '-O', "$getfont_url") == 0 + or die "! Error: Can't execute curl.\n"; +} # Download the fonts. @@ -270,6 +299,7 @@ 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, '--use_curl' unless ($has_wget); push @getfont, @allpackages; debug_msg "Running '@getfont'"; -- cgit v1.2.3