summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2007-12-22 16:56:19 +0000
committerNorbert Preining <preining@logic.at>2007-12-22 16:56:19 +0000
commit918ec92295d993a2af7b63146e310007ea7b81de (patch)
treed9c018d19f0218e1fae6cde9a70a34f9941398d0 /Master
parentf92b5eabf87e68788e488c0899cac799671f77ce (diff)
temp files for windows
git-svn-id: svn://tug.org/texlive/trunk@5823 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm73
1 files changed, 40 insertions, 33 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index b5fb6ab1827..52b8443b64c 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -570,6 +570,11 @@ is not taken into account (should be fixed!).
=cut
sub install_package {
+ sub mysystem {
+ my $cmd = shift;
+ print "DEBUG: $cmd\n";
+ system("$cmd");
+ }
my ($what, $filelistref, $target, $platform) = @_;
my $buffer;
my $offset;
@@ -581,21 +586,21 @@ sub install_package {
my $bindir = "$::installerdir/tlpkg/bin";
my $lzmadec="$bindir/lzmadec.$::_platform_";
- my $tar="/bin/tar -xf - -C";
- my $wget="wget -nv -O-";
- if (win32) {
- $lzmadec="$bindir/lzma.exe d -si -so"; $lzmadec =~ s!/!\\!g;
- $tar="$bindir/tar.exe -xf - -C"; $tar =~ s!/!\\!g;
- $wget="$bindir/wget.exe -nv -O-"; $wget =~ s!/!\\!g;
- # make sure that the target has backslashes
+ if (win32()) {
+ # we need absolute paths for win32
+ my $cwd = `cd`;
+ chomp($cwd);
+ if ($bindir !~ m!^.:!) {
+ $bindir =~ s!/!\\!g;
+ $bindir = "$cwd\\$bindir";
+ }
$target =~ s!/!\\!g;
- $what =~ s!/!\\!g;
}
-
if (ref $what) {
# we are getting a ref to a list of files, so install from DVD
foreach my $file (@$what) {
# @what is taken, not @filelist!
+ # is this still needed?
my $dn=dirname($file);
mkdirhier("$target/$dn");
copy "$file", "$target/$dn";
@@ -603,31 +608,33 @@ sub install_package {
} elsif ($what =~ m,http://|ftp://,) {
# we are installing from the NET
# currently the list of file @filelist is NOT EVALUATED!!!
- system "$wget $what|$lzmadec|$tar $target";
+ if (win32()) {
+ # we need temporary files here
+ # tmpdir is $target/temp
+ my $fn = basename($what);
+ my $tarfile = $fn;
+ $tarfile =~ s/\.lzma$//;
+ mkdirhier("$target/temp");
+ mysystem("$bindir\\wget.exe -nv -O $target\\temp\\$fn $what");
+ mysystem("$bindir\\lzma.exe d $target\\temp\\$fn $target\\temp\\$tarfile");
+ mysystem("pushd $target & $bindir\\bsdtar.exe -xvf temp\\$tarfile");
+ unlink("$target\\temp\\$tarfile");
+ unlink("$target\\temp\\$fn");
+ } else {
+ system "wget $what|$lzmadec|tar -xf - -C $target";
+ }
} elsif ($what =~ m,\.tar.lzma$,) {
- # we are installing from CD, currently only tar.lzma supported
- # currently the list of file @filelist is NOT EVALUATED!!!
- open IN, "$what", or warn "Can't open '$what': $!\n"
- or die "Can't open '$what': $!\n";
- binmode IN;
-
- print "DEBUG: opening IN $what\n";
- print "DEBUG: opening OUT $lzmadec|$tar $target\n";
- 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;
+ if (win32()) {
+ my $fn = basename($what);
+ my $tarfile = $fn;
+ $tarfile =~ s/\.lzma$//;
+ mkdirhier("$target/temp");
+ mysystem("$bindir\\lzma.exe d $what $target\\temp\\$tarfile");
+ mysystem("pushd $target & $bindir\\bsdtar.exe -xvf temp\\$tarfile");
+ unlink("$target\\temp\\$tarfile");
+ } else {
+ system "cat $what|$lzmadec|/bin/tar -xf - -C $target";
+ }
} else {
die "Don't know how to install $what!\n";
}