summaryrefslogtreecommitdiff
path: root/Master/tlpkg
diff options
context:
space:
mode:
authorReinhard Kotucha <reinhard.kotucha@web.de>2007-11-26 01:05:26 +0000
committerReinhard Kotucha <reinhard.kotucha@web.de>2007-11-26 01:05:26 +0000
commitc1c056a76b96734598543e2cfd7c93a29a44edd0 (patch)
tree80561ef06b55d8ccde6e45c78f632f5f61df0c9c /Master/tlpkg
parent7f77a258eefb648b8ca55e00202850ccd88e45ec (diff)
TLUtils.pm: install_package
install-tl.pl: $installerdir git-svn-id: svn://tug.org/texlive/trunk@5594 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm89
1 files changed, 74 insertions, 15 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 3f243f08ac3..dd65f308b21 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -41,6 +41,7 @@ C<TeXLive::TLUtils> -- Utilities used in the TeX Live Infrastructure Modules
TeXLive::TLUtils::dirname_and_basename($path);
TeXLive::TLUtils::mkdirhier($path);
TeXLive::TLUtils::copy($file, $target_dir);
+ TeXLive::TLUtils::install_package(@list);
=head2 Installer Functions
@@ -65,8 +66,6 @@ C<TeXLive::TLUtils> -- Utilities used in the TeX Live Infrastructure Modules
BEGIN {
use Exporter ();
- use Cwd;
- use File::Path;
use vars qw( @ISA @EXPORT_OK );
@ISA = qw(Exporter);
@EXPORT_OK = qw(
@@ -83,6 +82,7 @@ BEGIN {
&dirname_and_basename
&mkdirhier
&copy
+ &install_package
&media
&initialize_installer
&architectures_available
@@ -139,7 +139,7 @@ sub platform {
# We cannot rely on #! in config.guess but have to call /bin/sh
# explicitly because sometimes the 'noexec' flag is set in
# /etc/fstab for ISO9660 file systems.
- my $guessed_platform=`/bin/sh $::_installerdir_/config.guess`;
+ my $guessed_platform=`/bin/sh $::installerdir/config.guess`;
chomp $guessed_platform;
($CPU=$guessed_platform)=~s/(.*?)-.*/$1/;
foreach my $os (@OSs) {
@@ -470,6 +470,65 @@ sub copy {
=back
+=cut
+
+
+sub install_package {
+# either a list of files or a name of one .zip or .tar.lzma file.
+ my @what=@_;
+
+ my $target="$::vars{'TEXMF'}";
+ my $bindir="$::installerdir/tlpkg/bin";
+ my $platform=&platform;
+ my $buffer;
+ my $offset;
+ my $blocksize=2048;
+
+ if (win32) {
+ my $lzmadec="$bindir/lzma.exe -si -so";
+ my $tar="$bindir/tar.exe -xf - -C";
+ my $wget="$bindir/wget.exe -nv -O-";
+ } else {
+ my $lzmadec="$bindir/lzmadec_$platform";
+ my $tar="/bin/tar -xf - -C";
+ my $wget="wget -nv -O-";
+ }
+
+ if (&media eq 'DVD') {
+ foreach my $file (@what) {
+ copy "$file", "$target";
+ }
+ } elsif (&media eq 'CD') {
+ my $package="$::installerdir/archive/$what[0]";
+ sysopen IN, "$package", O_RDONLY
+ or die "Can't open '$infile': $!\n";
+ binmode IN;
+
+ open OUT, "|$lzmadec|$tar $target";
+ binmode OUT;
+
+ while ($read=sysread IN, $buffer, $blocksize) {
+ die "system read error: $!\n" unless defined $read;
+ $offset=0;
+ while ($read) {
+ $written=syswrite OUT, $buffer, $read, $offset;
+ die "system write error: $!\n" unless defined $written;
+ $read-=$written;
+ $offset+=$written;
+ }
+ }
+ close OUT;
+ close IN;
+ } elsif (&media eq 'NET') {
+ my $package="$::texlive_url/archive/$what[0]";
+ system "$wget $package|$lzmadec|$tar $target";
+ } else {
+ die "This can't happen.";
+ }
+}
+
+=pod
+
=head2 Installer Functions
=over 6
@@ -487,12 +546,12 @@ CD/DVD.
sub media {
unless (defined $::_media_) {
- if (-d "$::_installerdir_/archive") {
- $::_media_="CD";
- } elsif (-d "$::_installerdir_/texmf/web2c") {
- $::_media_="DVD";
+ if (-d "$::installerdir/archive") {
+ $::_media_='CD';
+ } elsif (-d "$::installerdir/texmf/web2c") {
+ $::_media_='DVD';
} else {
- $::_media_="NET";
+ $::_media_='NET';
}
}
return $::_media_;
@@ -515,9 +574,9 @@ again.
=cut
sub initialize_installer {
- my $me=$0;
- $me=~s!\\!/!g if $^O=~/^MSWin(32|64)$/i;
- ($::_installerdir_=$me)=~s!(.*)/.*$!$1!;
+# my $me=$0;
+# $me=~s!\\!/!g if $^O=~/^MSWin(32|64)$/i;
+# ($::installerdir=$me)=~s!(.*)/.*$!$1!;
&media;
&platform;
}
@@ -535,7 +594,7 @@ sub architectures_available {
my @dir;
my @platforms;
if (&media eq "CD") {
- opendir DIR, "$::_installerdir_/archive";
+ opendir DIR, "$::installerdir/archive";
@dir=readdir DIR;
chomp @dir;
for (@dir) {
@@ -544,7 +603,7 @@ sub architectures_available {
}
}
} elsif (&media eq "DVD") {
- opendir DIR, "$::_installerdir_/bin";
+ opendir DIR, "$::installerdir/bin";
@dir=readdir DIR;
chomp @dir;
for my $platform (@dir) {
@@ -564,7 +623,7 @@ sub architectures_available {
The function C<additional_architectures_available_from_net> returns a
list of additional platforms supported by the TeX Live server. It
-downloads the file C<$::texlive_url/texlive.tlpdb> and creates a new
+downloads the file C<$::texlive_db_url/texlive.tlpdb> and creates a new
object c<$::tlpdb_netbin>. The argument is a reference of the global
C<%vars> hash.
@@ -573,7 +632,7 @@ C<%vars> hash.
sub additional_architectures_available_from_net {
my $vars=shift;
my @platforms;
- my $database="$::texlive_url/texlive.pkgver";
+ my $database="$::texlive_db_url/texlive.pkgver";
print "\nLoading '$database' ...\n";
open WGET, "wget -nv --output-document=- $database|";