mirror of https://github.com/sipwise/ngcpcfg.git
Detect NGCP installation using dpkg status Change-Id: I38e9e0d24eed3ecf12d9b95f65c13dacecccf8fachanges/31/3531/8
parent
301cb7cd3c
commit
95051acb23
@ -0,0 +1,29 @@
|
||||
[%
|
||||
# Returns the ngcp_type of the node calling this function.
|
||||
#
|
||||
# @return out one of ['spce', 'sppro', 'carrier']
|
||||
-%]
|
||||
[% PERL -%]
|
||||
use Dpkg;
|
||||
use Dpkg::Index;
|
||||
use Dpkg::Control::Types;
|
||||
|
||||
my $status = Dpkg::Index->new(type => CTRL_INFO_PKG);
|
||||
$status->load("$Dpkg::ADMINDIR/status");
|
||||
|
||||
my $pkg = $status->get_by_key('ngcp-ngcp-ce');
|
||||
if ($pkg->{Status} =~ m/\s+ok\s+installed$/) {
|
||||
$stash->set(out => 'spce');
|
||||
return;
|
||||
}
|
||||
$pkg = $status->get_by_key('ngcp-ngcp-pro');
|
||||
if ($pkg->{Status} =~ m/\s+ok\s+installed$/) {
|
||||
$stash->set(out => 'sppro');
|
||||
return;
|
||||
}
|
||||
$pkg = $status->get_by_key('ngcp-ngcp-carrier');
|
||||
if ($pkg->{Status} =~ m/\s+ok\s+installed$/) {
|
||||
$stash->set(out => 'carrier');
|
||||
return;
|
||||
}
|
||||
[% END -%]
|
||||
Loading…
Reference in new issue