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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
#!/usr/bin/env perl
# This file is public domain.
my $Master;
BEGIN {
$^W = 1;
$Master = `%COMSPEC% /c kpsewhich -var-value=SELFAUTOPARENT`;
chomp($Master);
unshift (@INC, "$Master/tlpkg");
}
use TeXLive::TLWinGoo;
use TeXLive::TLPDB;
use TeXLive::TLPOBJ;
use TeXLive::TLConfig;
use TeXLive::TLUtils;
sub help {
print <<ENDHELP;
tlaunchmode on
tlaunchmode off
tlaunchmode switches a TeX Live installation between tlaunch mode
and classic mode.
tlaunchmode means:
- a launcher with menus and buttons instead of a submenu
- per-user configuration at first startup.
This configuration can be undone from within the launcher
and from the `Programs and Featurers' Control Panel item.
See the manual for additional details and customization options.
ENDHELP
exit;
}
my $do_lmode = shift;
if (defined $do_lmode) {
if (lc($do_lmode) eq "on") { $do_lmode = 1; }
elsif (lc($do_lmode) eq "off") { $do_lmode = 0; }
else {help; }
} else {
help;
}
die "Launchermode requires Vista or later\n"
unless TeXLive::TLWinGoo::is_vista();
my $localtlpdb = TeXLive::TLPDB->new ("root" => $Master);
die "Need admin permissions; please rerun from elevated command prompt\n"
unless ((!$localtlpdb->option("w32_multi_user") or
TeXLive::TLWinGoo::admin()));
TeXLive::TLWinGoo::non_admin() if (TeXLive::TLWinGoo::admin() &&
!$localtlpdb->option("w32_multi_user"));
if (!defined($localtlpdb)) {
die("Cannot load the TLPDB from $Master\n"); }
my $Masterbsl;
($Masterbsl = $Master) =~ s!/!\\!g;
if ($do_lmode) {
for my $pkg ($localtlpdb->list_packages) {
# uninstall script: `&' before TeXLive
TeXLive::TLUtils::do_postaction("remove", $localtlpdb->get_package($pkg),
$localtlpdb->option("file_assocs"),
$localtlpdb->option("desktop_integration"),
$localtlpdb->option("desktop_integration"),
0);
}
my $menupath = &TeXLive::TLWinGoo::menu_path();
$menupath =~ s!/!\\!g;
`rmdir /s /q "$menupath\\$TeXLive::TLConfig::WindowsMainMenuName" 2>nul`;
# remove bindir from PATH settings
TeXLive::TLUtils::w32_remove_from_path("$Master/bin/win32",
$localtlpdb->option("w32_multi_user"));
# unregister uninstaller
TeXLive::TLWinGoo::unregister_uninstaller(
$localtlpdb->option("w32_multi_user"));
# for multi-user, adjust root texmf.cnf for xetex
if ($localtlpdb->option("w32_multi_user")) {
if (!(-f "$Master/texmf.cnf.orig")) {
`copy /b $Masterbsl\\texmf.cnf $Masterbsl\\texmf.cnf.orig`;
}
if (open (TMF, ">> $Master/texmf.cnf")) {
print TMF "\nFC_CACHEDIR=\$TEXMFVAR/fonts/cache\n";
close(TMF);
}
}
if ($localtlpdb->option("w32_multi_user")) {
`"$Master/bin/win32/tlaunch.exe" admin_inst`;
} else {
`"$Master/bin/win32/tlaunch.exe" user_inst`;
}
} else {
`"$Master/bin/win32/tlaunch.exe" uninst`;
TeXLive::TLWinGoo::create_uninstaller($Master);
TeXLive::TLUtils::w32_add_to_path("$Master/bin/win32",
$localtlpdb->option("w32_multi_user"));
for my $pkg ($localtlpdb->list_packages) {
# uninstall script: `&' before TeXLive
TeXLive::TLUtils::do_postaction("install", $localtlpdb->get_package($pkg),
$localtlpdb->option("file_assocs"),
$localtlpdb->option("desktop_integration"),
$localtlpdb->option("desktop_integration"),
0);
}
TeXLive::TLWinGoo::broadcast_env();
TeXLive::TLWinGoo::update_assocs();
# restore original root texmf.cnf
if (-f "$Master/texmf.cnf.orig") {
chdir $Master;
unlink "texmf.cnf";
sleep 2;
rename "texmf.cnf.orig", "texmf.cnf";
}
if ((-f "$Master/texmf.cnf.orig") || !(-f "$Master/texmf.cnf")) {
print "Failed to restore root $Master/texmf.cnf; do this manually.";
}
}
|