From 6b2ce22416996077a4e7ea337d95e8e276231119 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 3 Aug 2021 21:55:56 +0000 Subject: ($first_time_usermode_warning): another global to determine whether to output the "you are switching to usermode" warning. (main): if the determined $texmfvar matches $TEXMFSYSVAR (mktexfmt case), set the new variable. Since we are not in fact switching to usermode in this case. (callback_build_formats): don't issue the warning if the new variable is set. Other minor doc/style tweaks. git-svn-id: svn://tug.org/texlive/trunk@60154 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/scripts/texlive/fmtutil.pl | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'Master/texmf-dist/scripts/texlive') diff --git a/Master/texmf-dist/scripts/texlive/fmtutil.pl b/Master/texmf-dist/scripts/texlive/fmtutil.pl index b2c21473b04..a32ada7fc2b 100755 --- a/Master/texmf-dist/scripts/texlive/fmtutil.pl +++ b/Master/texmf-dist/scripts/texlive/fmtutil.pl @@ -8,7 +8,7 @@ # or any later version. # # History: -# Original shell script (C) 2001 Thomas Esser, public domain +# Original shell script 2001 Thomas Esser, public domain my $TEXMFROOT; @@ -61,6 +61,7 @@ my @deferred_stdout; # $::opt_verbosity = 3; # manually enable debugging my $first_time_creation_in_usermode = 0; +my $first_time_usermode_warning = 1; # give lengthy warning if warranted? my $DRYRUN = ""; my $STATUS_FH; @@ -237,14 +238,22 @@ sub main { $DRYRUN = "echo " if ($opts{'dry-run'}); - if ($opts{'status-file'}) { - open $STATUS_FH, '>>', $opts{'status-file'} - || printf STDERR "Cannot open status-file: $opts{'status-file'}\nWill not write status information!\n"; + if ($opts{'status-file'} && ! $opts{'dry-run'}) { + if (! open($STATUS_FH, '>>', $opts{'status-file'})) { + print_error("cannot open status file >>$opts{'status-file'}: $!\n"); + print_error("not writing status information!\n"); + } } + # get the config/var trees we will use. ($texmfconfig, $texmfvar) = TeXLive::TLUtils::setup_sys_user_mode($prg, \%opts, $TEXMFCONFIG, $TEXMFSYSCONFIG, $TEXMFVAR, $TEXMFSYSVAR); + + # if we are using the sys tree, we don't want to give the usermode warning. + if ($texmfvar eq $TEXMFSYSVAR) { + $first_time_usermode_warning = 0; + } determine_config_files("fmtutil.cnf"); my $changes_config_file = $alldata->{'changes_config'}; @@ -338,7 +347,8 @@ sub main { } if ($STATUS_FH) { - close($STATUS_FH) || print STDERR "Cannot close fh for $opts{'status-file'}.\n"; + close($STATUS_FH) + || print_error("cannot close $opts{'status-file'}: $!\n"); } unless ($opts{'nohash'}) { @@ -517,7 +527,8 @@ sub callback_build_formats { # In case of user mode and formats rebuilt, warn that these formats # will shadow future updates. Can be suppressed with --quiet which # does not show print_info output - if ($opts{'user'} && $suc && $first_time_creation_in_usermode) { + if ($opts{'user'} && $suc && $first_time_creation_in_usermode + && $first_time_usermode_warning) { print_info(" ************************************************************* * * -- cgit v1.2.3