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/tlpkg/TeXLive/TLWinGoo.pm | |
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/tlpkg/TeXLive/TLWinGoo.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLWinGoo.pm | 70 |
1 files changed, 61 insertions, 9 deletions
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 |