diff options
Diffstat (limited to 'plugins-scripts/subst.in')
-rw-r--r-- | plugins-scripts/subst.in | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/plugins-scripts/subst.in b/plugins-scripts/subst.in deleted file mode 100644 index a70ad884..00000000 --- a/plugins-scripts/subst.in +++ /dev/null | |||
@@ -1,78 +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 | # 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 | # Plugin revision | ||
41 | /@NP_VERSION@/ {sub(/@NP_VERSION@/,ENVIRON["NP_VERSION"]);} | ||
42 | |||
43 | # scripting language (first line) | ||
44 | |||
45 | /^#! ?\/.*\/python/ {sub(/^#! ?\/.*\/python/,"#! @PYTHON@");} | ||
46 | /^#! ?\/.*\/perl/ {sub(/^#! ?\/.*\/perl/,"#! @PERL@");} | ||
47 | /^#! ?\/.*\/[a-z]{0,2}awk/ {sub(/^#! ?\/.*\/[a-z]{0,2}awk/,"#! @AWK@");} | ||
48 | /^#! ?\/.*\/sh/ {sub(/^#! ?\/.*\/sh/,"#! @SHELL@");} | ||
49 | |||
50 | # If a script contains a reference to a fully qualified command, | ||
51 | # subst will replace the fully qualified command with whatever is | ||
52 | # returned from the which subroutine. run before changes to INC to add libexecdir | ||
53 | # FIXME: Prepend executables with a substitution keyword instead. | ||
54 | # | ||
55 | /^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// { | ||
56 | match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/); | ||
57 | c=substr($0,RSTART,RLENGTH); | ||
58 | sub(c,which(c,path)); | ||
59 | } | ||
60 | |||
61 | # add to libexecdir to INC for perl utils.pm | ||
62 | /^use/ { if (/lib/) { if (/utils.pm|"."/ ) {sub(/utils.pm|"."/,led() )} } } | ||
63 | |||
64 | |||
65 | # Trusted path mechanism (deprecated) | ||
66 | |||
67 | /^[ \t]*\$ENV[ \t]*\{[ \t'"]*PATH[ \t"']*\}[ \t]*=/ { | ||
68 | sub(/\=[ \t]*['"][^"']+["']/,"='@with_trusted_path@' # autoconf-derived"); | ||
69 | } | ||
70 | |||
71 | /^[\t ]*(export[\t ]*)?PATH[\t ]*=['"]+.+["']$/ { | ||
72 | sub(/\=.*$/,"='@with_trusted_path@' # autoconf-derived"); | ||
73 | } | ||
74 | |||
75 | { | ||
76 | print; | ||
77 | } | ||
78 | |||