diff options
author | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-03-18 05:15:04 (GMT) |
---|---|---|
committer | Subhendu Ghosh <sghosh@users.sourceforge.net> | 2002-03-18 05:15:04 (GMT) |
commit | 91753bfdd4a0feab4970cf6eaac8085959140232 (patch) | |
tree | ce00bb17bdd66302570a8290643e45f160e2212d | |
parent | 652cb86d5109c322a5ec3109da8bd7dd652a2974 (diff) | |
download | monitoring-plugins-91753bfdd4a0feab4970cf6eaac8085959140232.tar.gz |
function to update perl plugin scripts to find utils.pm
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@8 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | plugins-scripts/subst.in | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins-scripts/subst.in b/plugins-scripts/subst.in index cc0fd1b..9140157 100644 --- a/plugins-scripts/subst.in +++ b/plugins-scripts/subst.in | |||
@@ -19,8 +19,22 @@ function which(c,path) { | |||
19 | return c; | 19 | return c; |
20 | } | 20 | } |
21 | 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 | |||
22 | BEGIN { | 35 | BEGIN { |
23 | split(ENVIRON["PATH"] ":/sbin:/usr/sbin",path,/:/); | 36 | split(ENVIRON["PATH"] ":/sbin:/usr/sbin",path,/:/); |
37 | |||
24 | } | 38 | } |
25 | 39 | ||
26 | # scripting language (first line) | 40 | # scripting language (first line) |
@@ -30,6 +44,10 @@ BEGIN { | |||
30 | /^#! ?\/.*\/[a-z]{0,2}awk/ {sub(/^#! ?\/.*\/[a-z]{0,2}awk/,"#! @AWK@");} | 44 | /^#! ?\/.*\/[a-z]{0,2}awk/ {sub(/^#! ?\/.*\/[a-z]{0,2}awk/,"#! @AWK@");} |
31 | /^#! ?\/.*\/sh/ {sub(/^#! ?\/.*\/sh/,"#! @SHELL@");} | 45 | /^#! ?\/.*\/sh/ {sub(/^#! ?\/.*\/sh/,"#! @SHELL@");} |
32 | 46 | ||
47 | # add to libexecdir to INC for perl utils.pm | ||
48 | /^use/ { if (/lib/) { if (/utils.pm/ ) {sub(/utils.pm/,led() )} } } | ||
49 | |||
50 | |||
33 | # Trusted path mechanism (deprecated) | 51 | # Trusted path mechanism (deprecated) |
34 | 52 | ||
35 | /^[ \t]*\$ENV[ \t]*\{[ \t'"]*PATH[ \t"']*\}[ \t]*=/ { | 53 | /^[ \t]*\$ENV[ \t]*\{[ \t'"]*PATH[ \t"']*\}[ \t]*=/ { |