diff options
author | Norbert Preining <preining@logic.at> | 2008-01-25 08:21:08 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-01-25 08:21:08 +0000 |
commit | 650b11f5acd44843d1a82b6ecaf1ecd076932dbf (patch) | |
tree | a407aa7a220bad562b3003efa8c7266a6a90e8af | |
parent | aa5250b35700f243e9bdd7f8adee134c3d105838 (diff) |
first work on a uninstaller ... nothing tested, use at your own risk
git-svn-id: svn://tug.org/texlive/trunk@6400 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/tlpkg/TeXLive/TLWinGoo.pm | 41 | ||||
-rwxr-xr-x | Master/tlpkg/bin/uninstall-tl.bat | 24 | ||||
-rwxr-xr-x | Master/tlpkg/bin/uninstall-tl.pl | 70 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/texlive-infra.tlpsrc | 1 |
4 files changed, 136 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm index e72896a8bf9..06a806a502c 100644 --- a/Master/tlpkg/TeXLive/TLWinGoo.pm +++ b/Master/tlpkg/TeXLive/TLWinGoo.pm @@ -32,6 +32,7 @@ C<TeXLive::TLWinGoo> -- Additional utilities for Windows TeXLive::TLWinGoo::get_user_path; TeXLive::TLWinGoo::add_texbindir_to_path($texpath); TeXLive::TLWinGoo::register_script_type($extension, $command); + TeXLive::TLWinGoo::unregister_script_type($extension); TeXLive::TLWinGoo::broadcast_env; All exported functions return forward slashes. @@ -57,6 +58,7 @@ BEGIN { &get_user_path &add_texbindir_to_path ®ister_script_type + &unregister_script_type &broadcast_env ); @@ -425,6 +427,45 @@ sub register_script_type { =pod +=item C<unregister_script_type> + +Reversal of register_script_type. + +=cut + +sub unregister_script_type { + my $extension = shift; + $extension = '.'.$extension unless $extension =~ /^\./; # ensure leading dot + $extension = uc($extension); + + # pathext + my $pathext = get_user_env() -> {'/PATHEXT'}; + $pathext = get_system_env() -> {'/PATHEXT'} if not $pathext; + my @newpe; + foreach my $e (split(/;/,$pathext)) { + push @newpe, $e unless (uc($e) eq $extension); + } + my $newpe = join(";",@newpe); + if ($is_admin) { + (get_system_env() -> {"/PATHEXT"}) = $newpe; + } else { + (get_user_env() -> {"/PATHEXT"}) = $newpe; + } + + # file type + $extension = lc($extension); + my $classes_key = $Registry -> Open( + ($is_admin ? "LMachine/Software/Classes/" : "CUser/Software/Classes/"), + {Access => KEY_ALL_ACCESS()}) or die "Cannot open classpath"; + delete $classes_key{$extension}; + delete $classes_key{"script$extension"}; + # $classes_key->CreateKey($extension)->SetValue("","script".$extension); + # $classes_key->CreateKey("script".$extension."/Shell/Open/Command/")-> + # SetValue("", $command.' "%1" %*'); +} + +=pod + =item C<broadcast_env> Broadcasts system message that enviroment has changed. This only has diff --git a/Master/tlpkg/bin/uninstall-tl.bat b/Master/tlpkg/bin/uninstall-tl.bat new file mode 100755 index 00000000000..ed18ef8010f --- /dev/null +++ b/Master/tlpkg/bin/uninstall-tl.bat @@ -0,0 +1,24 @@ +@echo off
+
+rem TeX Live Root; ends with backslash
+rem This should also work with UNC names
+set tlroot=%~dp0
+set tldrive=%~d0
+
+%tldrive%
+cd %tlroot%
+
+rem use provided Perl
+
+set PERL5SAVE=%PERL5LIB%
+
+set PERL5LIB=%tlroot%..\tlperl\lib
+"%tlroot%..\tlperl\bin\perl" "%tlroot%uninstall-tl.pl" %*
+rem pause Done
+
+rem cleanup in case of start from command-line
+
+set PERL5LIB=%PERL5SAVE%
+set PERL5SAVE=
+set tldrive=
+set tlroot=
diff --git a/Master/tlpkg/bin/uninstall-tl.pl b/Master/tlpkg/bin/uninstall-tl.pl new file mode 100755 index 00000000000..f0109f846c4 --- /dev/null +++ b/Master/tlpkg/bin/uninstall-tl.pl @@ -0,0 +1,70 @@ +#!/usr/bin/env perl + +# $Id: uninstall-tl.pl 6381 2008-01-23 17:50:54Z preining $ +# uninstall-tl.pl +# +# Copyright 2008 Norbert Preining +# This file is licensed under the GNU General Public License version 2 +# or any later version. +# + + +my $me; + +BEGIN { + $^W = 1; + $me=$0; + $me=~s!\\!/!g if $^O=~/^MSWin(32|64)$/i; + if ($me =~ m!/!) { + $me =~ s!(.*)/.*$!$1!; + } else { + $me = '.'; + } + unshift (@INC, "$me/.."); +} + +use TeXLive::TLWinGoo; +use Cwd qw/abs_path/; +use strict; + +&main (); + +sub main +{ + # get the db. + my $Master = abs_path("$me/../.."); + + # we have to + # - remove the entry of bin/arch from the PATH environment + # - (win32) remove the .texlua association + # - (win32) remove the entry of PATHEXT + # - (unix) ... the links + if (win32()) { + # remove any tex path and add an empty entry ... hope that does the + # right thing + add_texbindir_to_path(""); + unregister_script_type(".texlua"); + broadcast_env; + # now remove all the OTHER dirs (nothing done here atm) + # ... + # now remove myself ... does this work? + exec('del',"$Master") or die("cannot remove myself: $Master, $!\n"); + } else { + # remove the links (missings, but we do not support them in the installer + # anyway + # ... + # remove myself ... + exec('rm','-rf',"$Master") or die("cannot remove myself: $Master, $!\n"); + } +} + + +__END__ + + +### Local Variables: +### perl-indent-level: 2 +### tab-width: 2 +### indent-tabs-mode: nil +### End: +# vim:set tabstop=2 expandtab: # diff --git a/Master/tlpkg/tlpsrc/texlive-infra.tlpsrc b/Master/tlpkg/tlpsrc/texlive-infra.tlpsrc index b2aa7eb9bc1..d88cea34752 100644 --- a/Master/tlpkg/tlpsrc/texlive-infra.tlpsrc +++ b/Master/tlpkg/tlpsrc/texlive-infra.tlpsrc @@ -4,6 +4,7 @@ docpattern f tlpkg/man/* docpattern f tlpkg/doc/* runpattern f tlpkg/TeXLive/* # here we should add scripts usefull for an installed system from tlpkg/bin! +runpattern f tlpkg/bin/uninstall-tl.* runpattern f tlpkg/bin/generate-fmtutil runpattern f tlpkg/bin/generate-updmap runpattern f tlpkg/bin/generate-language |