summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-06-18 23:13:16 +0000
committerNorbert Preining <preining@logic.at>2008-06-18 23:13:16 +0000
commitabad59d09ceb90d23307833a36223f61ca5400b4 (patch)
tree7e314a870e80fcbdb9a309b310b42640640df71e /Master
parent265aeea9b25c71222c89fc8d4d19cb0b53e78a5b (diff)
tlmgr.pl: try to work around win32 stupidity and create updater.bat
git-svn-id: svn://tug.org/texlive/trunk@8854 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl78
1 files changed, 68 insertions, 10 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 6a5f8177548..6f695f17e90 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -595,14 +595,9 @@ sub action_update {
if (!@todo) {
printf "tlmgr update takes either a list of packages or --all\n";
}
+ my $updater_started = 0;
foreach my $pkg (@todo) {
next if ($pkg =~ m/^00texlive/);
- # it looks like that can actually be done!!!
- # It gives several warnings but afterwards the files are changed. Strange
- #if (win32() && (($pkg eq "texlive.infra") || ($pkg eq "bin-texlive"))) {
- # info("We cannot upgrade $pkg on win32, since we are running it!\n");
- # next;
- #}
my $tlp = $localtlpdb->get_package($pkg);
if (!defined($tlp)) {
printf STDERR "Strange, $pkg cannot be found!\n";
@@ -634,16 +629,79 @@ sub action_update {
$opt_backupdir, "${pkg}.r" . $tlp->revision);
}
}
- print "update: $pkg (first remove old, then install new)\n";
- merge_into(\%ret, &remove_package($pkg, $localtlpdb, 1));
- merge_into(\%ret, $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 0));
- print "update: $pkg done\n";
+
+ if (win32() && (($pkg =~ m/^texlive\.infra/) ||
+ ($pkg =~ m/^luatex/) ||
+ ($pkg =~ m/^bin-tlperl\.win32$/) ||
+ ($pkg =~ m/^bin-texlive/))) {
+ if (!$updater_started) {
+ open UPDATER, ">" . $localtlpdb->root . "/tlpkg/installer/updater.bat"
+ or die "Cannot create updater.bat: $!";
+ print UPDATER <<'EOF';
+rem update program, can savely removed after it has been done
+set tlupdate=%~dp0
+set tldrive=%~d0
+
+%tldrive%
+cd %tlupdate%
+rem now we are in .../tlpkg/installer
+rem create tar.exe backup
+copy tar.exe tarsave.exe
+cd ..
+cd ..
+rem now we are in the root
+
+EOF
+;
+ $updater_started = 1;
+ }
+ # these packages cannot be upgrade on win32
+ # so we have to create a update program
+ my $media = $tlmediasrc->media;
+ my $remoteroot = $mediatlpdb->root;
+ my $root = $localtlpdb->root;
+ my $temp = "$root/temp";
+ TeXLive::TLUtils::mkdirhier($temp);
+ if ($media eq 'DVD') {
+ tlwarn ("Creating updater from DVD currently not implemented!\n");
+ } else {
+ if ($media eq 'CD') {
+ copy("$remoteroot/$DiskArchive/$pkg.tar.lzma", "$temp");
+ } else { # net
+ TeXLive::TLUtils::download_file("$remoteroot/$NetArchive/$pkg.tar.lzma", "$temp/$pkg.tar.lzma");
+ }
+ # now we should have the file present
+ if (! -r "$temp/$pkg.tar.lzma") {
+ tlwarn ("Couldn't get $pkg.tar.lzma, that is bad\n");
+ } else {
+ # add lines to the un-archiver
+ print UPDATER <<EOF;
+tlpkg\\installer\\lzma\\lzmadec.win32.exe < temp\\$pkg.tar.lzma > temp\\$pkg.tar
+tlpkg\\installer\\tarsave.exe -x -f temp\\$pkg.tar
+tlmgr include_tlpobj tlpobj\\$pkg.tlpobj
+EOF
+;
+ }
+ }
+ } else {
+ print "update: $pkg (first remove old, then install new)\n";
+ merge_into(\%ret, &remove_package($pkg, $localtlpdb, 1));
+ merge_into(\%ret, $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 0));
+ print "update: $pkg done\n";
+ }
}
} elsif ($rev > $mediarev) {
print "$pkg: revision in $location is less then local revision, not updating!\n";
next;
}
}
+ if ($updater_started) {
+ print UPDATER "del tlpkg\\installer\\tarsave.exe\n";
+ print UPDATER "del /s /q temp\n";
+ print UPDATER "rmdir temp\n";
+ close (UPDATER);
+ tlwarn("UPDATER has been created, please execute tlpkg\\installer\\updater.bat\n");
+ }
return(\%ret);
}