Subversion Repositories camp_sysinfo_client_3

Rev

Rev 57 | 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

my $versionsFile = '/opt/camp/sysinfo-client/VERSION';

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';
}