summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2017-04-15 00:12:46 +0000
committerNorbert Preining <preining@logic.at>2017-04-15 00:12:46 +0000
commit15b38c41d0da13e4c1b229c405487df790df5601 (patch)
treee48fedee5d5e4f36ad92c32c70a6f317ef92952d /Master/tlpkg/TeXLive
parente4b714027f49e10d08fd341825ebaa8c5bd8458c (diff)
user/sys mode for fmtutil and updmap
add cmd line options -user require either -user or -sys move check/setup function to TLUtils.pm, reuse in both adjust documentation git-svn-id: svn://tug.org/texlive/trunk@43793 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r--Master/tlpkg/TeXLive/TLConfig.pm8
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm52
2 files changed, 60 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLConfig.pm b/Master/tlpkg/TeXLive/TLConfig.pm
index d10e8fa43e4..45835dc1cf7 100644
--- a/Master/tlpkg/TeXLive/TLConfig.pm
+++ b/Master/tlpkg/TeXLive/TLConfig.pm
@@ -46,6 +46,7 @@ BEGIN {
$ChecksumLength
$ChecksumProgram
$ChecksumExtension
+ $SYSUSERURL
);
@EXPORT = @EXPORT_OK;
}
@@ -218,6 +219,9 @@ $ChecksumProgram = "sha512sum";
# The extension of the checksum file
$ChecksumExtension = "sha512";
+#
+our $SYSUSERURL = 'http://tug.org/texlive/sys-user-scripts.html';
+
1;
@@ -301,6 +305,10 @@ The texmf-tree name that can be relocated, defaults to C<texmf-dist>.
The string that replaces the C<RelocTree> in the tlpdb if a package is
relocated, defaults to C<RELOC>".
+=item C<$TeXLive::TLConfig::SYSUSERURL>
+
+URL pointing to explanations concerning -sys and -user mode.
+
=back
=head1 SEE ALSO
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index a5b58a4791d..e645cc07b12 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -97,6 +97,7 @@ C<TeXLive::TLUtils> -- utilities used in TeX Live infrastructure
TeXLive::TLUtils::report_tlpdb_differences(\%ret);
TeXLive::TLUtils::tlnet_disabled_packages($root);
TeXLive::TLUtils::mktexupd();
+ TeXLive::TLUtils::setup_sys_user_mode($optsref,$tmfc, $tmfsc, $tmfv, $tmfsv);
=head1 DESCRIPTION
@@ -180,6 +181,7 @@ BEGIN {
&report_tlpdb_differences
&setup_persistent_downloads
&mktexupd
+ &setup_sys_user_mode
&nulldev
&get_full_line
&sort_archs
@@ -3980,6 +3982,56 @@ sub mktexupd {
return $hash;
}
+
+=item C<check_sys_user_mode($user,$sys,$tmfc, $tmfsc, $tmfv, $tmfsv)>
+
+=cut
+
+sub setup_sys_user_mode {
+ my ($prg, $optsref, $TEXMFCONFIG, $TEXMFSYSCONFIG,
+ $TEXMFVAR, $TEXMFSYSVAR) = @_;
+
+ if ($optsref->{'user'} && $optsref->{'sys'}) {
+ print STDERR "$prg [ERROR]: only one of -user and -sys can be used.\n";
+ exit(1);
+ }
+
+ # check if we are in *hidden* sys mode, in which case we switch
+ # to sys mode
+ # Nowdays we use -sys switch instead of simply overriding TEXMFVAR
+ # and TEXMFCONFIG
+ # This is used to warn users when they run updmap in usermode the first time.
+ # But it might happen that this script is called via another wrapper that
+ # sets TEXMFCONFIG and TEXMFVAR, and does not pass on the -sys option.
+ # for this case we check whether the SYS and non-SYS variants agree,
+ # and if, then switch to sys mode (with a warning)
+ if (($TEXMFSYSCONFIG eq $TEXMFCONFIG) && ($TEXMFSYSVAR eq $TEXMFVAR)) {
+ if ($optsref->{'user'}) {
+ print STDERR "$prg [ERROR]: -user mode but path setup is -sys type, bailing out.\n";
+ exit(1);
+ }
+ if (!$optsref->{'sys'}) {
+ print STDERR "$prg [WARNING]: hidden sys mode found, switching to sys mode.\n" if (!$optsref->{'quiet'});
+ $optsref->{'sys'} = 1;
+ }
+ }
+
+ my ($texmfconfig, $texmfvar);
+ if ($optsref->{'sys'}) {
+ # we are running as updmap-sys, make sure that the right tree is used
+ $texmfconfig = $TEXMFSYSCONFIG;
+ $texmfvar = $TEXMFSYSVAR;
+ } elsif ($optsref->{'user'}) {
+ $texmfconfig = $TEXMFCONFIG;
+ $texmfvar = $TEXMFVAR;
+ } else {
+ print STDERR "$prg [ERROR]: Either -user or -sys mode is required.\n" .
+ "See $TeXLive::TLConfig::SYSUSERURL for details!\n";
+ exit(1);
+ }
+ return ($texmfconfig, $texmfvar);
+}
+
=back
=cut
1;