summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLUtils.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-06-28 23:05:44 +0000
committerNorbert Preining <preining@logic.at>2008-06-28 23:05:44 +0000
commit916b4893ed39a39d316a32c96e5c6110b8e84e41 (patch)
treec2e94740939774092347db0b52aeb32471276757 /Master/tlpkg/TeXLive/TLUtils.pm
parent7555dd14aa0972fe77a9613d8f9dbd8f552dd5fd (diff)
restart feature of installer
git-svn-id: svn://tug.org/texlive/trunk@9078 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm69
1 files changed, 54 insertions, 15 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 4b9e18d2863..69f73071552 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -620,7 +620,7 @@ sub install_packages {
} elsif (&media eq 'NET') {
$container = "$TeXLiveURL/$NetArchive/$package.$DefaultContainerExtension";
}
- install_package($container,\@installfiles,$totlpdb->root,$vars{'this_platform'});
+ install_package($container, $tlpobj->containersize,\@installfiles,$totlpdb->root,$vars{'this_platform'});
# if we are installing from CD or NET we have to fetch the respective
# source and doc packages $pkg.source and $pkg.doc and install them, too
if ((&media eq 'NET') || (&media eq 'CD')) {
@@ -633,13 +633,13 @@ sub install_packages {
($package !~ m/\./) && $tlpobj->srcfiles) {
my $srccontainer = $container;
$srccontainer =~ s/(\.tar\.lzma|\.zip)$/.source$1/;
- install_package($srccontainer,\@installfiles,$totlpdb->root,$vars{'this_platform'});
+ install_package($srccontainer, $tlpobj->srccontainersize,\@installfiles,$totlpdb->root,$vars{'this_platform'});
}
if ($container_doc_split && $real_opt_doc &&
($package !~ m/\./) && $tlpobj->docfiles) {
my $doccontainer = $container;
$doccontainer =~ s/(\.tar\.lzma|\.zip)$/.doc$1/;
- install_package($doccontainer,\@installfiles,$totlpdb->root,$vars{'this_platform'});
+ install_package($doccontainer, $tlpobj->doccontainersize, \@installfiles,$totlpdb->root,$vars{'this_platform'});
}
}
# we don't want to have wrong information in the tlpdb, so remove the
@@ -665,11 +665,14 @@ sub install_packages {
=pod
-=item C<install_package($what, $filelistref, $target, $platform)>
+=item C<install_package($what, $size, $filelistref, $target, $platform)>
This function installs the files given in @$filelistref from C<$what>
into C<$target>.
+C<$size> gives the size in bytes of the container, or -1 if we are
+installing from DVD, i.e., from a list of files to be copied.
+
If C<$what> is a reference to a list of files then these files are
assumed to be readable and are copied to C<$target>, creating dirs on
the way. In this case the list C<@$filelistref> is not taken into
@@ -688,7 +691,7 @@ is not taken into account (should be fixed!).
=cut
sub install_package {
- my ($what, $filelistref, $target, $platform) = @_;
+ my ($what, $whatsize, $filelistref, $target, $platform) = @_;
my @filelist = @$filelistref;
@@ -729,16 +732,40 @@ sub install_package {
$lzmafile_quote = "\"$lzmafile\"";
$tarfile_quote = "\"$tarfile\"";
$target_quote = "\"$target\"";
- if ($what =~ m,http://|ftp://,) {
- # we are installing from the NET
- # download the file and put it into temp
- if (!download_file($what, $lzmafile) || (! -r $lzmafile)) {
- die "Downloading $what did not succeed, please retry!";
+ my $gotfiledone = 0;
+ if (-r $lzmafile) {
+ # check that the downloaded file is not partial
+ my $size = (stat $lzmafile)[7];
+ if ($size == $whatsize) {
+ debug("Reusing already downloaded container $lzmafile\n");
+ $gotfiledone = 1;
+ } else {
+ tlwarn("Partial download of $what found, removing it!\n");
+ unlink($tarfile, $lzmafile);
+ }
+ }
+ if (!$gotfiledone) {
+ if ($what =~ m,http://|ftp://,) {
+ # we are installing from the NET
+ # download the file and put it into temp
+ if (!download_file($what, $lzmafile) || (! -r $lzmafile)) {
+ &main::create_profile("./installation.profile");
+ tlwarn("Downloading $what did not succeed!\n");
+ tlwarn("Please retry the install process.\n");
+ tlwarn("Starting the installer will try to restart the installation!\n");
+ tlwarn("If that doesn't work you can restart by running the installer with\n");
+ if (win32()) {
+ tlwarn(" install-tl.bat --profile texlive.profile [other args]\n");
+ } else {
+ tlwarn(" install-tl --profile texlive.profile [other args]\n");
+ }
+ die "Downloading $what did not succeed!\n";
+ }
+ } else {
+ # we are installing from CD
+ # copy it to temp
+ copy($what, "$target/temp");
}
- } else {
- # we are installing from CD
- # copy it to temp
- copy($what, "$target/temp");
}
debug("Un-lzmaing $lzmafile to $tarfile\n");
system("$lzmadec < $lzmafile_quote > $tarfile_quote");
@@ -747,7 +774,9 @@ sub install_package {
}
debug("Unpacking $tarfile\n");
system($tar,"-x","-C",$target,"-f",$tarfile);
- unlink($tarfile, $lzmafile);
+ unlink($tarfile);
+ debug("Keeping $lzmafile for restarting ...\n");
+ # unlink($lzmafile);
} else {
die "Don't know how to install $what!\n";
}
@@ -1391,6 +1420,16 @@ sub conv_to_win_path {
return($p);
}
+
+sub give_ctan_mirror {
+ my $originalurl = "http://mirror.ctan.org";
+ my $wget = $::progs{'wget'};
+ if (!defined($wget)) {
+ tlwarn("programs not set up, trying wget\n");
+ }
+
+
+}
#############################################
#
# Taken from Text::ParseWords