summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLUtils.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2016-05-06 04:11:32 +0000
committerNorbert Preining <preining@logic.at>2016-05-06 04:11:32 +0000
commite1926abfc8b55444fde16c6a69b72592d12d01ec (patch)
treea26471f1a38acbf1f654c985ddaefba581049c14 /Master/tlpkg/TeXLive/TLUtils.pm
parent44db78ef8ba77cd8a5d7d6f1f8e8e71167c205b1 (diff)
don't die in user moder on updmap.cfg write, make backup
git-svn-id: svn://tug.org/texlive/trunk@40911 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm12
1 files changed, 7 insertions, 5 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 5e08a95493a..6fbcff6c5c2 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -191,6 +191,7 @@ BEGIN {
use Cwd;
use Getopt::Long;
use File::Temp;
+use File::Copy qw//;
use TeXLive::TLConfig;
@@ -2727,6 +2728,7 @@ sub _create_config_files {
$tlpdblinesref, @postlines) = @_;
my $root = $tlpdb->root;
my @lines = ();
+ my $usermode = $tlpdb->setting( "usertree" );
if (-r "$root/$headfile") {
# we might be in user mode and do *not* want that the generation
# of the configuration file just boils out.
@@ -2735,11 +2737,7 @@ sub _create_config_files {
@lines = <INFILE>;
close (INFILE);
} else {
- tlwarn("TLUtils::_create_config_files: $root/$headfile missing!\n");
- # TODO
- # if we allow tlmgr generate to generate language.* file in usermode
- # we need to remove the die here!
- die ("Giving up.");
+ die ("Giving up.") if (!$usermode);
}
push @lines, @$tlpdblinesref;
if (defined($localconf) && -r $localconf) {
@@ -2756,6 +2754,10 @@ sub _create_config_files {
push @lines, @postlines;
}
if ($#lines >= 0) {
+ if ($usermode && -e $dest) {
+ tlwarn("Updating $dest, backup copy in $dest.backup\n");
+ File::Copy::copy($dest, "$dest.backup");
+ }
open(OUTFILE,">$dest")
or die("Cannot open $dest for writing: $!");