diff options
author | Norbert Preining <preining@logic.at> | 2017-04-15 00:12:46 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2017-04-15 00:12:46 +0000 |
commit | 15b38c41d0da13e4c1b229c405487df790df5601 (patch) | |
tree | e48fedee5d5e4f36ad92c32c70a6f317ef92952d /Master/tlpkg/TeXLive/TLUtils.pm | |
parent | e4b714027f49e10d08fd341825ebaa8c5bd8458c (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/TLUtils.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 52 |
1 files changed, 52 insertions, 0 deletions
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; |