summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-04-17 16:35:50 +0900
committerNorbert Preining <norbert@preining.info>2021-05-09 10:58:46 +0900
commitd07c1842e392c3dc305898cd62333ae724f4d9bf (patch)
treed5b1df8f1c2dd695f6b5fbd0f338274b86e37eed
parente7adfdd20cff7ca275e1383386000088243c1cf9 (diff)
fmtutil/mktexfmt: switch to texmfsysvar if writable
-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 0e68de0e011..e39971a7965 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -4626,6 +4626,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" .