summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2008-02-25 19:41:48 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2008-02-25 19:41:48 +0000
commit22591f8f533f27ac66dc4fbaacedf25c1870cd18 (patch)
treefd29da411470bde057d58140c1c5563202d8b187
parent26100be560a2f5e5d4c67d640cd288d08d575128 (diff)
Added: tlpkg/installer/uninstall-try.[pl|bat],
only tested under windows. It just undoes registry- and environment settings. Also: perllib/Win32/Env.pm removed. git-svn-id: svn://tug.org/texlive/trunk@6754 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/tlpkg/doc/windemo.bat8
-rwxr-xr-xMaster/tlpkg/doc/wingoo-demo.bat9
-rw-r--r--Master/tlpkg/doc/wingoo-demo.pl4
-rw-r--r--Master/tlpkg/installer/perllib/Win32/Env.pm169
-rwxr-xr-xMaster/tlpkg/installer/uninstall-try.bat24
-rwxr-xr-xMaster/tlpkg/installer/uninstall-try.pl87
6 files changed, 122 insertions, 179 deletions
diff --git a/Master/tlpkg/doc/windemo.bat b/Master/tlpkg/doc/windemo.bat
index 4cf04f380c0..0aab32be7c0 100755
--- a/Master/tlpkg/doc/windemo.bat
+++ b/Master/tlpkg/doc/windemo.bat
@@ -2,16 +2,16 @@
rem TeX Live win32 bin directory; ends with backslash
rem This should also work with UNC names
-set tlwinbin=%~dp0
+set tlsubsub=%~dp0
set PERL5SAVE=%PERL5LIB%
-set PERL5LIB=%tlwinbin%..\..\tlpkg\lib\Perl5_lib-TL_inst
-"%tlwinbin%..\..\tlpkg\bin\perl" "%~dpn0" %1 %2 %3 %4 %5 %6 %7 %8 %9
+set PERL5LIB=%tlsubsub%..\..\tlpkg\tlperl\lib
+"%tlsubsub%..\..\tlpkg\tlperl\bin\perl" "%~dpn0.pl" %1 %2 %3 %4 %5 %6 %7 %8 %9
pause Done
rem cleanup in case of start from command-line
set PERL5LIB=%PERL5SAVE%
set PERL5SAVE=
-set tlwinbin=
+set tlsubsub=
diff --git a/Master/tlpkg/doc/wingoo-demo.bat b/Master/tlpkg/doc/wingoo-demo.bat
index b3129d46771..d9a2eb68d06 100755
--- a/Master/tlpkg/doc/wingoo-demo.bat
+++ b/Master/tlpkg/doc/wingoo-demo.bat
@@ -2,13 +2,14 @@
rem Directory of this script; ends with backslash
rem This should also work with UNC names
-set tldoc=%~dp0
+set tlsubsub=%~dp0
+set tlprog=
set tldrive=%~d0
%tldrive%
-cd %tldoc%
+cd %tlsubsub%
-"%tldoc%..\tlperl\bin\perl" "%tldoc%wingoo-demo.pl"
+"%tlsubsub%..\..\tlpkg\tlperl\bin\perl" "%~dpn0.pl" %1 %2 %3 %4 %5 %6 %7 %8 %9
pause Done
@@ -17,4 +18,4 @@ rem cleanup in case of start from command-line
path %pathsave%
set pathsave=
set tldrive=
-set tldoc=
+set tlsubsub=
diff --git a/Master/tlpkg/doc/wingoo-demo.pl b/Master/tlpkg/doc/wingoo-demo.pl
index bcf4759d25d..4be176de85a 100644
--- a/Master/tlpkg/doc/wingoo-demo.pl
+++ b/Master/tlpkg/doc/wingoo-demo.pl
@@ -16,7 +16,7 @@ BEGIN {
if ($me=~m!/!) {
# wingoo-demo now in a subsubdirectory:
- ($::installerdir=$me)=~s!(.*)\/tlpkg\/doc\/.*$!$1!;
+ ($::installerdir=$me)=~s!(.*)/[^/]+/[^/]+/[^/]*$!$1!;
} else {
# This shouldn't occur if called from batchfile
$::installerdir='./../..';
@@ -26,7 +26,7 @@ BEGIN {
}
use TeXLive::TLUtils qw( get_system_tmpdir );
-use TeXLive::TLWinGooTry qw(
+use TeXLive::TLWinGoo qw(
&admin
&non_admin
&admin_again
diff --git a/Master/tlpkg/installer/perllib/Win32/Env.pm b/Master/tlpkg/installer/perllib/Win32/Env.pm
deleted file mode 100644
index c5420718175..00000000000
--- a/Master/tlpkg/installer/perllib/Win32/Env.pm
+++ /dev/null
@@ -1,169 +0,0 @@
-package Win32::Env;
-our $VERSION='0.01';
-
-=head1 NAME
-
-Win32::Env - get and set global system and user enviroment varialbes under Win32.
-
-=head1 VERSION
-
-Version 0.01
-
-=head1 SYNOPSIS
-
- use Win32::Env;
-
- my $user_path=GetEnv(ENV_USER, 'PATH');
- # Limit PATH for other programs to system path and specified directory for 10 seconds
- SetEnv(ENV_USER, 'PATH', 'C:\\Perl\\bin');
- BroadcastEnv();
- sleep(10);
- # Restore everything back
- SetEnv(ENV_USER, 'PATH', $user_path);
- BroadcastEnv();
-
-=cut
-
-
-use warnings;
-use strict;
-
-use Win32::TieRegistry(FixSzNulls=>1);
-
-use Exporter qw(import);
-our @EXPORT=qw(SetEnv GetEnv BroadcastEnv ENV_USER ENV_SYSTEM);
-
-use constant ENV_USER =>0;
-use constant ENV_SYSTEM =>1;
-
-use constant ENVKEY_USER => 'HKEY_CURRENT_USER\\Environment';
-use constant ENVKEY_SYSTEM => 'HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment';
-
-=head1 EXPORT
-
-SetEnv GetEnv BroadcastEnv ENV_USER ENV_SYSTEM
-
-=head1 FUNCTIONS
-
-=cut
-
-sub _NWA{
- my $lib=shift,
- my @proto=@_;
- require Win32::API;
- return(new Win32::API($lib, @proto) or die "Can't import API $proto[0] from $lib: $^E\n");
-}
-
-# TODO: error/sanity checks for other args
-sub _num_to_key($){
- my $sysusr=shift;
- if($sysusr==ENV_USER) { $sysusr=ENVKEY_USER; }
- elsif($sysusr==ENV_SYSTEM) { $sysusr=ENVKEY_SYSTEM; }
- else { return; } # And Carp!
- return $sysusr;
-}
-
-=head2 SetEnv($sys_or_usr, $variable, $value)
-
-Sets variable in enviroment to specified value. C<$sys_or_usr> specifies either
-current user's enviroment with exported constant C<ENV_USER> or system's global environment
-with C<ENV_SYSTEM>.
-
-=cut
-
-sub SetEnv($$$){
- my ($sysusr, $var, $value)=@_;
- $sysusr=(_num_to_key($sysusr) or return);
- $Registry->{"$sysusr\\$var"}=$value;
-}
-
-=head2 GetEnv($sys_or_usr, $variable)
-
-Returns value of enviroment variable. Its difference from plain C<$ENV{$variable}> is that
-you can (and must) select current user's or system's global enviroment with C<$sys_or_usr>.
-It is selected with same constants as in L<#SetEnv>.
-
-=cut
-
-sub GetEnv($$){
- my ($sysusr, $var, $value)=@_;
- $sysusr=(_num_to_key($sysusr) or return);
- return $Registry->{"$sysusr\\$var"};
-}
-
-=head2 BroadcastEnv()
-
-Broadcasts system message that enviroment has changed. This will make system processes responsible for
-enviroment aware of change, otherwise your changes will be noticed only on next reboot. Note that most
-user programs still won't see changes until next run and that your changes will not be available in C<%ENV>
-to either your process or any processes you spawn. Assign to C<%ENV> yourself in addition to C<SetEnv> if
-need it.
-
-=cut
-
-sub BroadcastEnv(){
- use constant HWND_BROADCAST => 0xffff;
- use constant WM_SETTINGCHANGE => 0x001A;
- print "Broadcasting \"Enviroment settings changed\" message...\n";
- # SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) "Environment", SMTO_ABORTIFHUNG, 5000, &dwReturnValue);
- my $SendMessage=_NWA('user32', 'SendMessage', 'LLPP', 'L');
- $SendMessage->Call(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 'Environment');
- print "Broadcast complete.\n";
-}
-
-1;
-
-=head1 AUTHOR
-
-Oleg "Rowaa[SR13]" V. Volkov, C<< <ROWAA at cpan.org> >>
-
-=head1 BUGS / TODO
-
-Only first argument to C<GetEnv>/C<SetEnv> is checked right now. Considering that functions work with
-Windows registry, more sanity checks should be added to other arguments.
-
-Any limitations of Win32::TieRegistry apply to this module too, because it is used to write all
-changes to the registry.
-
-Please report any bugs or feature requests to
-C<bug-win32-env at rt.cpan.org>, or through the web interface at
-L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Win32-Env>.
-I will be notified, and then you'll automatically be notified of progress on
-your bug as I make changes.
-
-=head1 SUPPORT
-
-You can find documentation for this module with the perldoc command.
-
- perldoc Win32::Env
-
-You can also look for information at:
-
-=over 4
-
-=item * AnnoCPAN: Annotated CPAN documentation
-
-L<http://annocpan.org/dist/Win32-Env>
-
-=item * CPAN Ratings
-
-L<http://cpanratings.perl.org/d/Win32-Env>
-
-=item * RT: CPAN's request tracker
-
-L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Win32-Env>
-
-=item * Search CPAN
-
-L<http://search.cpan.org/dist/Win32-Env>
-
-=back
-
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2006 Oleg "Rowaa[SR13]" V. Volkov, all rights reserved.
-
-This program is free software; you can redistribute it and/or modify it
-under the same terms as Perl itself.
-
-=cut
diff --git a/Master/tlpkg/installer/uninstall-try.bat b/Master/tlpkg/installer/uninstall-try.bat
new file mode 100755
index 00000000000..b33fefde5cd
--- /dev/null
+++ b/Master/tlpkg/installer/uninstall-try.bat
@@ -0,0 +1,24 @@
+@echo off
+
+rem TeX Live Root; ends with backslash
+rem This should also work with UNC names
+set tlsub=%~dp0
+set tldrive=%~d0
+
+%tldrive%
+cd %tlsub%
+
+rem use provided Perl
+
+set PERL5SAVE=%PERL5LIB%
+
+set PERL5LIB=%tlsub%..\tlperl\lib
+"%tlsub%..\tlperl\bin\perl" "%~dpn0.pl" %1 %2 %3 %4 %5 %6 %7 %8 %9
+rem pause Done
+
+rem cleanup in case of start from command-line
+
+set PERL5LIB=%PERL5SAVE%
+set PERL5SAVE=
+set tldrive=
+set tlsub=
diff --git a/Master/tlpkg/installer/uninstall-try.pl b/Master/tlpkg/installer/uninstall-try.pl
new file mode 100755
index 00000000000..00f68b6acc7
--- /dev/null
+++ b/Master/tlpkg/installer/uninstall-try.pl
@@ -0,0 +1,87 @@
+#!/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!; # parent
+ } else {
+ $me='./..';
+ }
+ unshift (@INC, $me);
+}
+
+use TeXLive::TLWinGoo;
+use Cwd qw/abs_path/;
+use strict;
+
+&main ();
+
+sub win32
+{
+ return ($^O=~/^MSWin(32|64)$/i ? 1 : 0);
+}
+
+sub main
+{
+ # get the db.
+ my $Master = abs_path("$me/.."); # another step up
+
+ # 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("");
+ remove_texbindir_from_path("$Master/bin/win32");
+ unregister_script_type(".texlua");
+ broadcast_env();
+ update_assocs();
+ # now remove all the OTHER dirs (nothing done here atm)
+ # ...
+ # remove all the directories ... howto do that on windows ...
+ } else {
+ # remove the links (missings, but we do not support them in the installer
+ # anyway
+ # ...
+ # remove all the directories
+ system("rm -rf \"$Master/texmf-dist\"");
+ system("rm -rf \"$Master/texmf-doc\"");
+ system("rm -rf \"$Master/texmf-var\"");
+ system("rm -rf \"$Master/texmf-config\"");
+ system("rm -rf \"$Master/texmf\"");
+ system("rm -rf \"$Master/bin\"");
+ system("rm -rf \"$Master/tlpkg\"");
+ system("rm -f \"$Master/install-tl.log\"");
+ # now everything should be removed ...
+ # note that shell returns 0 on success, so we have to use "and"
+ system("rmdir \"$Master\"") and
+ warn("Couldn't completely remove $Master: $!\n");
+ }
+}
+
+
+__END__
+
+
+### Local Variables:
+### perl-indent-level: 2
+### tab-width: 2
+### indent-tabs-mode: nil
+### End:
+# vim:set tabstop=2 expandtab: #