"Fossies" - the Fresh Open Source Software Archive

Member "install-tl-20231204/texmf-dist/scripts/texlive/uninstall-windows.pl" (19 Feb 2023, 2327 Bytes) of package /linux/misc/install-tl-unx.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/env perl
    2 # $Id: uninstall-win32.pl 63068 2022-04-18 05:58:07Z preining $
    3 # Copyright 2008, 2010, 2011, 2012, 2014 Norbert Preining
    4 #
    5 # GUI for tlmgr
    6 
    7 my $Master;
    8 
    9 BEGIN {
   10   $^W = 1;
   11   $Master = `%COMSPEC% /c kpsewhich -var-value=SELFAUTOPARENT`;
   12   chomp($Master);
   13   unshift (@INC, "$Master/tlpkg");
   14 }
   15 
   16 use TeXLive::TLWinGoo;
   17 use TeXLive::TLPDB;
   18 use TeXLive::TLPOBJ;
   19 use TeXLive::TLConfig;
   20 use TeXLive::TLUtils;
   21 
   22 my $ans;
   23 
   24 if (@ARGV) {
   25   $ans = 0;
   26 } else {
   27   my $askfile = $0;
   28   $askfile =~ s!^(.*)([\\/])([^\\/]*)$!$1$2!;
   29   $askfile .= "uninstq.vbs";
   30   $ans = system("wscript", $askfile);
   31   # 0 means yes
   32 }
   33 if ($ans) {
   34   exit(1);
   35 } else {
   36   doit();
   37 }
   38 
   39 sub doit {
   40   # first we remove the whole bunch of shortcuts and menu entries
   41   # by calling all the post action codes for the installed packages
   42   my $localtlpdb = TeXLive::TLPDB->new ("root" => $Master);
   43   if (!defined($localtlpdb)) {
   44     tlwarn("Cannot load the TLPDB from $Master, are you sure there is an installation?\n");
   45   } else {
   46     # set the mode for windows uninstall according to the setting in
   47     # tlpdb
   48     if (TeXLive::TLWinGoo::admin() && !$localtlpdb->option("w32_multi_user")) {
   49       non_admin();
   50     }
   51     for my $pkg ($localtlpdb->list_packages) {
   52       &TeXLive::TLUtils::do_postaction("remove", $localtlpdb->get_package($pkg),
   53                                    $localtlpdb->option("file_assocs"),
   54                                    $localtlpdb->option("desktop_integration"),
   55                                    $localtlpdb->option("desktop_integration"),
   56                                    $localtlpdb->option("post_code"));
   57     }
   58   }
   59   my $menupath = &TeXLive::TLWinGoo::menu_path();
   60   $menupath =~ s!/!\\!g;
   61   `rmdir /s /q "$menupath\\$TeXLive::TLConfig::WindowsMainMenuName" 2>nul`;
   62 
   63   # remove bindir from PATH settings
   64   TeXLive::TLUtils::w32_remove_from_path("$Master/bin/windows", 
   65     $localtlpdb->option("w32_multi_user"));
   66 
   67   # unsetenv_reg("TEXBINDIR");
   68   # unsetenv_reg("TEXMFSYSVAR");
   69   # unsetenv_reg("TEXMFCNF");
   70   TeXLive::TLWinGoo::unregister_uninstaller(
   71     $localtlpdb->option("w32_multi_user"));
   72   TeXLive::TLWinGoo::broadcast_env();
   73   TeXLive::TLWinGoo::update_assocs();
   74 }
   75 
   76 __END__
   77 
   78 
   79 ### Local Variables:
   80 ### perl-indent-level: 2
   81 ### tab-width: 2
   82 ### indent-tabs-mode: nil
   83 ### End:
   84 # vim:set tabstop=2 expandtab: #