diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-02-28 13:28:33 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2014-02-28 13:28:33 +0100 |
commit | c08d6a429ba0e0cd3642ba2c2fe85687472ee22f (patch) | |
tree | 396a37ae462543f0e28f36501c30796b3eb91249 /plugins-scripts | |
parent | e260efb25690b13002a0bf432507f66bdad90f02 (diff) | |
download | monitoring-plugins-c08d6a429ba0e0cd3642ba2c2fe85687472ee22f.tar.gz |
Replace "plugins-scripts/subst.in" foo
Remove the buggy and complex awk(1) magic in "plugins-scripts/subst.in"
in favor of simple sed(1) substitutions.
The plugins in the "plugins-scripts" directory now always use the PATH
specified via "./configure --trusted-path", or the default PATH
hard-coded in "configure.ac".
Fixes #1242.
Diffstat (limited to 'plugins-scripts')
-rw-r--r-- | plugins-scripts/Makefile.am | 9 | ||||
-rwxr-xr-x | plugins-scripts/check_breeze.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_disk_smb.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_file_age.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_flexlm.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_ifoperstatus.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_ifstatus.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_ircd.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_log.sh | 28 | ||||
-rwxr-xr-x | plugins-scripts/check_mailq.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_mssql.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_netdns.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_ntp.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_oracle.sh | 2 | ||||
-rwxr-xr-x | plugins-scripts/check_rpc.pl | 4 | ||||
-rwxr-xr-x | plugins-scripts/check_sensors.sh | 5 | ||||
-rwxr-xr-x | plugins-scripts/check_wave.pl | 4 | ||||
-rw-r--r-- | plugins-scripts/subst.in | 53 |
18 files changed, 48 insertions, 101 deletions
diff --git a/plugins-scripts/Makefile.am b/plugins-scripts/Makefile.am index 4ea262af..78a950c2 100644 --- a/plugins-scripts/Makefile.am +++ b/plugins-scripts/Makefile.am | |||
@@ -23,6 +23,11 @@ EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \ | |||
23 | check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \ | 23 | check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \ |
24 | utils.sh.in utils.pm.in t | 24 | utils.sh.in utils.pm.in t |
25 | 25 | ||
26 | EDIT = sed \ | ||
27 | -e 's|[@]NP_VERSION[@]|$(NP_VERSION)|g' \ | ||
28 | -e 's|[@]TRUSTED_PATH[@]|$(with_trusted_path)|g' \ | ||
29 | -e 's|[@]PERL[@]|$(PERL)|g' | ||
30 | |||
26 | TESTS_ENVIRONMENT=perl -I $(top_builddir) -I $(top_srcdir) | 31 | TESTS_ENVIRONMENT=perl -I $(top_builddir) -I $(top_srcdir) |
27 | 32 | ||
28 | TESTS = @SCRIPT_TEST@ | 33 | TESTS = @SCRIPT_TEST@ |
@@ -38,11 +43,11 @@ test-debug: | |||
38 | CLEANFILES=$(libexec_SCRIPTS) | 43 | CLEANFILES=$(libexec_SCRIPTS) |
39 | 44 | ||
40 | .pl : | 45 | .pl : |
41 | NP_VERSION=$(NP_VERSION) $(AWK) -f ./subst $< > $@ | 46 | $(EDIT) $< > $@ |
42 | chmod +x $@ | 47 | chmod +x $@ |
43 | 48 | ||
44 | .sh : | 49 | .sh : |
45 | NP_VERSION=$(NP_VERSION) $(AWK) -f ./subst $< > $@ | 50 | $(EDIT) $< > $@ |
46 | chmod +x $@ | 51 | chmod +x $@ |
47 | 52 | ||
48 | clean-local: | 53 | clean-local: |
diff --git a/plugins-scripts/check_breeze.pl b/plugins-scripts/check_breeze.pl index 917a1c6f..38badeb6 100755 --- a/plugins-scripts/check_breeze.pl +++ b/plugins-scripts/check_breeze.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl -wT | 1 | #!@PERL@ -wT |
2 | 2 | ||
3 | 3 | ||
4 | use strict; | 4 | use strict; |
@@ -13,7 +13,7 @@ $PROGNAME = "check_breeze"; | |||
13 | sub print_help (); | 13 | sub print_help (); |
14 | sub print_usage (); | 14 | sub print_usage (); |
15 | 15 | ||
16 | $ENV{'PATH'}='@trusted_path@'; | 16 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
17 | $ENV{'BASH_ENV'}=''; | 17 | $ENV{'BASH_ENV'}=''; |
18 | $ENV{'ENV'}=''; | 18 | $ENV{'ENV'}=''; |
19 | 19 | ||
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl index 36259d59..99948a41 100755 --- a/plugins-scripts/check_disk_smb.pl +++ b/plugins-scripts/check_disk_smb.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl -w | 1 | #!@PERL@ -w |
2 | # | 2 | # |
3 | # | 3 | # |
4 | # check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port] | 4 | # check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port] |
@@ -33,7 +33,7 @@ sub print_usage (); | |||
33 | 33 | ||
34 | $PROGNAME = "check_disk_smb"; | 34 | $PROGNAME = "check_disk_smb"; |
35 | 35 | ||
36 | $ENV{'PATH'}='@trusted_path@'; | 36 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
37 | $ENV{'BASH_ENV'}=''; | 37 | $ENV{'BASH_ENV'}=''; |
38 | $ENV{'ENV'}=''; | 38 | $ENV{'ENV'}=''; |
39 | 39 | ||
diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl index e0280381..5e062deb 100755 --- a/plugins-scripts/check_file_age.pl +++ b/plugins-scripts/check_file_age.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/bin/perl -w | 1 | #!@PERL@ -w |
2 | 2 | ||
3 | # check_file_age.pl Copyright (C) 2003 Steven Grimm <koreth-nagios@midwinter.com> | 3 | # check_file_age.pl Copyright (C) 2003 Steven Grimm <koreth-nagios@midwinter.com> |
4 | # | 4 | # |
@@ -36,7 +36,7 @@ my ($result, $message, $age, $size, $st); | |||
36 | 36 | ||
37 | $PROGNAME="check_file_age"; | 37 | $PROGNAME="check_file_age"; |
38 | 38 | ||
39 | $ENV{'PATH'}='@trusted_path@'; | 39 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
40 | $ENV{'BASH_ENV'}=''; | 40 | $ENV{'BASH_ENV'}=''; |
41 | $ENV{'ENV'}=''; | 41 | $ENV{'ENV'}=''; |
42 | 42 | ||
diff --git a/plugins-scripts/check_flexlm.pl b/plugins-scripts/check_flexlm.pl index de63d3ab..49d674d4 100755 --- a/plugins-scripts/check_flexlm.pl +++ b/plugins-scripts/check_flexlm.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl -w | 1 | #!@PERL@ -w |
2 | # | 2 | # |
3 | # usage: | 3 | # usage: |
4 | # check_flexlm.pl license_file | 4 | # check_flexlm.pl license_file |
@@ -44,7 +44,7 @@ $PROGNAME="check_flexlm"; | |||
44 | sub print_help (); | 44 | sub print_help (); |
45 | sub print_usage (); | 45 | sub print_usage (); |
46 | 46 | ||
47 | $ENV{'PATH'}='@trusted_path@'; | 47 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
48 | $ENV{'BASH_ENV'}=''; | 48 | $ENV{'BASH_ENV'}=''; |
49 | $ENV{'ENV'}=''; | 49 | $ENV{'ENV'}=''; |
50 | 50 | ||
diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl index 159eb62e..1a7fbba4 100755 --- a/plugins-scripts/check_ifoperstatus.pl +++ b/plugins-scripts/check_ifoperstatus.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/local/bin/perl -w | 1 | #!@PERL@ -w |
2 | # | 2 | # |
3 | # check_ifoperstatus.pl - monitoring plugin | 3 | # check_ifoperstatus.pl - monitoring plugin |
4 | # | 4 | # |
@@ -49,7 +49,7 @@ sub usage ($); | |||
49 | sub print_usage (); | 49 | sub print_usage (); |
50 | sub process_arguments (); | 50 | sub process_arguments (); |
51 | 51 | ||
52 | $ENV{'PATH'}='@trusted_path@'; | 52 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
53 | $ENV{'BASH_ENV'}=''; | 53 | $ENV{'BASH_ENV'}=''; |
54 | $ENV{'ENV'}=''; | 54 | $ENV{'ENV'}=''; |
55 | 55 | ||
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl index 4760a281..e9e62149 100755 --- a/plugins-scripts/check_ifstatus.pl +++ b/plugins-scripts/check_ifstatus.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/local/bin/perl -w | 1 | #!@PERL@ -w |
2 | # | 2 | # |
3 | # check_ifstatus.pl - monitoring plugin | 3 | # check_ifstatus.pl - monitoring plugin |
4 | # | 4 | # |
@@ -47,7 +47,7 @@ sub usage ($); | |||
47 | sub print_usage (); | 47 | sub print_usage (); |
48 | sub process_arguments (); | 48 | sub process_arguments (); |
49 | 49 | ||
50 | $ENV{'PATH'}='@trusted_path@'; | 50 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
51 | $ENV{'BASH_ENV'}=''; | 51 | $ENV{'BASH_ENV'}=''; |
52 | $ENV{'ENV'}=''; | 52 | $ENV{'ENV'}=''; |
53 | 53 | ||
diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl index dab65954..c14980c0 100755 --- a/plugins-scripts/check_ircd.pl +++ b/plugins-scripts/check_ircd.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl -wT | 1 | #!@PERL@ -wT |
2 | 2 | ||
3 | # ----------------------------------------------------------------------------- | 3 | # ----------------------------------------------------------------------------- |
4 | # File Name: check_ircd.pl | 4 | # File Name: check_ircd.pl |
@@ -62,7 +62,7 @@ sub bindRemote ($$); | |||
62 | 62 | ||
63 | # -------------------------------------------------------------[ Enviroment ]-- | 63 | # -------------------------------------------------------------[ Enviroment ]-- |
64 | 64 | ||
65 | $ENV{'PATH'}='@trusted_path@'; | 65 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
66 | $ENV{'BASH_ENV'}=''; | 66 | $ENV{'BASH_ENV'}=''; |
67 | $ENV{'ENV'}=''; | 67 | $ENV{'ENV'}=''; |
68 | 68 | ||
diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh index be4c7be1..8653a5e1 100755 --- a/plugins-scripts/check_log.sh +++ b/plugins-scripts/check_log.sh | |||
@@ -58,18 +58,12 @@ | |||
58 | # Paths to commands used in this script. These | 58 | # Paths to commands used in this script. These |
59 | # may have to be modified to match your system setup. | 59 | # may have to be modified to match your system setup. |
60 | 60 | ||
61 | GREP="/bin/egrep" | ||
62 | DIFF="/bin/diff" | ||
63 | TAIL="/bin/tail" | ||
64 | CAT="/bin/cat" | ||
65 | RM="/bin/rm" | ||
66 | CHMOD="/bin/chmod" | ||
67 | TOUCH="/bin/touch" | ||
68 | |||
69 | PROGNAME=`/bin/basename $0` | 61 | PROGNAME=`/bin/basename $0` |
70 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | 62 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` |
71 | REVISION="@NP_VERSION@" | 63 | REVISION="@NP_VERSION@" |
72 | PATH="@trusted_path@" | 64 | PATH="@TRUSTED_PATH@" |
65 | |||
66 | export PATH | ||
73 | 67 | ||
74 | . $PROGPATH/utils.sh | 68 | . $PROGPATH/utils.sh |
75 | 69 | ||
@@ -177,7 +171,7 @@ fi | |||
177 | # the old diff file and exit | 171 | # the old diff file and exit |
178 | 172 | ||
179 | if [ ! -e $oldlog ]; then | 173 | if [ ! -e $oldlog ]; then |
180 | $CAT $logfile > $oldlog | 174 | cat $logfile > $oldlog |
181 | echo "Log check data initialized..." | 175 | echo "Log check data initialized..." |
182 | exit $STATE_OK | 176 | exit $STATE_OK |
183 | fi | 177 | fi |
@@ -191,20 +185,20 @@ if [ -x /bin/mktemp ]; then | |||
191 | else | 185 | else |
192 | tempdiff=`/bin/date '+%H%M%S'` | 186 | tempdiff=`/bin/date '+%H%M%S'` |
193 | tempdiff="/tmp/check_log.${tempdiff}" | 187 | tempdiff="/tmp/check_log.${tempdiff}" |
194 | $TOUCH $tempdiff | 188 | touch $tempdiff |
195 | $CHMOD 600 $tempdiff | 189 | chmod 600 $tempdiff |
196 | fi | 190 | fi |
197 | 191 | ||
198 | $DIFF $logfile $oldlog | $GREP -v "^>" > $tempdiff | 192 | diff $logfile $oldlog | grep -v "^>" > $tempdiff |
199 | 193 | ||
200 | # Count the number of matching log entries we have | 194 | # Count the number of matching log entries we have |
201 | count=`$GREP -c "$query" $tempdiff` | 195 | count=`grep -c "$query" $tempdiff` |
202 | 196 | ||
203 | # Get the last matching entry in the diff file | 197 | # Get the last matching entry in the diff file |
204 | lastentry=`$GREP "$query" $tempdiff | $TAIL -1` | 198 | lastentry=`grep "$query" $tempdiff | tail -1` |
205 | 199 | ||
206 | $RM -f $tempdiff | 200 | rm -f $tempdiff |
207 | $CAT $logfile > $oldlog | 201 | cat $logfile > $oldlog |
208 | 202 | ||
209 | if [ "$count" = "0" ]; then # no matches, exit with no error | 203 | if [ "$count" = "0" ]; then # no matches, exit with no error |
210 | echo "Log check ok - 0 pattern matches found" | 204 | echo "Log check ok - 0 pattern matches found" |
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl index 488cf2f1..df1385d2 100755 --- a/plugins-scripts/check_mailq.pl +++ b/plugins-scripts/check_mailq.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/local/bin/perl -w | 1 | #!@PERL@ -w |
2 | 2 | ||
3 | # check_mailq - check to see how many messages are in the smtp queue awating | 3 | # check_mailq - check to see how many messages are in the smtp queue awating |
4 | # transmittal. | 4 | # transmittal. |
@@ -40,7 +40,7 @@ sub print_help (); | |||
40 | sub print_usage (); | 40 | sub print_usage (); |
41 | sub process_arguments (); | 41 | sub process_arguments (); |
42 | 42 | ||
43 | $ENV{'PATH'}='@trusted_path@'; | 43 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
44 | $ENV{'BASH_ENV'}=''; | 44 | $ENV{'BASH_ENV'}=''; |
45 | $ENV{'ENV'}=''; | 45 | $ENV{'ENV'}=''; |
46 | $PROGNAME = "check_mailq"; | 46 | $PROGNAME = "check_mailq"; |
diff --git a/plugins-scripts/check_mssql.pl b/plugins-scripts/check_mssql.pl index cf23ae82..652a12ad 100755 --- a/plugins-scripts/check_mssql.pl +++ b/plugins-scripts/check_mssql.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl -w | 1 | #!@PERL@ -w |
2 | 2 | ||
3 | # | 3 | # |
4 | # Copyright 2003 Roy Sigurd Karlsbakk | 4 | # Copyright 2003 Roy Sigurd Karlsbakk |
@@ -35,7 +35,7 @@ use strict; | |||
35 | 35 | ||
36 | my $PROGNAME = "check_mssql"; | 36 | my $PROGNAME = "check_mssql"; |
37 | 37 | ||
38 | $ENV{'PATH'}='@trusted_path@'; | 38 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
39 | $ENV{'BASH_ENV'}=''; | 39 | $ENV{'BASH_ENV'}=''; |
40 | $ENV{'ENV'}=''; | 40 | $ENV{'ENV'}=''; |
41 | 41 | ||
diff --git a/plugins-scripts/check_netdns.pl b/plugins-scripts/check_netdns.pl index 6e0d02d1..82939bff 100755 --- a/plugins-scripts/check_netdns.pl +++ b/plugins-scripts/check_netdns.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl -w | 1 | #!@PERL@ -w |
2 | 2 | ||
3 | # Perl version of check_dns plugin which calls DNS directly instead of | 3 | # Perl version of check_dns plugin which calls DNS directly instead of |
4 | # relying on nslookup (which has bugs) | 4 | # relying on nslookup (which has bugs) |
@@ -33,7 +33,7 @@ use utils ; | |||
33 | 33 | ||
34 | my $PROGNAME = "check_netdns"; | 34 | my $PROGNAME = "check_netdns"; |
35 | 35 | ||
36 | $ENV{'PATH'}='@trusted_path@'; | 36 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
37 | $ENV{'BASH_ENV'}=''; | 37 | $ENV{'BASH_ENV'}=''; |
38 | $ENV{'ENV'}=''; | 38 | $ENV{'ENV'}=''; |
39 | 39 | ||
diff --git a/plugins-scripts/check_ntp.pl b/plugins-scripts/check_ntp.pl index cdcbffac..13da939c 100755 --- a/plugins-scripts/check_ntp.pl +++ b/plugins-scripts/check_ntp.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl -w | 1 | #!@PERL@ -w |
2 | # | 2 | # |
3 | # (c)1999 Ian Cass, Knowledge Matters Ltd. | 3 | # (c)1999 Ian Cass, Knowledge Matters Ltd. |
4 | # Read the GNU copyright stuff for all the legalese | 4 | # Read the GNU copyright stuff for all the legalese |
@@ -69,7 +69,7 @@ $PROGNAME="check_ntp"; | |||
69 | sub print_help (); | 69 | sub print_help (); |
70 | sub print_usage (); | 70 | sub print_usage (); |
71 | 71 | ||
72 | $ENV{'PATH'}='@trusted_path@'; | 72 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
73 | $ENV{'BASH_ENV'}=''; | 73 | $ENV{'BASH_ENV'}=''; |
74 | $ENV{'ENV'}=''; | 74 | $ENV{'ENV'}=''; |
75 | 75 | ||
diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh index efa1df19..ceac95dc 100755 --- a/plugins-scripts/check_oracle.sh +++ b/plugins-scripts/check_oracle.sh | |||
@@ -9,7 +9,7 @@ | |||
9 | PROGNAME=`basename $0` | 9 | PROGNAME=`basename $0` |
10 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | 10 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` |
11 | REVISION="@NP_VERSION@" | 11 | REVISION="@NP_VERSION@" |
12 | PATH="@trusted_path@" | 12 | PATH="@TRUSTED_PATH@" |
13 | 13 | ||
14 | . $PROGPATH/utils.sh | 14 | . $PROGPATH/utils.sh |
15 | 15 | ||
diff --git a/plugins-scripts/check_rpc.pl b/plugins-scripts/check_rpc.pl index f7fe0321..cbdeceb4 100755 --- a/plugins-scripts/check_rpc.pl +++ b/plugins-scripts/check_rpc.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/local/bin/perl -w | 1 | #!@PERL@ -w |
2 | # | 2 | # |
3 | # check_rpc plugin for monitoring | 3 | # check_rpc plugin for monitoring |
4 | # | 4 | # |
@@ -37,7 +37,7 @@ sub print_help (); | |||
37 | sub print_usage (); | 37 | sub print_usage (); |
38 | sub in ($$); | 38 | sub in ($$); |
39 | 39 | ||
40 | $ENV{'PATH'}='@trusted_path@'; | 40 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
41 | $ENV{'BASH_ENV'}=''; | 41 | $ENV{'BASH_ENV'}=''; |
42 | $ENV{'ENV'}=''; | 42 | $ENV{'ENV'}=''; |
43 | $ENV{'LC_ALL'}='C'; | 43 | $ENV{'LC_ALL'}='C'; |
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh index 53db9b49..05c64c48 100755 --- a/plugins-scripts/check_sensors.sh +++ b/plugins-scripts/check_sensors.sh | |||
@@ -3,8 +3,9 @@ | |||
3 | PROGNAME=`basename $0` | 3 | PROGNAME=`basename $0` |
4 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | 4 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` |
5 | REVISION="@NP_VERSION@" | 5 | REVISION="@NP_VERSION@" |
6 | TRUSTED_PATH="@trusted_path@" | 6 | PATH="@TRUSTED_PATH@" |
7 | PATH=${TRUSTED_PATH:-"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"} | 7 | |
8 | export PATH | ||
8 | 9 | ||
9 | . $PROGPATH/utils.sh | 10 | . $PROGPATH/utils.sh |
10 | 11 | ||
diff --git a/plugins-scripts/check_wave.pl b/plugins-scripts/check_wave.pl index 51927534..5fa78e33 100755 --- a/plugins-scripts/check_wave.pl +++ b/plugins-scripts/check_wave.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl -wT | 1 | #!@PERL@ -wT |
2 | # | 2 | # |
3 | 3 | ||
4 | 4 | ||
@@ -16,7 +16,7 @@ $PROGNAME = "check_wave"; | |||
16 | sub print_help (); | 16 | sub print_help (); |
17 | sub print_usage (); | 17 | sub print_usage (); |
18 | 18 | ||
19 | $ENV{'PATH'}='@trusted_path@'; | 19 | $ENV{'PATH'}='@TRUSTED_PATH@'; |
20 | $ENV{'BASH_ENV'}=''; | 20 | $ENV{'BASH_ENV'}=''; |
21 | $ENV{'ENV'}=''; | 21 | $ENV{'ENV'}=''; |
22 | 22 | ||
diff --git a/plugins-scripts/subst.in b/plugins-scripts/subst.in deleted file mode 100644 index c730b770..00000000 --- a/plugins-scripts/subst.in +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
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 | BEGIN { | ||
23 | split(ENVIRON["PATH"] ":/sbin:/usr/sbin",path,/:/); | ||
24 | |||
25 | } | ||
26 | |||
27 | # Plugin revision | ||
28 | /@NP_VERSION@/ {sub(/@NP_VERSION@/,ENVIRON["NP_VERSION"]);} | ||
29 | |||
30 | # scripting language (first line) | ||
31 | |||
32 | /^#! ?\/.*\/python/ {sub(/^#! ?\/.*\/python/,"#! @PYTHON@");} | ||
33 | /^#! ?\/.*\/perl/ {sub(/^#! ?\/.*\/perl/,"#! @PERL@");} | ||
34 | /^#! ?\/.*\/[a-z]{0,2}awk/ {sub(/^#! ?\/.*\/[a-z]{0,2}awk/,"#! @AWK@");} | ||
35 | /^#! ?\/.*\/sh/ {sub(/^#! ?\/.*\/sh/,"#! @SHELL@");} | ||
36 | |||
37 | # If a script contains a reference to a fully qualified command, | ||
38 | # subst will replace the fully qualified command with whatever is | ||
39 | # returned from the which subroutine. run before changes to INC to add libexecdir | ||
40 | # FIXME: Prepend executables with a substitution keyword instead. | ||
41 | # | ||
42 | /^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// { | ||
43 | match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/); | ||
44 | c=substr($0,RSTART,RLENGTH); | ||
45 | sub(c,which(c,path)); | ||
46 | } | ||
47 | |||
48 | # Trusted path mechanism | ||
49 | /@trusted_path@/ {sub(/@trusted_path@/,"@with_trusted_path@");} | ||
50 | |||
51 | { | ||
52 | print; | ||
53 | } | ||