summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2021-04-22 00:44:24 +0000
committerNorbert Preining <preining@logic.at>2021-04-22 00:44:24 +0000
commit58e3c071fae0e33200c1b91bb9f8baf10c6eb280 (patch)
tree5d199ee26c5a495a937e109f33d6d0a268944950
parent228c010e78f7fe6b3606db61f9e55f062dc910ee (diff)
fmtutil/mktexfmt: switch to texmfsysvar if writable
git-svn-id: svn://tug.org/texlive/trunk@58947 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 786c35813cc..63d2dd65440 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -4582,6 +4582,21 @@ sub setup_sys_user_mode {
} elsif ($optsref->{'user'}) {
$texmfconfig = $TEXMFCONFIG;
$texmfvar = $TEXMFVAR;
+ # for fmtutil we try to use TEXMFSYSVAR if it is writable since
+ # stray formats are some of the biggest problems reported
+ if ($prg eq "fmtutil" || $prg eq "mktexfmt") {
+ my $switchit = 0;
+ if (-d "$TEXMFSYSVAR/web2c") {
+ $switchit = 1 if (-w "$TEXMFSYSVAR/web2c");
+ } elsif (-d $TEXMFSYSVAR && -w $TEXMFSYSVAR) {
+ $switchit = 1;
+ }
+ if ($switchit) {
+ # inform about switch, but not for mktexfmt which expects output to be only the format
+ $prg eq "mktexfmt" || info("$prg: using TEXMFSYSVAR instead of TEXMFVAR since it is writable!\n");
+ $texmfvar = $TEXMFSYSVAR;
+ }
+ }
} else {
print STDERR "" .
"$prg [ERROR]: Either -sys or -user mode is required.\n" .