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