forked from Icinga/icinga-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subst.in
executable file
·73 lines (65 loc) · 2.02 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
#!/usr/bin/perl -w
my ${exec_prefix};
my ${prefix};
${prefix}="@prefix@";
${exec_prefix}="@exec_prefix@";
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") || die "Cannot open template file $f.in";
open(OUT,">$TEMP") || die "Cannot open temporary file $TEMP";
while (<IN>) {
s|\@icinga_user\@|@icinga_user@|g;
s|\@icinga_grp\@|@icinga_grp@|g;
s|\@lockfile\@|@lockfile@|g;
s|\@libexecdir\@|@libexecdir@|g; # put all --with-vars before directories
s|\@localstatedir\@|@localstatedir@|g;
s|\@sysconfdir\@|@sysconfdir@|g;
s|\@LOGDIR\@|@LOGDIR@|g;
s|\@DISABLECOMPRESSEDLOGS\@|@DISABLECOMPRESSEDLOGS@|g;
s|\@STATEDIR\@|@STATEDIR@|g;
s|\@ENABLECGILOG\@|@ENABLECGILOG@|g;
s|\@ENABLEPERFDATA\@|@ENABLEPERFDATA@|g;
s|\@CGILOGDIR\@|@CGILOGDIR@|g;
s|\@PLUGINDIR\@|@PLUGINDIR@|g;
s|\@EVENTHANDLERDIR\@|@EVENTHANDLERDIR@|g;
s|\@TMPDIR\@|@TMPDIR@|g;
s|\@HTTPAUTHFILE\@|@HTTPAUTHFILE@|g;
s|\@TMPFILE\@|@TMPFILE@|g;
s|\@EXTCMDFILEDIR\@|@EXTCMDFILEDIR@|g;
s|\@P1FILELOC\@|@P1FILELOC@|g;
s|\@ICINGACHKFILE\@|@ICINGACHKFILE@|g;
s|\@IDOSOCKFILE\@|@IDOSOCKFILE@|g;
s|\@IDO2DBLOCKFILE\@|@IDO2DBLOCKFILE@|g;
s|\@IDOMODTMPFILE\@|@IDOMODTMPFILE@|g;
s|\@IDO_INSTANCE_NAME\@|@IDO_INSTANCE_NAME@|g;
s|\@CHECKRESULTDIR\@|@CHECKRESULTDIR@|g;
s|\@LIBDBIDRIVERDIR\@|@LIBDBIDRIVERDIR@|g;
s|\@CLASSICUI_STANDALONE_FLAG\@|@CLASSICUI_STANDALONE_FLAG@|g;
s|\@datadir\@|@datarootdir@|g;
s|\@sbindir\@|@sbindir@|g;
s|\@bindir\@|@bindir@|g;
s|\@libdir\@|@libdir@|g;
s|\@htmurl\@|@htmurl@|g;
s|\@cgiurl\@|@cgiurl@|g;
s|\@mainurl\@|@mainurl@|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;
}
}