diff options
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 |