diff options
author | Siep Kroonenberg <siepo@cybercomm.nl> | 2008-04-19 11:09:05 +0000 |
---|---|---|
committer | Siep Kroonenberg <siepo@cybercomm.nl> | 2008-04-19 11:09:05 +0000 |
commit | 6436b7491107c65c9d97992c1dd988cd3d142467 (patch) | |
tree | cac85fbced8c7e1533f9d7e95f701b1093c11528 /Master | |
parent | 00317d26788c36e16f835c3cfb51a8765bcb70e3 (diff) |
Win32 uninstall via add/remove programs now mostly works.
git-svn-id: svn://tug.org/texlive/trunk@7516 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/install-tl | 6 | ||||
-rwxr-xr-x | Master/install-tl.bat | 2 | ||||
-rwxr-xr-x | Master/texmf/scripts/texlive/uninstall-tl.pl | 1 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLWinGoo.pm | 70 |
4 files changed, 66 insertions, 13 deletions
diff --git a/Master/install-tl b/Master/install-tl index 83973e7d867..c977ba387d8 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -43,7 +43,7 @@ BEGIN { } use TeXLive::TLUtils qw(initialize_installer media platform platform_desc - which getenv win32 unix program_exists + which getenv win32 unix program_exists get_system_tmpdir member mkdirhier make_var_skeleton make_local_skeleton install_package copy install_packages dirname tllog setup_programs); @@ -75,7 +75,7 @@ if (win32) { &unregister_script_type &broadcast_env &update_assocs - ®ister_uninstaller + &create_uninstaller )); } use Getopt::Long; @@ -422,6 +422,7 @@ sub do_installation { do_install_packages(); if (win32()) { do_win_registry_magic(); + create_uninstaller($vars{'TEXDIR'}); } foreach my $h (@::start_postinst_hook) { &$h(); @@ -1034,7 +1035,6 @@ sub do_win_registry_magic { register_script_type(".texlua", "%TEXBINDIR%/texlua.exe"); broadcast_env(); update_assocs(); - register_uninstaller("$vars{'TEXDIR'}") unless $opt_portable; } # diff --git a/Master/install-tl.bat b/Master/install-tl.bat index cec4dfe80af..70be6c0aab2 100755 --- a/Master/install-tl.bat +++ b/Master/install-tl.bat @@ -18,7 +18,7 @@ set PERL5SAVE=%PERL5LIB% set PERL5LIB=%tlroot%tlpkg\installer\perllib
rem "%tlroot%tlpkg\installer\perl" "%tlroot%install-tl.pl" %*
-"%tlroot%tlpkg\installer\perl" "%~dpn0.pl" %*
+"%tlroot%tlpkg\installer\perl" "%~dpn0" %*
rem pause Done
rem cleanup in case of start from command-line
diff --git a/Master/texmf/scripts/texlive/uninstall-tl.pl b/Master/texmf/scripts/texlive/uninstall-tl.pl index dc45c567607..d70a0b824fd 100755 --- a/Master/texmf/scripts/texlive/uninstall-tl.pl +++ b/Master/texmf/scripts/texlive/uninstall-tl.pl @@ -60,6 +60,7 @@ sub main remove_texbindirs_from_path(); unsetenv_reg("TEXBINDIR"); unregister_script_type(".texlua"); + unregister_uninstaller(); broadcast_env(); update_assocs(); } else { diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm index 01b23d3fac8..b7fe88f0831 100644 --- a/Master/tlpkg/TeXLive/TLWinGoo.pm +++ b/Master/tlpkg/TeXLive/TLWinGoo.pm @@ -47,7 +47,8 @@ C<TeXLive::TLWinGoo> -- Additional utilities for Windows TeXLive::TLWinGoo::remove_texbindirs_from_path; TeXLive::TLWinGoo::register_script_type($extension, $command); TeXLive::TLWinGoo::unregister_script_type($extension); - TeXLive::TLWinGoo::register_uninstaller; + TeXLive::TLWinGoo::create_uninstaller; + TeXLive::TLWinGoo::unregister_uninstaller; =head2 ACTIVATING CHANGES IMMEDIATELY @@ -86,7 +87,8 @@ BEGIN { &unregister_script_type &broadcast_env &update_assocs - ®ister_uninstaller + &create_uninstaller + &unregister_uninstaller ); # for testing also: @EXPORT_OK = qw( @@ -605,6 +607,7 @@ sub reg_delete_recurse { tllog ($::LOG_DDDEBUG, "Deleting $childname regkey\n"); if ($childname !~ '^/') { # subkey my $child = $parent->Open ($childname, {Access => KEY_ALL_ACCESS()}); + return unless $child; foreach my $v (keys %$child) { if ($v =~ '^/') { # value delete $child->{$v}; @@ -834,25 +837,74 @@ sub update_assocs() { =pod -=item C<register_uninstaller> +=item C<create_uninstaller> Writes registry entries for add/remove programs which reference -the uninstaller script. +the uninstaller script and creates uninstaller batchfiles to finish +the job. =cut -sub register_uninstaller { - my $td = shift; +sub create_uninstaller { + my $tdfw = shift; + my $td = $tdfw; + $td =~ s!/!\\!g; + my $uninst_key = $Registry -> Open((admin() ? "LMachine" : "CUser") . "/software/microsoft/windows/currentversion/uninstall/", {Access => KEY_ALL_ACCESS()}); my $k = $uninst_key->CreateKey("TeXLive/"); - $td =~ s!/!\\!g; $k->{"/DisplayName"} = "TeXLive ".$::texlive_release; - $k->{"/UninstallString"} = - "\"$td\\texmf\\scripts\\texlive\\tlmgr\" uninstall & del /q /s \"$td*.*\""; + $k->{"/UninstallString"} = "\"$td\\tlpkg\\installer\\uninst.bat\""; $k->{'/DisplayVersion'} = $::texlive_release; $k->{'/URLInfoAbout'} = "http://www.tug.org/texlive"; + + open UNINST, ">$tdfw/tlpkg/installer/uninst.bat"; + print UNINST <<UNEND; +set PERL5LIB= +\"$td\\tlpkg\\tlperl\\bin\\perl.exe\" \"$td\\texmf\\scripts\\texlive\\uninstall-tl.pl\" +copy \"$td\\tlpkg\\installer\\uninst2.bat\" \"\%TEMP\%\" +\"\%TEMP\%\\uninst2.bat\" +UNEND +close UNEND; + + open UNINST2, ">$tdfw/tlpkg/installer/uninst2.bat"; + print UNINST2 <<UNEND2; +rmdir /s /q \"$td\\texmf-dist\" +rmdir /s /q \"$td\\texmf-doc\" +rmdir /s /q \"$td\\texmf-var\" +rmdir /s /q \"$td\\texmf-config\" +rmdir /s /q \"$td\\texmf\" +rmdir /s /q \"$td\\tlpkg\" +rmdir /s /q \"$td\\temp\" +rmdir /s /q \"$td\\bin\" +del \"$td\\install-tl.log\" +del %0 +UNEND2 + close UNINST2; +} + +=pod + +=item C<unregister_uninstaller> + +Removes TeXLive from Add/Remove Programs. + +=cut + +sub unregister_uninstaller { + my $regkey_uninst; + print "trying HKCU uninstaller entry\n"; + $regkey_uninst = $Registry->Open( + "CUser/software/microsoft/windows/uninstall/", + {Access => KEY_ALL_ACCESS()}); + reg_delete_recurse($regkey_uninst, 'texlive') if $regkey_uninst; + return unless admin(); + print "trying HKLM uninstaller entry\n"; + $regkey_uninst = $Registry->Open( + "LMachine/software/microsoft/windows/uninstall/", + {Access => KEY_ALL_ACCESS()}); + reg_delete_recurse($regkey_uninst, 'texlive') if $regkey_uninst; } =pod |