dahdi_genconf: Do not fail if pinned/assigned span utilities were not installed.

If you installed dahdi tools and did not specify DAHDI_PINNED=yes on the
makefile, when you run dahdi_genconf you would get an error like the following:

  # dahdi_genconf
  sh: span_types: command not found
  Command failed (status=32512): 'span_types dumpconfig > /etc/dahdi/span-types.conf' at ...

This change allows the generator for span-types.conf and span-assignements.conf
check for the existence of the utilities before attempting to call them.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
This commit is contained in:
Shaun Ruffell 2013-11-14 12:19:45 -06:00
parent bb19620c52
commit 8d9a6bdd80
2 changed files with 12 additions and 0 deletions

View File

@ -23,6 +23,12 @@ sub generate($$$) {
my $gconfig = $self->{GCONFIG};
my $genopts = $self->{GENOPTS};
my @spans = @_;
# If the span_types utilities were not installed we do not want to run
# this generator or report any errors.
system "which span_assignments > /dev/null 2>&1";
return if $?;
warn "Empty configuration -- no spans\n" unless @spans;
rename "$file", "$file.bak"
or $! == 2 # ENOENT (No dependency on Errno.pm)

View File

@ -23,6 +23,12 @@ sub generate($$$) {
my $gconfig = $self->{GCONFIG};
my $genopts = $self->{GENOPTS};
my @spans = @_;
# If the span_types utilities were not installed we do not want to run
# this generator or report any errors.
system "which span_types > /dev/null 2>&1";
return if $?;
warn "Empty configuration -- no spans\n" unless @spans;
rename "$file", "$file.bak"
or $! == 2 # ENOENT (No dependency on Errno.pm)