nagios-business-process-addon/subst.in

72 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

2017-04-22 08:30:21 +02:00
#!@PERL@ -w
my ${exec_prefix};
my ${prefix};
my ${datarootdir};
my ${nagetc};
#my ${cgidir};
#my ${langdir};
${prefix}="@prefix@";
${exec_prefix}="@exec_prefix@";
${nagetc}="@nagetc@";
#${cgidir}="@cgidir@";
#${langdir}="@langdir@";
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|\@nagiosbp_user\@|@nagiosbp_user@|g;
s|\@nagiosbp_grp\@|@nagiosbp_grp@|g;
# s|\@lockfile\@|@lockfile@|g;
s|\@libexecdir\@|@libexecdir@|g; # put all --with-vars before directories
s|\@localstatedir\@|@localstatedir@|g;
s|\@libdir\@|@libdir@|g;
s|\@sysconfdir\@|@sysconfdir@|g;
# s|\@TMPDIR\@|@TMPDIR@|g;
# s|\@CHECKRESULTDIR\@|@CHECKRESULTDIR@|g;
s|\@datarootdir\@|@datadir@|g;
s|\@datadir\@|@datadir@|g;
#s|\@cgidir\@|@cgidir@|g;
s|\@sbindir\@|@sbindir@|g;
s|\@bindir\@|@bindir@|g;
s|\@htmurl\@|@htmurl@|g;
s|\@naghtmurl\@|@naghtmurl@|g;
s|\@nagcgiurl\@|@nagcgiurl@|g;
s|\@cgiurl\@|@cgiurl@|g;
s|\@nagetc\@|@nagetc@|g;
s|\@apache_user\@|@apache_user@|g;
s|\@CRON_D_DIR\@|@CRON_D_DIR@|g;
# s|\@langdir\@|@langdir@|g;
# s|\@MAIL_PROG\@|@MAIL_PROG@|g;
# s|\@VERSION\@|@VERSION@|g;
s|\@apache_authname\@|@apache_authname@|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;
}
}