From 5479fe2b1b2a3c99963f808a8ac30b7cb68d1cdc Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 19 Jan 2009 11:59:04 +0000 Subject: include Tomeks rework on tlmgr2 auto-update if available. Needs rewording of some messages ... git-svn-id: svn://tug.org/texlive/trunk@11914 c570f23f-e606-0410-a88d-b1316a301751 --- Master/bin/win32/tlmgr2.bat | 27 +++++++++ Master/texmf/scripts/texlive/tlmgr2.pl | 93 ++++++++++++------------------- Master/tlpkg/tlpsrc/00texlive.core.tlpsrc | 1 + 3 files changed, 64 insertions(+), 57 deletions(-) create mode 100755 Master/bin/win32/tlmgr2.bat (limited to 'Master') diff --git a/Master/bin/win32/tlmgr2.bat b/Master/bin/win32/tlmgr2.bat new file mode 100755 index 00000000000..2d112e3f110 --- /dev/null +++ b/Master/bin/win32/tlmgr2.bat @@ -0,0 +1,27 @@ +@echo off +rem Advanced started for tlmgr2 with auto-update +rem Copyright 2009 by Tomek ????? +rem Public Domain +rem + +setlocal + +for %%P in ("%~dp0..\..") do set "TLdir=%%~fP" +set PERL5LIB=%TLdir%\tlpkg\tlperl\lib +path %TLdir%\tlpkg\installer;%path% + +rem Start tlmgr +"%TLdir%\tlpkg\tlperl\bin\perl.exe" "%TLdir%\texmf\scripts\texlive\tlmgr2.pl" %* + +set "updater=%TLdir%\tlpkg\installer\updater.bat" +if not exist "%updater%" exit /b +if exist "%updater%.bat" del "%updater%.bat" +ren "%updater%" updater.bat.bat +if errorlevel 1 exit /b %errorlevel% + +rem Run updater script +echo Performing an update. Do not close this window. +rem Check for updater script +rem unset echo off so that we see what is going on with updater.bat +@echo on +endlocal & call "%updater%.bat" & exit /b diff --git a/Master/texmf/scripts/texlive/tlmgr2.pl b/Master/texmf/scripts/texlive/tlmgr2.pl index 2f55531f745..a7f15673ec3 100755 --- a/Master/texmf/scripts/texlive/tlmgr2.pl +++ b/Master/texmf/scripts/texlive/tlmgr2.pl @@ -1112,54 +1112,39 @@ sub action_backup { return(\%ret); } -sub open_w32_updater { - my $root = shift; - open UPDATER, ">" . $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 = \*UPDATER; -} $::updater_started = 0; # -sub add_w32_updater { +sub grow_w32_updater { my ($tlp, $dry) = @_; - sub do_one { - my $pkg = shift; - print $::UPDATER < temp\\$pkg.tar -tlpkg\\installer\\tarsave.exe -x -f temp\\$pkg.tar -call tlmgr _include_tlpobj tlpkg\\tlpobj\\$pkg.tlpobj -del temp\\$pkg.tar.lzma -del temp\\$pkg.tar -EOF -; - } - my $pkg = $tlp->name; # that could be more intelligent for decent $dry output my $root = $localtlpdb->root; my $temp = "$root/temp"; return if $dry; if (!$::updater_started) { - open_w32_updater($root); $::updater_started = 1; + $::updater_string = <<'EOF'; +rem update program, can savely removed after it has been done + +cd /d %~dp0 +rem now we are in .../tlpkg/installer +rem create tar.exe backup +copy tar.exe tarsave.exe +cd ..\.. +rem now we are in the root +EOF +; + } + sub do_one {# moved down to 'preserve' the flow of the batch script upon reading + my $pkg = shift; + $::updater_string .= " +tlpkg\\installer\\lzma\\lzmadec.win32.exe < temp\\$pkg.tar.lzma > temp\\$pkg.tar +tlpkg\\installer\\tarsave.exe -x -f temp\\$pkg.tar +call tlmgr _include_tlpobj tlpkg\\tlpobj\\$pkg.tlpobj +del temp\\$pkg.tar.lzma temp\\$pkg.tar +"; } # these packages cannot be upgrade on w32 # so we have to create a update program @@ -1223,26 +1208,20 @@ EOF } } -sub close_w32_updater { +sub write_w32_updater { if ($::updater_started) { - my $desktop_path = TeXLive::TLWinGoo::desktop_path(); - $desktop_path =~ s!/!\\!g; - print $::UPDATER "del tlpkg\\installer\\tarsave.exe\n"; - print $::UPDATER "pause\n"; - print $::UPDATER "del \"$desktop_path\\TeX Live Updater Final Step.lnk\"\n"; - print $::UPDATER "rem del /s /q temp\n"; - print $::UPDATER "del \"\%~f0\""; - close ($::UPDATER); - # create a desktop shortcut - add_desktop_shortcut( - $localtlpdb->root, - 'TeX Live Updater Final Step', - '', # the icon - $localtlpdb->root.'/tlpkg/installer/updater.bat', - '', # no args - '', # any non-null value to hide command-prompt - ); - tlwarn("UPDATER has been created, please execute\n"); + $::updater_string .= <<'EOF'; + +del tlpkg\installer\tarsave.exe +rmdir temp +EOF +; + open UPDATER, ">" . $localtlpdb->root . "/tlpkg/installer/updater.bat" + or die "Cannot create updater.bat: $!"; + # print STDOUT $::updater_string; + print UPDATER $::updater_string; + close UPDATER; + tlwarn("UPDATER script has been created:\n"); tlwarn(" " . $localtlpdb->root . "\\tlpkg\\installer\\updater.bat\n"); } } @@ -1657,7 +1636,7 @@ sub action_update { } if (win32() && ($pkg =~ m/$WinSpecialUpdatePackagesRegexp/)) { - add_w32_updater($mediatlp, $opts{"dry-run"}); + grow_w32_updater($mediatlp, $opts{"dry-run"}); } else { if ($::machinereadable) { machine_line($pkg, $FLAG_UPDATE, $rev, $mediarev, $sizes{$pkg}); @@ -1742,7 +1721,7 @@ sub action_update { } # that already checks whether we actually have to do something - close_w32_updater(); + write_w32_updater(); if (($nrupdated == 0) && ($tlmediasrc->media ne "NET") && $opts{"all"}) { # for all but net updates we warn if nothing is updated tlwarn("\nNothing to update.\n"); diff --git a/Master/tlpkg/tlpsrc/00texlive.core.tlpsrc b/Master/tlpkg/tlpsrc/00texlive.core.tlpsrc index 2d62203e449..3f6d2bd090f 100644 --- a/Master/tlpkg/tlpsrc/00texlive.core.tlpsrc +++ b/Master/tlpkg/tlpsrc/00texlive.core.tlpsrc @@ -20,4 +20,5 @@ runpattern f texmf/scripts/texlive/tlmgr2.pl runpattern f texmf/scripts/texlive/tlmgrgui/gui-arch2.pl runpattern f texmf/scripts/texlive/tlmgrgui/gui-config2.pl runpattern f texmf/scripts/texlive/tlmgrgui/tlmgrgui2.pl +runpattern f bin/win32/tlmgr2.bat runpattern f tl-portable* -- cgit v1.2.3