summaryrefslogtreecommitdiff
path: root/Master/tlpkg/doc/w32client
blob: 48a2ad1ef379084c0df720ceaf5b3b9b782455ef (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
#!/usr/bin/env perl

# Tlmgr.pl can be loaded either by itself, as a program, or as a library,
# at least under Windows.
# An application of this is configuring a client Windows workstation
# for a pre-installed TeX Live installation on a local network.

# Public domain.

# We try to use high-level code, but loading tlmgr.pl also gives as access
# to lower-level code from modules in <root>/tlmgr/TeXlive
# and from modules loaded by them.

BEGIN {
  $^W = 1;
  require "tlmgr.pl";

  # don't need to re-require modules but do need to re-import names;
  # sorry for the mess
  Win32::TieRegistry->import( qw( $Registry
    REG_SZ REG_EXPAND_SZ  KEY_READ KEY_WRITE KEY_ALL_ACCESS
       KEY_ENUMERATE_SUB_KEYS ) );
  $Registry->Delimiter('/');
  $Registry->ArrayValues(0);
  $Registry->FixSzNulls(1);
  Win32::Shortcut->import( qw( SW_SHOWNORMAL SW_SHOWMINNOACTIVE ) );
}

# some examples of accessing tlmgr functionality

# Print some info
#print "Version:\n" . give_version() . "\n";
#print "Mirror:\n" . give_ctan_mirror() . "\n";
#print "Master: " . $Master ."\n";

# for debugging:
#$::opt_verbosity = 2;

# Only make user-level changes even if admin
$opts{'w32mode'} = 'user';

# register uninstaller. Failure not fatal.
my $rootkey = $Registry -> Open("CUser",
  {Access => Win32::TieRegistry::KEY_ALL_ACCESS()});
my $k;
if ($rootkey) {
  $k = $rootkey->CreateKey(
    "software/microsoft/windows/currentversion/uninstall/OurTeXLive/");
  if ($k) {
    $k->{"/DisplayName"} = "OurTeXLive 2009";
    $k->{"/UninstallString"} = "\"$Master\\w32unclient.bat\"";
    $k->{'/DisplayVersion'} = "2009";
    $k->{'/URLInfoAbout'} = "http://ourwebsite.edu/ourtexlive";
  }
}
warn "Failed to register uninstaller\n" unless $k;

# The action_... functions read their arguments from @ARGV.

# Add TeX Live to path
unshift @ARGV, 'add';
action_path();

# create some shortcuts
unshift @ARGV, 'install', 'shortcut',
  'dviout.win32', 'texworks', 'texlive-en', 'tlpsv.win32';
action_postaction();

# File associations. 1: only new; 2: always, overriding existing settings
$opts{'fileassocmode'} = 1;
unshift @ARGV, 'install', 'fileassoc',
  'dviout.win32', 'tlpsv.win32', 'texworks.win32';
action_postaction();
TeXLive::TLWinGoo::update_assocs(); # optional

# xetex font cache
unshift @ARGV, 'install', 'script', 'xetex';
action_postaction();