~ubuntu-branches/ubuntu/wily/nagios-plugins-contrib/wily-proposed

« back to all changes in this revision

Viewing changes to check_hpasm/check_hpasm-4.5.2/plugins-scripts/subst.in

  • Committer: Package Import Robot
  • Author(s): Bernd Zeimetz
  • Date: 2013-05-21 22:11:50 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130521221150-k5bda5v5euvt7wg9
Tags: 6.20130521
* [e68c82e1] check_raid: do not run hpacucli if cciss_vol_status is available.
* [4a1c57e8] Also support tw-cli as additional name for the 3ware binary.
  Thanks to Dennis Hoppe
* [eb5e1c7c] Add /run/ to the check_libs ignore file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/awk
2
 
 
3
 
function which(c,path) {
4
 
        cmd = "test -x " c;
5
 
 
6
 
        if (system(cmd)==0) {
7
 
                return c;
8
 
        } 
9
 
 
10
 
        sub(/\/.*\//,"",c);
11
 
  for (dir in path) {
12
 
                        cmd = "test -x " path[dir] "/" c;
13
 
                        if (system(cmd)==0) {
14
 
                                        return path[dir] "/" c;
15
 
                        } 
16
 
        }
17
 
 
18
 
 
19
 
        return c;
20
 
}
21
 
 
22
 
# used to replace "use lib utils.pm" with "use lib @libexecdir"
23
 
#
24
 
function led() {
25
 
        led1 = "@libexecdir@";
26
 
        led2 = "@exec_prefix@";
27
 
        led3 = "@prefix@";
28
 
        if ( match(led1, /^\$\{exec_prefix\}/ ) != 0 ) {
29
 
                return "\"" led3 "/libexec\" " ;
30
 
        
31
 
        }
32
 
        return "\"" led1 "\"" ;
33
 
}
34
 
 
35
 
BEGIN {
36
 
        split(ENVIRON["PATH"] ":/sbin:/usr/sbin",path,/:/);
37
 
 
38
 
}
39
 
 
40
 
# scripting language (first line)
41
 
 
42
 
/^#! ?\/.*\/python/ {sub(/^#! ?\/.*\/python/,"#! @PYTHON@");}
43
 
/^#! ?\/.*\/perl/ {sub(/^#! ?\/.*\/perl/,"#! @PERL@");}
44
 
/^#! ?\/.*\/[a-z]{0,2}awk/ {sub(/^#! ?\/.*\/[a-z]{0,2}awk/,"#! @AWK@");}
45
 
/^#! ?\/.*\/sh/ {sub(/^#! ?\/.*\/sh/,"#! @SHELL@");}
46
 
 
47
 
# add to libexecdir to INC for perl utils.pm
48
 
/^use/ { if (/lib/) { if (/utils.pm|"."/ ) {sub(/utils.pm|"."/,led() )} } }
49
 
 
50
 
 
51
 
# Replace the placeholders with the values from configure
52
 
/#PERL#/ {sub(/#PERL#/,"@PERL@");}
53
 
/my \$NOINSTLEVEL = 'unknown'/ {sub(/unknown/,"@NOINSTLEVEL@");}
54
 
/my \$CELSIUS = 1;/ {sub(/1/,"@CELSIUS@");}
55
 
/my \$PERFDATA = 1;/ {sub(/1/,"@PERFDATA@");}
56
 
/my \$EXTENDEDINFO = 1;/ {sub(/1/,"@EXTENDEDINFO@");}
57
 
/my \$HWINFO = 1;/ {sub(/1/,"@HWINFO@");}
58
 
/my \$HPACUCLI = 1;/ {sub(/1/,"@HPACUCLI@");}
59
 
/version => '.*',/ {sub(/'.*'/,"'@PACKAGE_VERSION@'");}
60
 
 
61
 
{
62
 
        print;
63
 
}
64