From e972c3c70a69bff791d4a726fc0798baaf1da4ce Mon Sep 17 00:00:00 2001 From: Victor Seva Date: Fri, 22 Aug 2014 08:44:40 +0200 Subject: [PATCH] MT#8753 protection of run "bin/config_debug.pl on" twice in a row Avoid overwrite config.yml.orig if already exists and don't modify /etc/hosts if is already changed. --- bin/config_debug.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/config_debug.pl b/bin/config_debug.pl index a50ab15a..79ee383b 100755 --- a/bin/config_debug.pl +++ b/bin/config_debug.pl @@ -87,7 +87,7 @@ if (lc($action) eq "off") } else { - copy($file, $file.".orig") or die "Copy failed: $!"; + copy($file, $file.".orig") or die "Copy failed: $!" unless(-e $file.".orig"); $yaml = YAML::Tiny->read($file) or die "File $file could not be read"; $yaml->[0]->{kamailio}{lb}{debug} = 'yes'; $yaml->[0]->{kamailio}{lb}{use_dns_cache} = 'off'; @@ -99,7 +99,7 @@ else tie @array, 'Tie::File', '/etc/hosts' or die ('Can set test domain on /etc/hosts'); for (@array) { - s/127.0.0.1[ \t]+localhost/127.0.0.1 localhost $domain/; + s/127.0.0.1[ \t]+localhost/127.0.0.1 localhost $domain/ unless($_ =~ /$domain/); } untie @array; for my $i ('caller.csv', 'callee.csv')