summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-05-03 10:21:13 +0000
committerNorbert Preining <preining@logic.at>2008-05-03 10:21:13 +0000
commit37578c7253166e9cfb76bbbde0b48279f5ce7f61 (patch)
tree52163fb33cebd95fb30567288b6e5ff4e6cddb0c /Master
parent4ba35207bd3275933f850e11bfd3c83453b791cd (diff)
get rid of tlmgr.tlu, rename tl-package-manger.pl to tlmgr.pl,
merge uninstall-tl.pl funcionality, adapt TLWinGoo uninstaller to use it git-svn-id: svn://tug.org/texlive/trunk@7812 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf/scripts/texlive/texconf.tlu5
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl (renamed from Master/texmf/scripts/texlive/tl-package-manager.pl)970
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.tlu180
-rwxr-xr-xMaster/texmf/scripts/texlive/uninstall-tl.pl155
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm2
5 files changed, 597 insertions, 715 deletions
diff --git a/Master/texmf/scripts/texlive/texconf.tlu b/Master/texmf/scripts/texlive/texconf.tlu
index 32c6da8726f..83e7a5e1573 100755
--- a/Master/texmf/scripts/texlive/texconf.tlu
+++ b/Master/texmf/scripts/texlive/texconf.tlu
@@ -53,8 +53,7 @@ end
if (options["noformat"]) then
noformatopt = true
end
-
-
+
if (sys) then
texmfconfig=kpse.var_value('TEXMFSYSCONFIG')
else
@@ -570,7 +569,7 @@ if sys and domktexlsr then
os.spawn(command)
end
-if noformat then
+if noformatopt then
doformat = false
end
diff --git a/Master/texmf/scripts/texlive/tl-package-manager.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 0978a69a8a7..dc1413d3c93 100755
--- a/Master/texmf/scripts/texlive/tl-package-manager.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
-# $Id: tl-package-manager.pl 6381 2008-01-23 17:50:54Z preining $
+# $Id: tlmgr.pl 6381 2008-01-23 17:50:54Z preining $
#
# Copyright 2008 Norbert Preining
# This file is licensed under the GNU General Public License version 2
@@ -27,13 +27,6 @@
# default set location ....
# default set docfiles ....
#
-# NOTE:
-# We keep the FULL DOCUMENTATION of tlmgr in this file since all options
-# are forwarded to tl-package-manager. Therefore the pod documentation
-# also mentions "tlmgr" instead of tl-package-manager.pl!!
-#
-# Please if you add something tl tlmgr.texlua also add documentation here!
-#
my $Master;
@@ -50,15 +43,13 @@ use TeXLive::TLPDB;
use TeXLive::TLConfig;
use TeXLive::TLMedia;
use TeXLive::TLUtils;
-TeXLive::TLUtils->import( qw(kpsewhich member) );
+use TeXLive::TLWinGoo;
+TeXLive::TLUtils->import( qw(kpsewhich member win32) );
use Cwd qw/abs_path/;
use Pod::Usage;
-use Getopt::Long qw(:config no_autoabbrev pass_through);
-#$Getopt::Long::autoabbrev=0;
-#$Getopt::Long::pass_through=1;
+use Getopt::Long qw(:config no_autoabbrev require_order pass_through);
use strict;
-
# used variables
# the TLMedia from which we install/update
my $tlmediasrc;
@@ -73,22 +64,12 @@ my $location;
# option handling
my $opt_location;
-my $opt_nodepends = 0;
my $opt_help = 0;
my $opt_debug = 0;
-my $opt_force = 0;
-my $opt_dry = 0;
-my $localconf = "";
-my $dest = "";
GetOptions("location=s" => \$opt_location,
"netarchive=s" => \$NetArchive,
"diskarchive=s" => \$DiskArchive,
- "no-depends" => \$opt_nodepends,
- "force" => \$opt_force,
- "localcfg=s" => \$localconf,
- "dest=s" => \$dest,
- "dry-run" => \$opt_dry,
"debug!", "h|help|?" => \$opt_help) or pod2usage(1);
my $action = shift;
@@ -113,378 +94,51 @@ if ($opt_debug) {
$::LOGLEVELTERMINAL = $::LOG_DDDEBUG;
}
-#
-# here starts the magic
-#
-$localtlpdb = TeXLive::TLPDB->new ("root" => "$Master");
-die("cannot find tlpdb!") unless (defined($localtlpdb));
-
-# let cmd line options override the settings in localtlpdb
-my $loc = $localtlpdb->option_location;
-if (defined($loc)) {
- $location = $loc;
-}
-if (defined($opt_location)) {
- $location = $opt_location;
-}
-
-# setup the programs, for win32 we need the shipped wget/lzma etc, so we
-# pass the location of these files to setup_programs.
-setup_programs("$Master/tlpkg/installer", $localtlpdb->option_platform);
-
my $ret = 0;
if ($action =~ m/^generate$/i) {
- my $what = shift;
- #my $localconf = "";
- #my $dest = "";
- #GetOptions("localcfg=s" => \$localconf, "dest=s" > \$dest,) or pod2usage(1);
- if ($what =~ m/^language$/i) {
- $dest || ($dest = kpsewhich ("TEXMFSYSVAR") . "/tex/generic/config/language.dat");
- $localconf || ($localconf = kpsewhich ("TEXMFLOCAL") . "/tex/generic/config/language-local.dat");
- tllog ($::LOG_NORMAL, "$0: writing language data to $dest\n");
- TeXLive::TLUtils::create_language ($localtlpdb, $dest, $localconf);
- } elsif ($what =~ m/^fmtutil$/i) {
- $dest || ($dest = kpsewhich("TEXMFSYSVAR") . "/web2c/fmtutil.cnf");
- $localconf || ($localconf = kpsewhich("TEXMFLOCAL") . "/web2c/fmtutil-local.cnf");
- tllog($::LOG_NORMAL, "writing fmtutil.cnf data to $dest\n");
- TeXLive::TLUtils::create_fmtutil($localtlpdb, $dest, $localconf);
- } elsif ($what =~ m/^updmap$/i) {
- $dest || ($dest = kpsewhich("TEXMFSYSVAR") . "/web2c/updmap.cfg");
- $localconf || ($localconf = kpsewhich("TEXMFLOCAL") . "/web2c/updmap-local.cfg");
- tllog($::LOG_NORMAL, "$0: writing new updmap.cfg to $dest\n");
- TeXLive::TLUtils::create_updmap ($localtlpdb, $dest, $localconf);
- } else {
- die "Unknown option for generate: $what";
- }
- # should we do some postinst actions?
+ $ret = action_generate();
+ # should we do postinstall stuff?
exit(0);
} elsif ($action =~ m/^arch$/i) {
- my $what = shift;
- if ($what =~ m/^list$/i) {
- # list the available architectures
- # initialize the TLMedia from $location
- $tlmediasrc = TeXLive::TLMedia->new($location);
- my $mediatlpdb = $tlmediasrc->tlpdb;
- my @already_installed_arch = $localtlpdb->available_architectures;
- print "Available architectures:\n";
- foreach my $a ($mediatlpdb->available_architectures) {
- if (member($a,@already_installed_arch)) {
- print "(i) $a\n";
- } else {
- print " $a\n";
- }
- }
- print "Already installed architectures are marked with (i)\n";
- print "You can add new architectures with tlmgr arch add arch1 arch2\n";
- exit(0);
- } elsif ($what =~ m/^add$/i) {
- $tlmediasrc = TeXLive::TLMedia->new($location);
- my $mediatlpdb = $tlmediasrc->tlpdb;
- my @already_installed_arch = $localtlpdb->available_architectures;
- my @available_arch = $mediatlpdb->available_architectures;
- my @todoarchs;
- foreach my $a (@ARGV) {
- if (TeXLive::TLUtils::member($a, @already_installed_arch)) {
- print "Arch $a is already installed\n";
- next;
- }
- if (!TeXLive::TLUtils::member($a, @available_arch)) {
- print "Arch $a not available, use 'tlmgr available_archs'!\n";
- next;
- }
- push @todoarchs, $a;
- }
- foreach my $pkg ($localtlpdb->list_packages) {
- next if ($pkg =~ m/^00texlive/);
- my $tlp = $localtlpdb->get_package($pkg);
- foreach my $dep ($tlp->depends) {
- if ($dep =~ m/^(.*)\.ARCH$/) {
- # we have to install something
- foreach my $a (@todoarchs) {
- if ($opt_dry) {
- print "Installing $pkg.$a\n";
- } else {
- $ret |= $tlmediasrc->install_package("$pkg.$a", $localtlpdb, $opt_nodepends, 1);
- }
- }
- }
- }
- }
- if (TeXLive::TLUtils::member('win32', @todoarchs)) {
- # install the necessary win32 stuff
- $ret |= $tlmediasrc->install_package("bin-tlperl.win32", $localtlpdb, $opt_nodepends, 1);
- $ret |= $tlmediasrc->install_package("bin-tlgs.win32", $localtlpdb, $opt_nodepends, 1);
- }
- } else {
- die "Unknown option for arch: $what";
- }
+ $ret = action_arch();
} elsif ($action =~ m/^default$/i) {
- my $what = shift;
- die("default needs at least one argument") unless defined($what);
- if ($what =~ m/^location$/i) {
- # changes the default location
- my $loc = shift;
- if ($loc) {
- print "Setting default location to $loc!\n";
- $localtlpdb->option_location($loc);
- $localtlpdb->save;
- } else {
- print "Default installation source: ", $localtlpdb->option_location, "\n";
- }
- } elsif ($what =~ m/^docfiles$/i) {
- # changes the default docfiles
- my $loc = shift;
- if (defined($loc)) {
- print "Defaulting to", ($loc ? "" : " not"), " install documentation files!\n";
- $localtlpdb->option_docfiles($loc);
- $localtlpdb->save;
- } else {
- print "Install documentation files: ", $localtlpdb->option_docfiles, "\n";
- }
- } elsif ($what =~ m/^srcfiles$/i) {
- # changes the default srcfiles
- my $loc = shift;
- if (defined($loc)) {
- print "Defaulting to", ($loc ? "" : " not"), " install source files!\n";
- $localtlpdb->option_srcfiles($loc);
- $localtlpdb->save;
- } else {
- print "Install source files: ", $localtlpdb->option_srcfiles, "\n";
- }
- } elsif ($what =~ m/^formats$/i) {
- # changes the default formats
- my $loc = shift;
- if (defined($loc)) {
- print "Defaulting to", ($loc ? "" : " not"), " generate format files on installation!\n";
- $localtlpdb->option_formats($loc);
- $localtlpdb->save;
- } else {
- print "Create formats on installation: ", $localtlpdb->option_formats, "\n";
- }
- } elsif ($what =~ m/^show$/i) {
- print "Default installation location: ", $localtlpdb->option_location, "\n";
- print "Create formats on installation: ", ($localtlpdb->option_formats ? "yes": "no"), "\n";
- print "Install documentation files: ", ($localtlpdb->option_docfiles ? "yes": "no"), "\n";
- print "Install source files: ", ($localtlpdb->option_srcfiles ? "yes": "no"), "\n";
- } else {
- warn "Setting other options currently not supported, please edit texlive.tlpdb!";
- }
+ $ret = action_default();
+ # should we do postinstall stuff?
exit(0);
} elsif ($action =~ m/^list$/i) {
- my $what = shift;
- $what || ($what = "");
- $tlmediasrc = TeXLive::TLMedia->new($location);
- my @whattolist;
- if ($what =~ m/^collection/i) {
- @whattolist = $tlmediasrc->tlpdb->collections;
- } elsif ($what =~ m/^scheme/i) {
- @whattolist = $tlmediasrc->tlpdb->schemes;
- } else {
- @whattolist = $tlmediasrc->tlpdb->list_packages;
- }
- foreach (@whattolist) {
- if (defined($localtlpdb->get_package($_))) {
- print "i ";
- } else {
- print " ";
- }
- my $foo = $tlmediasrc->tlpdb->get_package($_)->shortdesc;
- print "$_: ", defined($foo) ? $foo : "(shortdesc missing)" , "\n";
- }
+ $ret = action_list();
+ # should we do postinstall stuff?
exit(0);
} elsif ($action =~ m/^install$/i) {
- # initialize the TLMedia from $location
- $tlmediasrc = TeXLive::TLMedia->new($location);
- foreach my $pkg (@ARGV) {
- if ($opt_dry) {
- print "Installing $pkg\n";
- } else {
- # install the packages and run postinstall actions (that is the 1)
- $ret |= $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 1);
- }
- }
+ $ret = action_install();
} elsif ($action =~ m/^update$/i) {
- # initialize the TLMedia from $location
- $tlmediasrc = TeXLive::TLMedia->new($location);
- my $mediatlpdb = $tlmediasrc->tlpdb;
- foreach my $pkg ($localtlpdb->list_packages) {
- next if ($pkg =~ m/^00texlive/);
- my $tlp = $localtlpdb->get_package($pkg);
- my $rev = $tlp->revision;
- my $mediatlp = $mediatlpdb->get_package($pkg);
- if (!defined($mediatlp)) {
- print "$pkg cannot be found in $location\n";
- next;
- }
- my $mediarev = $mediatlp->revision;
- if ($rev < $mediarev) {
- if ($opt_dry) {
- print "Installing $pkg\n";
- } else {
- # first remove the package, then reinstall it
- # this way we get rid of useless files
- # force the deinstallation since we will reinstall it
- $ret |= &remove_package($pkg, $localtlpdb, 1);
- $ret |= $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 1);
- }
- } elsif ($rev > $mediarev) {
- print "revision in $location is less then local revision, not updating!\n";
- next;
- }
- }
+ $ret = action_update();
} elsif ($action =~ m/^(global)?search$/i) {
- my $r = shift;
- my $ret = "";
- my $tlpdb;
- my $searchfile = 0;
- if ($r =~ m/^-file$/i) {
- $searchfile = 1;
- $r = shift;
- }
- if ($action =~ m/^globalsearch$/i) {
- my $tlmediasrc = TeXLive::TLMedia->new($location);
- $tlpdb = $tlmediasrc->tlpdb;
- } else {
- $tlpdb = $localtlpdb;
- }
- foreach my $pkg ($tlpdb->list_packages) {
- if ($searchfile) {
- my @ret = grep(m;$r;, $tlpdb->get_package($pkg)->all_files);
- if (@ret) {
- print "$pkg:\n";
- foreach (@ret) {
- print "\t$_\n";
- }
- }
- } else {
- next if ($pkg =~ m/\./);
- my $t = $tlpdb->get_package($pkg)->shortdesc;
- $t |= "";
- my $lt = $tlpdb->get_package($pkg)->longdesc;
- $lt |= "";
- if (($pkg =~ m/$r/) || ($t =~ m/$r/) || ($lt =~ m/$r/)) {
- $ret .= " $pkg - $t\n";
- }
- }
- }
- print "$ret";
+ $ret = action_search($action);
exit(0);
} elsif ($action =~ m/^show$/i) {
- foreach my $pkg (@ARGV) {
- my $tlmediatlpdb;
- my $tlp = $localtlpdb->get_package($pkg);
- my $installed = 0;
- if (!$tlp) {
- if (!$tlmediatlpdb) {
- my $tlmediasrc = TeXLive::TLMedia->new($location);
- $tlmediatlpdb = $tlmediasrc->tlpdb;
- }
- $tlp = $tlmediatlpdb->get_package($pkg);
- } else {
- $installed = 1;
- }
- if ($tlp) {
- print "Package: ", $tlp->name, "\n";
- print "Category: ", $tlp->category, "\n";
- print "ShortDesc: ", $tlp->shortdesc, "\n" if ($tlp->shortdesc);
- print "LongDesc: ", $tlp->longdesc, "\n" if ($tlp->longdesc);
- print "Installed: ", ($installed?"Yes\n":"No\n");
- print "\n";
- } else {
- printf STDERR "Cannot find $pkg\n";
- }
- }
+ $ret = action_show();
+ exit(0);
} elsif ($action =~ m/^remove$/i) {
- # we do the following:
- # - (not implemented) order collections such that those depending on
- # other collections are first removed, and then those which only
- # depend on packages. Otherwise
- # remove collection-latex collection-latexrecommended
- # will not succeed
- # - first loop over all cmd line args and consider only the collections
- # - for each to be removed collection:
- # . check that no other collections/scheme asks for that collection
- # . remove the collection
- # . remove all dependencies
- # - for each normal package not already removed (via the above)
- # . check that no collection/scheme still depends on this package
- # . remove the package
- #
- my %already_removed;
- my @more_removal;
- foreach my $pkg (@ARGV) {
- my $tlp = $localtlpdb->get_package($pkg);
- next if defined($already_removed{$pkg});
- if (!defined($tlp)) {
- print "Package $pkg not present, cannot remove it!\n";
- } else {
- # in the first round we only remove collections, nothing else
- # but removing collections will remove all dependencies, too
- # save the information of which packages have already been removed
- # into %already_removed.
- if ($tlp->category eq "Collection") {
- # for collections we also remove all dependencies which are
- # not Collections or Schemes
- my $foo;
- if ($opt_dry) {
- print "Removing $pkg\n";
- # we need to set $foo to something positive otherwise
- # the rest will not be run in dry_run mode
- $foo = 0x0001;
- } else {
- $foo = &remove_package($pkg, $localtlpdb, $opt_force);
- }
- if ($foo) {
- # removal was successful, so the return is at least 0x0001 mktexlsr
- # remove dependencies, too
- $ret |= $foo;
- $already_removed{$pkg} = 1;
- if (!$opt_nodepends) {
- foreach my $d ($tlp->depends) {
- my $tlpdd = $localtlpdb->get_package($d);
- if (defined($tlpdd)) {
- if ($tlpdd->category !~ m/$MetaCategoriesRegexp/) {
- if ($opt_dry) {
- print "Removing $d\n";
- } else {
- $ret |= &remove_package($d, $localtlpdb, $opt_force);
- }
- $already_removed{$d} = 1;
- }
- }
- }
- }
- }
- } else {
- # save all the other packages into the @more_removal list to
- # be removed at the second state. Note that if a package has
- # already been removed due to a removal of a collection
- # it will be marked as such in %already_removed and not tried again
- push @more_removal, $pkg;
- }
- }
- }
- foreach my $pkg (@more_removal) {
- if (!defined($already_removed{$pkg})) {
- if ($opt_dry) {
- print "Removing $pkg\n";
- } else {
- $ret |= &remove_package($pkg, $localtlpdb, $opt_force);
- }
- }
- }
- if (!$opt_dry) {
- $localtlpdb->save;
- }
+ $ret = action_remove();
+} elsif (($action eq "paper") || ($action eq "dvips") || ($action eq "xdvi") ||
+ ($action eq "pdftex") || ($action eq "dvipdfm") ||
+ ($action eq "dvipdfmx")) {
+ my $TEXMFMAIN = `kpsewhich -var-value=TEXMFMAIN`;
+ chomp $TEXMFMAIN;
+ system("texlua", "$TEXMFMAIN/scripts/texlive/texconf.tlu", "--prog", "tlmgr", "--sys", $action, @ARGV);
+ $ret = 0;
+} elsif ($action =~ m/^uninstall$/i) {
+ $ret = action_uninstall();
+ exit(0);
+} elsif ($action =~ m/^uninstallwin32$/i) {
+ $ret = action_uninstall_win32();
+ exit(0);
} else {
die "Unknown action: $action";
}
-if ($opt_dry) {
- # stop here, don't do any postinstall actions
- exit(0);
-}
if ($ret & 0x0001) {
print "running mktexlsr\n";
@@ -605,6 +259,570 @@ sub remove_package {
return $ret;
}
+sub action_remove {
+ # we do the following:
+ # - (not implemented) order collections such that those depending on
+ # other collections are first removed, and then those which only
+ # depend on packages. Otherwise
+ # remove collection-latex collection-latexrecommended
+ # will not succeed
+ # - first loop over all cmd line args and consider only the collections
+ # - for each to be removed collection:
+ # . check that no other collections/scheme asks for that collection
+ # . remove the collection
+ # . remove all dependencies
+ # - for each normal package not already removed (via the above)
+ # . check that no collection/scheme still depends on this package
+ # . remove the package
+ #
+ my $ret = 0;
+ my $opt_nodepends = 0;
+ my $opt_force = 0;
+ my $opt_dry = 0;
+ Getopt::Long::Configure(qw(no_pass_through));
+ GetOptions("no-depends" => \$opt_nodepends,
+ "force" => \$opt_force,
+ "dry-run" => \$opt_dry) or pod2usage(1);
+ my %already_removed;
+ my @more_removal;
+ init_local_db();
+ foreach my $pkg (@ARGV) {
+ my $tlp = $localtlpdb->get_package($pkg);
+ next if defined($already_removed{$pkg});
+ if (!defined($tlp)) {
+ print "Package $pkg not present, cannot remove it!\n";
+ } else {
+ # in the first round we only remove collections, nothing else
+ # but removing collections will remove all dependencies, too
+ # save the information of which packages have already been removed
+ # into %already_removed.
+ if ($tlp->category eq "Collection") {
+ # for collections we also remove all dependencies which are
+ # not Collections or Schemes
+ my $foo;
+ if ($opt_dry) {
+ print "Removing $pkg\n";
+ # we need to set $foo to something positive otherwise
+ # the rest will not be run in dry_run mode
+ $foo = 0x0001;
+ } else {
+ $foo = &remove_package($pkg, $localtlpdb, $opt_force);
+ }
+ if ($foo) {
+ # removal was successful, so the return is at least 0x0001 mktexlsr
+ # remove dependencies, too
+ $ret |= $foo;
+ $already_removed{$pkg} = 1;
+ if (!$opt_nodepends) {
+ foreach my $d ($tlp->depends) {
+ my $tlpdd = $localtlpdb->get_package($d);
+ if (defined($tlpdd)) {
+ if ($tlpdd->category !~ m/$MetaCategoriesRegexp/) {
+ if ($opt_dry) {
+ print "Removing $d\n";
+ } else {
+ $ret |= &remove_package($d, $localtlpdb, $opt_force);
+ }
+ $already_removed{$d} = 1;
+ }
+ }
+ }
+ }
+ }
+ } else {
+ # save all the other packages into the @more_removal list to
+ # be removed at the second state. Note that if a package has
+ # already been removed due to a removal of a collection
+ # it will be marked as such in %already_removed and not tried again
+ push @more_removal, $pkg;
+ }
+ }
+ }
+ foreach my $pkg (@more_removal) {
+ if (!defined($already_removed{$pkg})) {
+ if ($opt_dry) {
+ print "Removing $pkg\n";
+ } else {
+ $ret |= &remove_package($pkg, $localtlpdb, $opt_force);
+ }
+ }
+ }
+ if ($opt_dry) {
+ # stop here, don't do any postinstall actions
+ return(0);
+ } else {
+ $localtlpdb->save;
+ return($ret);
+ }
+}
+
+sub action_show {
+ init_local_db();
+ foreach my $pkg (@ARGV) {
+ my $tlmediatlpdb;
+ my $tlp = $localtlpdb->get_package($pkg);
+ my $installed = 0;
+ if (!$tlp) {
+ if (!$tlmediatlpdb) {
+ my $tlmediasrc = TeXLive::TLMedia->new($location);
+ $tlmediatlpdb = $tlmediasrc->tlpdb;
+ }
+ $tlp = $tlmediatlpdb->get_package($pkg);
+ } else {
+ $installed = 1;
+ }
+ if ($tlp) {
+ print "Package: ", $tlp->name, "\n";
+ print "Category: ", $tlp->category, "\n";
+ print "ShortDesc: ", $tlp->shortdesc, "\n" if ($tlp->shortdesc);
+ print "LongDesc: ", $tlp->longdesc, "\n" if ($tlp->longdesc);
+ print "Installed: ", ($installed?"Yes\n":"No\n");
+ print "\n";
+ } else {
+ printf STDERR "Cannot find $pkg\n";
+ }
+ }
+ return(0);
+}
+
+sub action_search {
+ my ($action) = shift;
+ my $r = shift @ARGV;
+ my $ret = "";
+ my $tlpdb;
+ my $searchfile = 0;
+ init_local_db();
+ if ($r =~ m/^-file$/i) {
+ $searchfile = 1;
+ $r = shift @ARGV;
+ }
+ if ($action =~ m/^globalsearch$/i) {
+ my $tlmediasrc = TeXLive::TLMedia->new($location);
+ $tlpdb = $tlmediasrc->tlpdb;
+ } else {
+ $tlpdb = $localtlpdb;
+ }
+ foreach my $pkg ($tlpdb->list_packages) {
+ if ($searchfile) {
+ my @ret = grep(m;$r;, $tlpdb->get_package($pkg)->all_files);
+ if (@ret) {
+ print "$pkg:\n";
+ foreach (@ret) {
+ print "\t$_\n";
+ }
+ }
+ } else {
+ next if ($pkg =~ m/\./);
+ my $t = $tlpdb->get_package($pkg)->shortdesc;
+ $t |= "";
+ my $lt = $tlpdb->get_package($pkg)->longdesc;
+ $lt |= "";
+ if (($pkg =~ m/$r/) || ($t =~ m/$r/) || ($lt =~ m/$r/)) {
+ $ret .= " $pkg - $t\n";
+ }
+ }
+ }
+ print "$ret";
+ return(0);
+}
+
+sub action_update {
+ init_local_db();
+ # initialize the TLMedia from $location
+ my $opt_nodepends = 0;
+ my $opt_force = 0;
+ my $opt_dry = 0;
+ Getopt::Long::Configure(qw(no_pass_through));
+ GetOptions("no-depends" => \$opt_nodepends,
+ "force" => \$opt_force,
+ "dry-run" => \$opt_dry) or pod2usage(1);
+ my $ret = 0;
+ $tlmediasrc = TeXLive::TLMedia->new($location);
+ my $mediatlpdb = $tlmediasrc->tlpdb;
+ foreach my $pkg ($localtlpdb->list_packages) {
+ next if ($pkg =~ m/^00texlive/);
+ my $tlp = $localtlpdb->get_package($pkg);
+ my $rev = $tlp->revision;
+ my $mediatlp = $mediatlpdb->get_package($pkg);
+ if (!defined($mediatlp)) {
+ print "$pkg cannot be found in $location\n";
+ next;
+ }
+ my $mediarev = $mediatlp->revision;
+ if ($rev < $mediarev) {
+ if ($opt_dry) {
+ print "Installing $pkg\n";
+ } else {
+ # first remove the package, then reinstall it
+ # this way we get rid of useless files
+ # force the deinstallation since we will reinstall it
+ $ret |= &remove_package($pkg, $localtlpdb, 1);
+ $ret |= $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 1);
+ }
+ } elsif ($rev > $mediarev) {
+ print "revision in $location is less then local revision, not updating!\n";
+ next;
+ }
+ }
+ return($ret);
+}
+
+sub action_install {
+ init_local_db();
+ # initialize the TLMedia from $location
+ my $opt_nodepends = 0;
+ my $opt_force = 0;
+ my $opt_dry = 0;
+ Getopt::Long::Configure(qw(no_pass_through));
+ GetOptions("no-depends" => \$opt_nodepends,
+ "force" => \$opt_force,
+ "dry-run" => \$opt_dry) or pod2usage(1);
+ my $ret = 0;
+ $tlmediasrc = TeXLive::TLMedia->new($location);
+ foreach my $pkg (@ARGV) {
+ if ($opt_dry) {
+ print "Installing $pkg\n";
+ } else {
+ # install the packages and run postinstall actions (that is the 1)
+ $ret |= $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 1);
+ }
+ }
+ if ($opt_dry) {
+ # stop here, don't do any postinstall actions
+ return(0);
+ }
+ return($ret);
+}
+
+sub action_list {
+ init_local_db();
+ my $what = shift @ARGV;
+ $what || ($what = "");
+ $tlmediasrc = TeXLive::TLMedia->new($location);
+ my @whattolist;
+ if ($what =~ m/^collection/i) {
+ @whattolist = $tlmediasrc->tlpdb->collections;
+ } elsif ($what =~ m/^scheme/i) {
+ @whattolist = $tlmediasrc->tlpdb->schemes;
+ } else {
+ @whattolist = $tlmediasrc->tlpdb->list_packages;
+ }
+ foreach (@whattolist) {
+ if (defined($localtlpdb->get_package($_))) {
+ print "i ";
+ } else {
+ print " ";
+ }
+ my $foo = $tlmediasrc->tlpdb->get_package($_)->shortdesc;
+ print "$_: ", defined($foo) ? $foo : "(shortdesc missing)" , "\n";
+ }
+ return(0);
+}
+
+sub action_default {
+ my $what = shift @ARGV;
+ die("default needs at least one argument") unless defined($what);
+ init_local_db();
+ if ($what =~ m/^location$/i) {
+ # changes the default location
+ my $loc = shift @ARGV;
+ if ($loc) {
+ print "Setting default location to $loc!\n";
+ $localtlpdb->option_location($loc);
+ $localtlpdb->save;
+ } else {
+ print "Default installation source: ", $localtlpdb->option_location, "\n";
+ }
+ } elsif ($what =~ m/^docfiles$/i) {
+ # changes the default docfiles
+ my $loc = shift @ARGV;
+ if (defined($loc)) {
+ print "Defaulting to", ($loc ? "" : " not"), " install documentation files!\n";
+ $localtlpdb->option_docfiles($loc);
+ $localtlpdb->save;
+ } else {
+ print "Install documentation files: ", $localtlpdb->option_docfiles, "\n";
+ }
+ } elsif ($what =~ m/^srcfiles$/i) {
+ # changes the default srcfiles
+ my $loc = shift @ARGV;
+ if (defined($loc)) {
+ print "Defaulting to", ($loc ? "" : " not"), " install source files!\n";
+ $localtlpdb->option_srcfiles($loc);
+ $localtlpdb->save;
+ } else {
+ print "Install source files: ", $localtlpdb->option_srcfiles, "\n";
+ }
+ } elsif ($what =~ m/^formats$/i) {
+ # changes the default formats
+ my $loc = shift @ARGV;
+ if (defined($loc)) {
+ print "Defaulting to", ($loc ? "" : " not"), " generate format files on installation!\n";
+ $localtlpdb->option_formats($loc);
+ $localtlpdb->save;
+ } else {
+ print "Create formats on installation: ", $localtlpdb->option_formats, "\n";
+ }
+ } elsif ($what =~ m/^show$/i) {
+ print "Default installation location: ", $localtlpdb->option_location, "\n";
+ print "Create formats on installation: ", ($localtlpdb->option_formats ? "yes": "no"), "\n";
+ print "Install documentation files: ", ($localtlpdb->option_docfiles ? "yes": "no"), "\n";
+ print "Install source files: ", ($localtlpdb->option_srcfiles ? "yes": "no"), "\n";
+ } else {
+ warn "Setting other options currently not supported, please edit texlive.tlpdb!";
+ }
+ return(0);
+}
+
+sub action_arch {
+ my $what = shift @ARGV;
+ my $ret = 0;
+ my $opt_nodepends = 0;
+ my $opt_force = 0;
+ my $opt_dry = 0;
+ Getopt::Long::Configure(qw(no_pass_through));
+ GetOptions("no-depends" => \$opt_nodepends,
+ "force" => \$opt_force,
+ "dry-run" => \$opt_dry) or pod2usage(1);
+ init_local_db();
+ if ($what =~ m/^list$/i) {
+ # list the available architectures
+ # initialize the TLMedia from $location
+ $tlmediasrc = TeXLive::TLMedia->new($location);
+ my $mediatlpdb = $tlmediasrc->tlpdb;
+ my @already_installed_arch = $localtlpdb->available_architectures;
+ print "Available architectures:\n";
+ foreach my $a ($mediatlpdb->available_architectures) {
+ if (member($a,@already_installed_arch)) {
+ print "(i) $a\n";
+ } else {
+ print " $a\n";
+ }
+ }
+ print "Already installed architectures are marked with (i)\n";
+ print "You can add new architectures with tlmgr arch add arch1 arch2\n";
+ exit(0);
+ } elsif ($what =~ m/^add$/i) {
+ $tlmediasrc = TeXLive::TLMedia->new($location);
+ my $mediatlpdb = $tlmediasrc->tlpdb;
+ my @already_installed_arch = $localtlpdb->available_architectures;
+ my @available_arch = $mediatlpdb->available_architectures;
+ my @todoarchs;
+ foreach my $a (@ARGV) {
+ if (TeXLive::TLUtils::member($a, @already_installed_arch)) {
+ print "Arch $a is already installed\n";
+ next;
+ }
+ if (!TeXLive::TLUtils::member($a, @available_arch)) {
+ print "Arch $a not available, use 'tlmgr available_archs'!\n";
+ next;
+ }
+ push @todoarchs, $a;
+ }
+ foreach my $pkg ($localtlpdb->list_packages) {
+ next if ($pkg =~ m/^00texlive/);
+ my $tlp = $localtlpdb->get_package($pkg);
+ foreach my $dep ($tlp->depends) {
+ if ($dep =~ m/^(.*)\.ARCH$/) {
+ # we have to install something
+ foreach my $a (@todoarchs) {
+ if ($opt_dry) {
+ print "Installing $pkg.$a\n";
+ } else {
+ $ret |= $tlmediasrc->install_package("$pkg.$a", $localtlpdb, $opt_nodepends, 1);
+ }
+ }
+ }
+ }
+ }
+ if (TeXLive::TLUtils::member('win32', @todoarchs)) {
+ # install the necessary win32 stuff
+ $ret |= $tlmediasrc->install_package("bin-tlperl.win32", $localtlpdb, $opt_nodepends, 1);
+ $ret |= $tlmediasrc->install_package("bin-tlgs.win32", $localtlpdb, $opt_nodepends, 1);
+ }
+ } else {
+ die "Unknown option for arch: $what";
+ }
+ return($ret);
+}
+
+sub action_generate {
+ my $what = shift @ARGV;
+ my $localconf = "";
+ my $dest = "";
+ Getopt::Long::Configure(qw(no_pass_through));
+ GetOptions("localcfg=s" => \$localconf, "dest=s" > \$dest,) or pod2usage(1);
+ init_local_db();
+ if ($what =~ m/^language$/i) {
+ $dest || ($dest = kpsewhich ("TEXMFSYSVAR") . "/tex/generic/config/language.dat");
+ $localconf || ($localconf = kpsewhich ("TEXMFLOCAL") . "/tex/generic/config/language-local.dat");
+ tllog ($::LOG_NORMAL, "$0: writing language data to $dest\n");
+ TeXLive::TLUtils::create_language ($localtlpdb, $dest, $localconf);
+ } elsif ($what =~ m/^fmtutil$/i) {
+ $dest || ($dest = kpsewhich("TEXMFSYSVAR") . "/web2c/fmtutil.cnf");
+ $localconf || ($localconf = kpsewhich("TEXMFLOCAL") . "/web2c/fmtutil-local.cnf");
+ tllog($::LOG_NORMAL, "writing fmtutil.cnf data to $dest\n");
+ TeXLive::TLUtils::create_fmtutil($localtlpdb, $dest, $localconf);
+ } elsif ($what =~ m/^updmap$/i) {
+ $dest || ($dest = kpsewhich("TEXMFSYSVAR") . "/web2c/updmap.cfg");
+ $localconf || ($localconf = kpsewhich("TEXMFLOCAL") . "/web2c/updmap-local.cfg");
+ tllog($::LOG_NORMAL, "$0: writing new updmap.cfg to $dest\n");
+ TeXLive::TLUtils::create_updmap ($localtlpdb, $dest, $localconf);
+ } else {
+ die "Unknown option for generate: $what";
+ }
+ return(0);
+}
+
+sub init_local_db {
+ $localtlpdb = TeXLive::TLPDB->new ("root" => "$Master");
+ die("cannot find tlpdb!") unless (defined($localtlpdb));
+ # setup the programs, for win32 we need the shipped wget/lzma etc, so we
+ # pass the location of these files to setup_programs.
+ setup_programs("$Master/tlpkg/installer", $localtlpdb->option_platform);
+ # let cmd line options override the settings in localtlpdb
+ my $loc = $localtlpdb->option_location;
+ if (defined($loc)) {
+ $location = $loc;
+ }
+ if (defined($opt_location)) {
+ $location = $opt_location;
+ }
+}
+
+sub action_uninstall_win32 {
+ if (win32()) {
+ remove_texbindirs_from_path();
+ unsetenv_reg("TEXBINDIR");
+ # unregister_script_type(".texlua");
+ unregister_uninstaller();
+ exit if is_vista();
+ broadcast_env();
+ update_assocs();
+ }
+}
+
+
+sub action_uninstall {
+ if (win32()) {
+ printf STDERR "Please use \"Add/Remove Programs\" from the Control Panel to removing TeX Live!\n";
+ exit(1);
+ }
+ print("If you answer yes here the whole TeX Live installation will be removed!\n");
+ print "Remove TeX Live (y/N): ";
+ my $yesno = <STDIN>;
+ if ($yesno !~ m/^y(es)?$/i) {
+ print "Ok, cancelling the removal!\n";
+ exit(0);
+ }
+ print ("Ok, removing the whole installation:\n");
+ init_local_db;
+ my $tlpdb = $localtlpdb;
+ my $opt_symlinks = 0;
+ my ($sys_bin,$sys_info,$sys_man);
+ my ($texdir,$texmflocal,$texmfhome,$texmfsysvar);
+ if ($tlpdb) {
+ $sys_bin = $tlpdb->option_sys_bin;
+ $sys_man = $tlpdb->option_sys_man;
+ $sys_info= $tlpdb->option_sys_info;
+ $opt_symlinks = $tlpdb->option_symlinks;
+ $texdir = $Master;
+ $texmfhome = `kpsewhich -var-value=TEXMFHOME`; chomp($texmfhome);
+ $texmfsysvar = `kpsewhich -var-value=TEXMFSYSVAR`; chomp($texmfsysvar);
+ $texmflocal = `kpsewhich -var-value=TEXMFLOCAL`; chomp($texmflocal);
+ } else {
+ die("Cannot find tlpdb in $Master!");
+ }
+ # 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";
+ }
+ }
+ #
+ # now do remove the rest
+ system("rm", "-rf", "$texdir/texmf-dist");
+ system("rm", "-rf", "$texdir/texmf-doc");
+ system("rm", "-rf", "$texdir/texmf-var");
+ system("rm", "-rf", "$texdir/texmf");
+ system("rm", "-rf", "$texdir/tlpkg");
+ system("rm", "-rf", "$texdir/bin");
+ system("rmdir", "--ignore-fail-on-non-empty", "$texdir/temp");
+ unlink("$texdir/install-tl.log");
+ # should we do that????
+ system("rm", "-rf", "$texdir/texmf-config");
+ system("rmdir", "--ignore-fail-on-non-empty", "$texdir");
+}
+
#
# return all the directories from which all content will be removed
diff --git a/Master/texmf/scripts/texlive/tlmgr.tlu b/Master/texmf/scripts/texlive/tlmgr.tlu
deleted file mode 100755
index d7c99d8a022..00000000000
--- a/Master/texmf/scripts/texlive/tlmgr.tlu
+++ /dev/null
@@ -1,180 +0,0 @@
-#! /usr/bin/env texlua
---*-Lua-*-
--- $Id: tlmgr 7301 2008-04-03 16:52:55Z preining $
-
--- Copyright (C) 2008 Reinhard Kotucha, Norbert Preining.
--- You may freely use, modify and/or distribute this file.
-
--- tlmgr
--- one central managment utility for TeX Live
--- it calls several supporting scripts from texmf/scripts/texlive
--- and other places
---
--- NOTE
--- The full documentation for the end user will be kept in
--- tl-package-manager.pl
--- since help or empty arguments will be forwarded to that script!!!
---
--- Currently supported arguments
--- generate-fmtutil generate-fmtutil.pl
--- generate-updmap generate-updmap.pl
--- generate-language generate-language.pl
--- uninstall uninstall-tl.pl and local code
--- anything else tl-package-manager.pl
--- that is update, install, remove, search, ......
-
-if string.find(arg[0], '/') then -- UNIX path
- filename=select(1, string.gsub(arg[0], '.*/', ''))
-elseif string.find(arg[0], '\\') then -- Windows path
- filename=select(1, string.gsub(arg[0], '.*\\', ''))
-else -- no path
- filename=arg[0]
-end
-
-
--- we have to put the real calling program into basename. On win32 this
--- will be the filename replacing tlu with texlua, on unix just the
--- filename without extension
---
-if os.type == 'windows' then
- basename=select(1, string.gsub(filename, '\.tlu$', '.bat'))
-else
- basename=select(1, string.gsub(filename, '\.tlu$', ''))
-end
-
-kpse.set_program_name(basename)
-TEXDIR=kpse.var_value('SELFAUTOPARENT')
-TEXMFSYSVAR=kpse.var_value('TEXMFSYSVAR')
-BINDIR=kpse.var_value('SELFAUTOLOC')
-
--- set the search path for lua libraries
-texmfmain = kpse.var_value('TEXMFMAIN')
-package.path = texmfmain.."/scripts/texlive/lua/?.tlu"
-require("texlive.utils")
-
--- setup perl once and for all
-perlbin = setupperl()
-
-if arg[1] == 'uninstall' then
- if os.type == 'windows' then
- print ("Please use Add/Remove Programs from the Control Panel to remove TeX Live!")
- os.exit(0);
- end
- print("If you answer yes here the whole TeX Live installation will be removed!")
- io.stdout:write("Remove TeX Live (y/N): ")
- local yesno = io.read()
- if yesno == 'y' or yesno == 'Y' or yesno == 'yes' or yesno == 'YES' then
- print ("Ok, removing the whole installation:")
- -- we have to call perl uninstall-tl.pl AND have to remove the following
- -- files:
- -- TEXDIR/texmf{,-dist,-doc,-var,-config,}, TEXDIR/bin, TEXDIR/tlpkg,
- -- TEXDIR/install-tl.log, TEXMFSYSVAR
- -- that should remove all the stuff
- -- Or other options?
- script = findscript('uninstall-tl.pl')
- if script then
- command = { perlbin, script }
- else
- os.exit(1)
- end
- for i=1, #arg do
- command[#command+1] = arg[i]
- end
- command = fixwin(command)
- ret = os.spawn(command)
- -- here we should check the return value!!!
- if not ret then
- io.stderr:write(filename..': The removal script uninstall-tl.pl returned false\n')
- io.stderr:write(filename..": We don't continue removing stuff\n")
- os.exit(1)
- end
- -- on windows we have now removed the associations etc, while
- -- on unix we have removed the symlinks in case they were present
- --
- -- now we have to remove all the files and directories
- rmtree(TEXDIR.."/texmf-dist")
- rmtree(TEXDIR.."/texmf-doc")
- rmtree(TEXDIR.."/texmf-var")
- rmtree(TEXDIR.."/texmf-config")
- rmtree(TEXDIR.."/texmf")
- rmtree(TEXDIR.."/tlpkg")
- os.remove(TEXDIR.."/temp")
- os.remove(TEXDIR.."/install-tl.log")
- rmtree(TEXDIR.."/bin")
- -- now everything should be removed, try to remove also TEXDIR
- -- this will not succeed on win32 since texlua.exe is still in use
- -- and thus removing TEXDIR/bin will not work. Damned.
- os.remove(TEXDIR)
- os.exit(0)
- else
- print("Ok, cancelling the removal.")
- os.exit(0)
- end
-elseif arg[1] == 'generate' then
- if arg[2] == 'fmtutil' then
- script = findscript('generate-fmtutil.pl')
- if script then
- command = { perlbin, script }
- else
- print("tlmgr: Cannot find generate-fmtutil.pl, strange!")
- os.exit(1)
- end
- elseif arg[2] == 'language' then
- script = findscript('generate-language.pl')
- if script then
- command = { perlbin, script }
- else
- print("tlmgr: Cannot find generate-language.pl, strange!")
- os.exit(1)
- end
- elseif arg[2] == 'updmap' then
- script = findscript('generate-updmap.pl')
- if script then
- command = { perlbin, script }
- else
- print("tlmgr: Cannot find generate-updmap.pl, strange!")
- os.exit(1)
- end
- else
- print ("tlmgr: Unknown or missing argument for generate!")
- os.exit(1)
- end
- -- support plain help
- if arg[3] == 'help' then
- arg[3] = '-help'
- end
-elseif arg[1] == 'paper' or
- arg[1] == 'dvips' or arg[1] == 'xdvi' or arg[1] == 'pdftex' or
- arg[1] == 'dvipdfm' or arg[1] == 'dvipdfmx' then
- -- all changes made via tlmgr paper are global
- script = findscript('texconf.tlu')
- if script then
- command = { 'texlua', script, '--prog', 'tlmgr', '--sys' }
- else
- os.exit(1)
- end
-else
- -- in all other cases we call tl-package-manager for now ...
- script = findscript('tl-package-manager.pl')
- if script then
- command = { perlbin, script }
- else
- os.exit(1)
- end
-end
-
-for i=1, #arg do
- command[#command+1]=arg[i]
-end
-
-command=fixwin(command)
-
-ret=os.spawn(command)
-os.exit(ret)
-
--- Local Variables:
--- perl-indent-level: 2
--- tab-width: 2
--- indent-tabs-mode: nil
--- End:
--- vim:set tabstop=2 expandtab: --
diff --git a/Master/texmf/scripts/texlive/uninstall-tl.pl b/Master/texmf/scripts/texlive/uninstall-tl.pl
deleted file mode 100755
index ca19b63f7dc..00000000000
--- a/Master/texmf/scripts/texlive/uninstall-tl.pl
+++ /dev/null
@@ -1,155 +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 $Master;
-
-BEGIN {
- $^W = 1;
- $Master = `kpsewhich -var-value=SELFAUTOPARENT`;
- chomp($Master);
- unshift (@INC, "$Master/tlpkg");
-}
-
-
-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 $tlpdb = TeXLive::TLPDB->new ("root" => "$Master");
- my $opt_symlinks = 0;
- my ($sys_bin,$sys_info,$sys_man);
- my ($texdir,$texmflocal,$texmfhome,$texmfsysvar);
- if ($tlpdb) {
- $sys_bin = $tlpdb->option_sys_bin;
- $sys_man = $tlpdb->option_sys_man;
- $sys_info= $tlpdb->option_sys_info;
- $opt_symlinks = $tlpdb->option_symlinks;
- $texdir = $Master;
- $texmfhome = `kpsewhich -var-value=TEXMFHOME`; chomp($texmfhome);
- $texmfsysvar = `kpsewhich -var-value=TEXMFSYSVAR`; chomp($texmfsysvar);
- $texmflocal = `kpsewhich -var-value=TEXMFLOCAL`; chomp($texmflocal);
- } 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();
- unsetenv_reg("TEXBINDIR");
- unregister_script_type(".texlua");
- unregister_uninstaller();
- exit if is_vista();
- broadcast_env();
- update_assocs();
- } 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";
- }
- }
- }
-}
-
-
-__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/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm
index 03a5b2e6175..858369d3ba7 100644
--- a/Master/tlpkg/TeXLive/TLWinGoo.pm
+++ b/Master/tlpkg/TeXLive/TLWinGoo.pm
@@ -866,7 +866,7 @@ sub create_uninstaller {
echo Do you really want to remove TeX Live 2008? Type Ctrl-C to abort.
pause
set PERL5LIB=
-\"$td\\tlpkg\\tlperl\\bin\\perl.exe\" \"$td\\texmf\\scripts\\texlive\\uninstall-tl.pl\"
+\"$td\\tlpkg\\tlperl\\bin\\perl.exe\" \"$td\\texmf\\scripts\\texlive\\tlmgr.pl\" uninstallwin32
copy \"$td\\tlpkg\\installer\\uninst2.bat\" \"\%TEMP\%\"
\"\%TEMP\%\\uninst2.bat\"
UNEND