Subversion Repositories camp_sysinfo_client_3

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
41 rodolico 1
#!/usr/bin/env perl
2
 
3
use strict;
4
use warnings;
5
 
6
our $VERSION = '1.1';
7
 
8
# sysinfo module for sysinfo client
9
# Author: R. W. Rodolico
10
# Date:   2016-04-08
11
 
12
# Grabs the version of the installed sysinfo-client
13
 
14
my $versionsFile = '/opt/camp/sysinfo-client/VERSION';
15
 
16
exit 1 unless -e $versionsFile;
17
 
18
my $CATEGORY = 'software';
19
 
20
open FILE,"<$versionsFile" or exit 1;
21
my @line =  grep { /sysinfo-client/ } <FILE>;
22
close FILE;
23
 
24
chomp @line;
25
 
26
for ( my $i = 0; $i < @line; $i++ ) {
27
   my ($install, $version ) = split ' ', $line[$i];
28
   if ( $install =~ m|.*/(.*)| ) { $install = $1; }
29
   print "$CATEGORY\t$install\tversion\t$version\n" if $install eq 'sysinfo-client';
30
}