nagios4/subst.in

57 lines
1.3 KiB
Plaintext
Raw Normal View History

2017-05-19 22:22:40 +02:00
#!/usr/bin/perl -w
my ${exec_prefix};
my ${prefix};
2017-05-19 23:37:19 +02:00
my ${datarootdir};
2017-05-19 22:22:40 +02:00
${prefix}="@prefix@";
${exec_prefix}="@exec_prefix@";
2017-05-19 23:37:19 +02:00
${datarootdir}="@datarootdir@";
2017-05-19 22:22:40 +02:00
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|\@nagios_user\@|@nagios_user@|g;
s|\@nagios_grp\@|@nagios_grp@|g;
2019-04-18 17:09:18 +02:00
s|\@subsyslockfile\@|@subsyslockfile@|g;
2017-05-19 22:22:40 +02:00
s|\@libexecdir\@|@libexecdir@|g; # put all --with-vars before directories
s|\@localstatedir\@|@localstatedir@|g;
s|\@sysconfdir\@|@sysconfdir@|g;
s|\@TMPDIR\@|@TMPDIR@|g;
s|\@CHECKRESULTDIR\@|@CHECKRESULTDIR@|g;
s|\@datadir\@|@datadir@|g;
2017-05-19 23:37:19 +02:00
s|\@datarootdir\@|@datarootdir@|g;
2017-05-19 22:22:40 +02:00
s|\@sbindir\@|@sbindir@|g;
s|\@bindir\@|@bindir@|g;
s|\@htmurl\@|@htmurl@|g;
s|\@cgiurl\@|@cgiurl@|g;
s|\@MAIL_PROG\@|@MAIL_PROG@|g;
s|\@VERSION\@|@VERSION@|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;
}
}