#!/usr/bin/env perl # $Id: uninstall-tl.pl 6381 2008-01-23 17:50:54Z preining $ # uninstall-tl.pl # # Copyright 2008 Norbert Preining, Siep Kroonenberg # 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_texbindirs_from_path(); 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 missing # We have to save some information about these options into the # texlive.tlpdb otherwise we will not be able to undo that # ... # 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: #