summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/uninstall-tl.pl
blob: de443cc76ae0ac9d1875533b515cc64364134e2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/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 win32
{
  return ($^O=~/^MSWin(32|64)$/i ? 1 : 0);
}

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)
    # ...
    # 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: #