#!/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. # you can use either the simple or the advanced batch wrapper, # but it should have the same name as this file, with .bat appended. BEGIN { $^W = 1; require "tlmgr.pl"; } # for debugging: #$::opt_verbosity = 2; # Only make user-level changes even if admin $opts{'w32mode'} = 'user'; # 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(); #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% # optional advanced features. # these make direct use of the modules in tlmgr/TeXlive # and modules loaded by them. # don't need to re-require modules but do need to re-import names 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); # register uninstaller. Failure not fatal. # This really should be the first item. my $Master_bsl = $Master; $Master_bsl =~ s,/,\\,g; 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_bsl\\w32unclient.bat\""; $k->{'/DisplayVersion'} = "2009"; $k->{'/URLInfoAbout'} = "http://ourwebsite.edu/ourtexlive"; } } warn "Failed to register uninstaller\n" unless $k; # add a command-prompt shortcut with TeX Live first item on the path. # note that for TeXworks, the wrapper already takes care of this. add_menu_shortcut( $TeXLive::TLConfig::WindowsMainMenuName, 'TeX Live Prompt', '', 'cmd', "/k \"path $Master_bsl\\bin\\win32;%path%\"", '', );