diff options
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 6941e472548..c6a5b182520 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -1892,24 +1892,29 @@ sub action_update { # cmd line --backup, we check for --backupdir, and if that is not given # we try to get the default from the tlpdb. If that doesn't work, exit. if ($opts{"backup"}) { - my $diebackupdir = 0; + my $diebackupmsg = ""; if (!$opts{"backupdir"}) { - $opts{"backupdir"} = norm_tlpdb_path($localtlpdb->option("backupdir")); + # no path has been specified on the command line, check for settings + # in the local tlpdb + my $tlpdbbackupdir = $localtlpdb->option("backupdir"); + $opts{"backupdir"} = norm_tlpdb_path($tlpdbbackupdir); if ($opts{"backupdir"}) { - # check again: + # ok, something is saved in the tlpdb, but we have to check if + # that directory actually exists $opts{"backupdir"} = abs_path($opts{"backupdir"}); - $diebackupdir = 1 if (! -d $opts{"backupdir"}); + if (!(defined($opts{"backupdir"}) && -d $opts{"backupdir"})) { + $diebackupmsg = "The backup directory\n $tlpdbbackupdir\nas specified in the local TLPDB does not exist, exiting.\n"; + } } else { # not set in the tlpdb, and not set on cmd line, but asked for # --backup - $diebackupdir = 1; + $diebackupmsg = "Backups should be made, but neither on the command line\nnor in the local TLPDB a backup directory has been specified, exiting.\n"; } } # no else branch necessary, we already checked that --backupdir if # given is ok, see above - if ($diebackupdir) { - tlwarn("You have asked for backups, but the backup directory as specified\n"); - tlwarn("in the local TLPDB or the cmd line does not exists, exiting.\n"); + if ($diebackupmsg) { + tlwarn($diebackupmsg); exit 1; } } |