-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsubst.in
86 lines (71 loc) · 2.11 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
#!@PERL@ -w
my ${prefix}="@prefix@";
my ${exec_prefix}="@exec_prefix@";
my ${datarootdir}="@datarootdir@";
my ${datadir}="@datadir@";
my $PERL="@PERL@";
my $INSTALL="@INSTALL@";
if($INSTALL =~ /^\.\//){
$INSTALL =~ s/^\.\//\.\.\//;
}
my $INSTALL_OPTS="@INSTALL_OPTS@";
my $PKG_REL_DATE="@PKG_REL_DATE@";
my $PKG_VERSION="@PKG_VERSION@";
my $PKG_NAME="@PKG_NAME@";
my $HTTPD_CONF="@HTTPD_CONF@";
my $htmurl="@htmurl@";
my $monitoring_user="@monitoring_user@";
my $monitoring_grp="@monitoring_grp@";
my $monitoring_installdir="@MONITORING_INSTALLDIR@";
my $monitoring_libexecdir="@MONITORING_LIBEXECDIR@";
my $basic_authname = "Nagios Access";
if ($monitoring_installdir =~ /icinga/) {
$basic_authname = "Icinga Access";
}
my $htpasswdusers_file="@HTPASSWDUSERS_FILE@";
my $libexecdir="@libexecdir@";
my $sysconfdir="@sysconfdir@";
my $localstatedir="@localstatedir@";
my $logdir="@LOGDIR@";
my $host_os="@host_os@";
my $ac_configure_args="@ac_configure_args@";
my $srcdir="@srcdir@";
# 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|\@monitoring_user\@|$monitoring_user|g;
s|\@monitoring_grp\@|$monitoring_grp|g;
s|\@monitoring_installdir\@|$monitoring_installdir|g;
s|\@monitoring_libexecdir\@|$monitoring_libexecdir|g;
s|\@basic_authname\@|$basic_authname|g;
s|\@htpasswdusers_file\@|$htpasswdusers_file|g;
s|\@libexecdir\@|$libexecdir|g; # put all --with-vars before directories
s|\@localstatedir\@|$localstatedir|g;
s|\@logdir\@|$logdir|g;
s|\@sysconfdir\@|$sysconfdir|g;
s|\@htmurl\@|$htmurl|g;
s|\@datarootdir\@|$datarootdir|g;
s|\@datadir\@|$datadir|g;
s|\@PKG_VERSION\@|$PKG_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;
}
}