Rev 69 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#!/usr/bin/env perl
use strict;
use warnings;
our $VERSION = '1.1';
# sysinfo module for sysinfo client
# Author: R. W. Rodolico
# Date: 2016-04-08
# Grabs the version of the installed sysinfo-client
#
# 20171124 RWR
# Modified for FreeBSD
my @install = ( '/opt/camp/sysinfo-client', '/usr/local/opt/camp/sysinfo-client' );
my $installed;
my $versionsFile = 'VERSION';
foreach $installed ( @install ) {
if ( -d $installed ) {
$versionsFile = $installed . '/' . $versionsFile;
}
}
exit 1 unless -e $versionsFile;
my $CATEGORY = 'software';
open FILE,"<$versionsFile" or exit 1;
my @line = grep { /sysinfo-client/ } <FILE>;
close FILE;
chomp @line;
for ( my $i = 0; $i < @line; $i++ ) {
my ($install, $version ) = split ' ', $line[$i];
if ( $install =~ m|.*/(.*)| ) { $install = $1; }
print "$CATEGORY\t$install\tversion\t$version\n" if $install eq 'sysinfo-client';
}