summaryrefslogtreecommitdiff
path: root/Master
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
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')
-rwxr-xr-xMaster/install-tl.pl18
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm89
2 files changed, 84 insertions, 23 deletions
diff --git a/Master/install-tl.pl b/Master/install-tl.pl
index c326702a6ef..661f334835b 100755
--- a/Master/install-tl.pl
+++ b/Master/install-tl.pl
@@ -13,14 +13,14 @@ BEGIN {
$^W = 1;
my $me=$0;
$me=~s!\\!/!g if $^O=~/^MSWin(32|64)$/i;
- ($thisdir=$me)=~s!(.*)/.*$!$1!;
- unshift (@INC, "$thisdir/tlpkg");
+ ($installerdir=$me)=~s!(.*)/.*$!$1!;
+ unshift (@INC, "$installerdir/tlpkg");
}
use TeXLive::TLUtils qw(initialize_installer media platform platform_desc
debug which getenv win32 unix program_exists architectures_available
additional_architectures_available_from_net get_system_tmpdir member
- mkdirhier make_var_skeleton make_local_skeleton);
+ mkdirhier make_var_skeleton make_local_skeleton install_package);
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
use TeXLive::TLConfig;
@@ -29,20 +29,22 @@ use Cwd;
$default_scheme='scheme-full';
###$texlive_url='http://localhost/texlive/Contents/inst';
-$texlive_url='http://tug.org/svn/texlive/trunk/Master/'
- . "$TeXLive::TLConfig::InfraLocation";
+$texlive_url='http://tug.org/svn/texlive/trunk/Master';
+$texlive_db_url="$texlive_url/$TeXLive::TLConfig::InfraLocation";
# The maximum number of binary systems on the CD. This number must be
# smaller than the number of binaries available from the network.
$max_bins_on_CD=7;
-initialize_installer;
my $system_tmpdir=get_system_tmpdir;
print "Platform: ", platform, " => \'", platform_desc(platform), "\'\n";
print "Media: ", media, "\n";
print "Directory for Temporary Files: '", get_system_tmpdir, "\'\n";
+print "Installer Directory: '$::installerdir'\n";
+
+initialize_installer;
# The global variable %vars is an associative list which contains all
# variables and their values which can be changed by the user.
@@ -315,7 +317,7 @@ sub load_tlpdb {
if (media eq 'NET') {
$database="http://www.tug.org/svn/texlive/trunk/Master/$TeXLive::TLConfig::InfraLocation/texlive.tlpdb";
} else {
- $database="./$TeXLive::TLConfig::InfraLocation/texlive.tlpdb";
+ $database="$installerdir/$TeXLive::TLConfig::InfraLocation/texlive.tlpdb";
}
print "Loading $database ...\n";
$::tlpdb=TeXLive::TLPDB->new(location => "$database");
@@ -1089,7 +1091,7 @@ sub install_files {
}
}
my $destination="$vars{TEXDIR}";
- foreach my $p (keys %install) {
+ foreach my $p (sort keys %install) {
print "INSTALL $p\n" if ($install{$p} == 1);
my $containerdir=container_location($p);
add_tlpcontainer($p, $containerdir, $destination);
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|";