summaryrefslogtreecommitdiff
path: root/Master/tlpkg/installer/uninstall-tl.pl
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/installer/uninstall-tl.pl')
-rwxr-xr-xMaster/tlpkg/installer/uninstall-tl.pl194
1 files changed, 0 insertions, 194 deletions
diff --git a/Master/tlpkg/installer/uninstall-tl.pl b/Master/tlpkg/installer/uninstall-tl.pl
deleted file mode 100755
index 0f4fcecfe83..00000000000
--- a/Master/tlpkg/installer/uninstall-tl.pl
+++ /dev/null
@@ -1,194 +0,0 @@
-#!/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 TeXLive::TLPDB;
-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
- my $tlpdb = TeXLive::TLPDB->new ("root" => "$Master");
- my $opt_symlinks = 0;
- my ($sys_bin,$sys_info,$sys_man);
- my ($texdir,$texmflocal,$texmfhome,$texmfsysvar);
- if ($tlpdb) {
- my $tlp = $tlpdb->get_package("00texlive-installation.config");
- if (defined($tlp)) {
- my @deps = $tlp->depends;
- foreach my $d (@deps) {
- $opt_symlinks = 1 if ($d =~ m/^option_symlinks$/);
- if ($d =~ m;^sys_bin/(.*)$;) { $sys_bin = $1 ; }
- if ($d =~ m;^sys_man/(.*)$;) { $sys_man = $1 ; }
- if ($d =~ m;^sys_info/(.*)$;) { $sys_info = $1 ; }
- if ($d =~ m;^TEXDIR/(.*)$;) { $texdir = $1 ; }
- if ($d =~ m;^TEXMFHOME/(.*)$;) { $texmfhome = $1 ; }
- if ($d =~ m;^TEXMFSYSVAR/(.*)$;) { $texmfsysvar = $1 ; }
- if ($d =~ m;^TEXMFLOCAL/(.*)$;) { $texmflocal = $1 ; }
- }
- }
- } else {
- warn("Cannot find tlpdb in $Master!\n");
- }
- # we have to
- # - (win32) remove the entry of bin/arch from the PATH environment
- # - (unix) remove the links if opt_symlinks
- # - (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();
- # remove all the directories
- system("rmdir /s /q \"$Master\\texmf-dist\"");
- system("rmdir /s /q \"$Master\\texmf-doc\"");
- system("rmdir /s /q \"$Master\\texmf-var\"");
- system("rmdir /s /q \"$Master\\texmf-config\"");
- system("rmdir /s /q \"$Master\\texmf\"");
- system("rmdir /s /q \"$Master\\bin\"");
- system("del /q \"$Master\\install-tl.log\"");
- # that cannot be removed that easily, some files are in use ...
- # so we move that to the .bat file
- # tlpkg\bin\uninstall-tl.pl
- # tlpkg\bin
- # tlpkg\texlive.tlpdb
- # tlpkg\tlperl\bin
- # tlpkg\tlperl\lib
- #system("rmdir /s /q \"$Master\\tlpkg\"");
- # now everything should be removed ...
- system("rmdir /q \"$Master\"");
- } else {
- # remove the links missing
- if ($opt_symlinks) {
- my @files;
- if ((-d "$sys_bin") && (-w "$sys_bin")) {
- my $plat_bindir;
- if (-l "$sys_bin/pdftex") {
- my $fullpath = readlink("$sys_bin/pdftex");
- if ($fullpath =~ m;^$Master/bin/(.*)/[^/]*$;) {
- $plat_bindir = $1;
- }
- } else {
- warn "$sys_bin/pdftex not present or not a link, not removing any link of binaries!\n";
- }
- if ($plat_bindir) {
- @files = `ls "$Master/bin/$plat_bindir"`;
- chomp(@files);
- foreach my $f (@files) {
- next if (! -r "$sys_bin/$f");
- if ((-l "$sys_bin/$f") &&
- (readlink("$sys_bin/$f") =~ m;^$Master/bin/$plat_bindir/;)) {
- unlink("$sys_bin/$f");
- } else {
- warn ("not removing $sys_bin/$f, not a link or wrong destination!\n");
- }
- }
- }
- `rmdir "$sys_bin" 2>/dev/null`;
- } else {
- warn "destination of bin symlink $sys_bin not writable, no removal of links of bin files done!\n";
- }
- # info files
- if (-w $sys_info) {
- @files = `ls "$Master/texmf/doc/info"`;
- chomp(@files);
- foreach my $f (@files) {
- next if (! -r "$sys_info/$f");
- if ((-l "$sys_info/$f") &&
- (readlink("$sys_info/$f") =~ m;^$Master/texmf/doc/info/;)) {
- unlink("$sys_info/$f");
- } else {
- warn ("not removing $sys_info/$f, not a link or wrong destination!\n");
- }
- }
- `rmdir "$sys_info" 2>/dev/null`;
- } else {
- warn "destination of info symlink $sys_info not writable, no removal of links of info files done!\n";
- }
- # man files
- if (-w $sys_man) {
- my $foo = `(cd "$Master/texmf/doc/man" && echo *)`;
- my @mans = split ' ', $foo;
- chomp(@mans);
- foreach my $m (@mans) {
- my $mandir = "$Master/texmf/doc/man/$m";
- next unless -d $mandir;
- next unless -d "$sys_man/$m";
- @files = `ls "$mandir"`;
- chomp(@files);
- foreach my $f (@files) {
- next if (! -r "$sys_man/$m/$f");
- if ((-l "$sys_man/$m/$f") &&
- (readlink("$sys_man/$m/$f") =~ m;^$Master/texmf/doc/man/$m/;)) {
- unlink("$sys_man/$m/$f");
- } else {
- warn ("not removing $sys_man/$m/$f, not a link or wrong destination!\n");
- }
- }
- # ignore errors, it might be not empty
- `rmdir "$sys_man/$m" 2>/dev/null`;
- }
- `rmdir "$sys_man" 2>/dev/null`;
- } else {
- warn "destination of man symlink $sys_man not writable, no removal of links of man files done!\n";
- }
- }
- # 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: #