forked from lingej/pnp4nagios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subst.in
executable file
·142 lines (126 loc) · 3.58 KB
/
subst.in
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!@PERL@ -w
my ${prefix}="@prefix@";
my ${exec_prefix}="@exec_prefix@";
my ${datarootdir}="@datarootdir@";
my ${datadir}="@datadir@";
my $PERL="@PERL@";
my $PERL_LIB_PATH="@PERL_LIB_PATH@";
if( $PERL_LIB_PATH ne "no" ){
$PERL_LIB_PATH_CODE = "use lib '".$PERL_LIB_PATH."';";
}else{
$PERL_LIB_PATH = "";
$PERL_LIB_PATH_CODE = "";
}
my $SHELL="@SHELL@";
my $STRIP="@STRIP@";
my $INSTALL="@INSTALL@";
if($INSTALL =~ /^\.\//){
$INSTALL =~ s/^\.\//\.\.\//;
}
my $INSTALL_OPTS="@INSTALL_OPTS@";
my $DEBUG="@DEBUG@";
my $PERFDATA_DIR="@PERFDATA_DIR@";
my $PERFDATA_LOG="@PERFDATA_LOG@";
my $PERFDATA_SPOOL_DIR="@PERFDATA_SPOOL_DIR@";
my $RRDTOOL="@RRDTOOL@";
my $RRDS="@RRDS@";
my $XML_STRUCTURE_VERSION="@XML_STRUCTURE_VERSION@";
my $PKG_REL_DATE="@PKG_REL_DATE@";
my $PKG_VERSION="@PKG_VERSION@";
my $PKG_NAME="@PKG_NAME@";
my $BASE_URL="@BASE_URL@";
my $HTTPD_CONF="@HTTPD_CONF@";
my $init_dir="@init_dir@";
my $npcd_name="@npcd_name@";
my $pp_pl_name="@pp_pl_name@";
my $nagios_user="@nagios_user@";
my $nagios_grp="@nagios_grp@";
my $libexecdir="@libexecdir@"; # put all --with-vars before directories
my $localstatedir="@localstatedir@";
my $KOHANA="@KOHANA@";
my $KOHANA_SYSTEM="@KOHANA_SYSTEM@";
my $libdir="@libdir@";
my $sysconfdir="@sysconfdir@";
my $host_os="@host_os@";
my $ac_configure_args="@ac_configure_args@";
my $sbindir="@sbindir@";
my $bindir="@bindir@";
my $srcdir="@srcdir@";
my $CC="@CC@";
my $CFLAGS="@CFLAGS@";
my $DEFS="@DEFS@";
my $LDFLAGS="@LDFLAGS@";
my $LIBS="@LIBS@";
my $MOD_CFLAGS="@MOD_CFLAGS@";
my $MOD_LDFLAGS="@MOD_LDFLAGS@";
my $CP="@CP@";
while ($f = shift @ARGV) {
if (-x "/bin/mktemp") {
$TEMP = `/bin/mktemp $f.$$.XXXXXX`;
die 'Cannot make temporary file $TEMP' if($?);
chomp $TEMP;
} else {
$XXXXXX = rand;
$TEMP = "$f.$$.$XXXXXX";
}
open(IN,"<$f.in");
open(OUT,">$TEMP") || die 'Cannot make temporary file $TEMP';
while (<IN>) {
s|\@PERL\@|$PERL|g;
s|\@PERL_LIB_PATH\@|$PERL_LIB_PATH|g;
s|\@PERL_LIB_PATH_CODE\@|$PERL_LIB_PATH_CODE|g;
s|\@SHELL\@|$SHELL|g;
s|\@STRIP\@|$STRIP|g;
s|\@INSTALL\@|$INSTALL|g;
s|\@INSTALL_OPTS\@|$INSTALL_OPTS|g;
s|\@DEBUG\@|$DEBUG|g;
s|\@PERFDATA_DIR\@|$PERFDATA_DIR|g;
s|\@PERFDATA_LOG\@|$PERFDATA_LOG|g;
s|\@PERFDATA_SPOOL_DIR\@|$PERFDATA_SPOOL_DIR|g;
s|\@RRDTOOL\@|$RRDTOOL|g;
s|\@RRDS\@|$RRDS|g;
s|\@XML_STRUCTURE_VERSION\@|$XML_STRUCTURE_VERSION|g;
s|\@PKG_REL_DATE\@|$PKG_REL_DATE|g;
s|\@PKG_VERSION\@|$PKG_VERSION|g;
s|\@PKG_NAME\@|$PKG_NAME|g;
s|\@BASE_URL\@|$BASE_URL|g;
s|\@HTTPD_CONF\@|$HTTPD_CONF|g;
s|\@npcd_name\@|$npcd_name|g;
s|\@pp_pl_name\@|$pp_pl_name|g;
s|\@nagios_user\@|$nagios_user|g;
s|\@nagios_grp\@|$nagios_grp|g;
s|\@libexecdir\@|$libexecdir|g; # put all --with-vars before directories
s|\@localstatedir\@|$localstatedir|g;
s|\@KOHANA\@|$KOHANA|g;
s|\@KOHANA_SYSTEM\@|$KOHANA_SYSTEM|g;
s|\@libdir\@|$libdir|g;
s|\@init_dir\@|$init_dir|g;
s|\@sysconfdir\@|$sysconfdir|g;
s|\@datarootdir\@|$datarootdir|g;
s|\@datadir\@|$datadir|g;
s|\@sbindir\@|$sbindir|g;
s|\@bindir\@|$bindir|g;
s|\@srcdir\@|$srcdir|g;
s|\@CC\@|$CC|g;
s|\@CFLAGS\@|$CFLAGS|g;
s|\@DEFS\@|$DEFS|g;
s|\@LDFLAGS\@|$LDFLAGS|g;
s|\@MOD_LDFLAGS\@|$MOD_LDFLAGS|g;
s|\@MOD_CFLAGS\@|$MOD_CFLAGS|g;
s|\@LIBS\@|$LIBS|g;
s|\@CP\@|$CP|g;
s|\@prefix\@|$prefix|g;
s|\@host_os\@|$host_os|g;
s|\@ac_configure_args\@|$ac_configure_args|g;
s|\$\{exec_prefix\}|$exec_prefix|g; # must be next to last
s|\$\{prefix\}|$prefix|g; # must be last
print OUT $_;
}
close IN;
close OUT;
if ((! -e $f) || (`diff $f $TEMP`)) {
`mv $TEMP $f`;
} else {
unlink $TEMP;
}
}