File: subst.in

package info (click to toggle)
nagios-plugin-check-multi 0.26-6
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,172 kB
  • sloc: perl: 2,296; makefile: 415; sh: 239
file content (199 lines) | stat: -rw-r--r-- 6,753 bytes parent folder | download | duplicates (7)
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!@PERL@ -w

my $prefix="@prefix@";
my $exec_prefix="@exec_prefix@";

my $CHMOD="@CHMOD@";
my $INSTALL="@INSTALL@"; 
#--- ugly, but I don't know how to handle several subsequent directories.
#--- if someone has an idea... ;)
if ($INSTALL=~/^\.\//) {
	my $pwd=`pwd`; chomp $pwd;
	$INSTALL="$pwd/$INSTALL";
}
my $CM_VERSION=""; 
if (-f "CM_VERSION") {
	$CM_VERSION=`cat CM_VERSION`; 
	chomp $CM_VERSION;
} else {
	$CM_VERSION="undetermined";
}
my $INSTALL_OPTS="@INSTALL_OPTS@";
my $MAILX="@MAILX@";
my $PERL="@PERL@";
my $action_mouseover="@action_mouseover@";
my $add_tag_to_list_entries="@add_tag_to_list_entries@";
my $action_url="@action_url@";
my $child_interval="@child_interval@";
my $client_perl="@client_perl@";
my $nagios_name="@nagios_name@";
my $cancel_before_global_timeout="@cancel_before_global_timeout@";
my $child_timeout="@child_timeout@";
my $collapse=@collapse@;
my $complain_unknown_macros="@complain_unknown_macros@";
my $cmdfile_update_interval="@cmdfile_update_interval@";
my $configure_args="@ac_configure_args@";
my $cumulate_ignore_zero=@cumulate_ignore_zero@;
my $empty_output_is_unknown=@empty_output_is_unknown@;
my $ethtool="@ethtool@";
my $exec_open3=@exec_open3@;
my $extinfo_in_status=@extinfo_in_status@;
my $extended_perfdata="@extended_perfdata@";
my $feed_passive_autocreate=@feed_passive_autocreate@;
my $feed_passive_dir_permissions="@feed_passive_dir_permissions@";
my $file_extension="@file_extension@";
my $findbin=@findbin@;
my $gunzip="@gunzip@";
my $hostname="@hostname@";
my $ignore_missing_cmd_file="@ignore_missing_cmd_file@";
my $illegal_chars="@illegal_chars@";
my $image_path="@image_path@";
my $indent="@indent@";
my $indent_label=@indent_label@;
my $livestatus="@livestatus@";
my $name="@name@";
my $no_checks_rc=@no_checks_rc@;
my $notes_url="@notes_url@";
my $objects_cache="@objects_cache@";
my $objects_cache_delimiter="@objects_cache_delimiter@";
my $omd_environment=@omd_environment@;
my $parent_timeout=@parent_timeout@;
my $perfdata_pass_through=@perfdata_pass_through@;
my $persistent=@persistent@;
my $plugin_path="@plugin_path@";
my $pnp_add2url="@pnp_add2url@";
my $pnp_url="@pnp_url@";
my $pnp_version="@pnp_version@";
my $report="@report@";
my $report_inherit_mask="@report_inherit_mask@";
my $service_definition_template="@service_definition_template@";
my $signal_rc="@signal_rc@";
my $loose_perfdata="@loose_perfdata@";
my $snmp_community="@snmp_community@";
my $snmp_port="@snmp_port@";
my $style_plus_minus="@style_plus_minus@";
my $status_dat="@status_dat@";
my $tag_notes_link="@tag_notes_link@";
my $target="@target@";
my $tmp_dir="@tmp_dir@";
my $tmp_dir_permissions="@tmp_dir_permissions@";
my $tmp_etc="@tmp_etc@";
my $verbose="@verbose@";
my $ac_configure_args="@ac_configure_args@";
my $bindir="@bindir@";
my $checkresults_dir="@checkresults_dir@";
my $config_dir="@config_dir@";
my $contrib_dir="@contrib_dir@";
my $datarootdir="@datarootdir@";
my $feed_passive_dir="@feed_passive_dir@";
my $libdir="@libdir@";
my $libexecdir="@libexecdir@";
my $localstatedir="@localstatedir@";
my $sbindir="@sbindir@";
my $srcdir="@srcdir@";
my $sysconfdir="@sysconfdir@";

while (my $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 input file $f.in:$!";
	open(OUT,">${TEMP}") || die "Cannot write to temporary file ${TEMP}:$!";

	while (<IN>) {
		s|\@CHMOD\@|$CHMOD|g;
		s|\@CM_VERSION\@|$CM_VERSION|g;
		s|\@INSTALL\@|$INSTALL|g;
		s|\@INSTALL_OPTS\@|$INSTALL_OPTS|g;
		s|\@MAILX\@|$MAILX|g;
		s|\@PERL\@|$PERL|g;
		s|\@action_mouseover\@|$action_mouseover|g;
		s|\@add_tag_to_list_entries\@|$add_tag_to_list_entries|g;
		s|\@action_url\@|$action_url|g;
		s|\@cancel_before_global_timeout\@|$cancel_before_global_timeout|g;
		s|\@child_interval\@|$child_interval|g;
		s|\@client_perl\@|$client_perl|g;
		s|\@child_timeout\@|$child_timeout|g;
		s|\@collapse\@|$collapse|g;
		s|\@cumulate_ignore_zero\@|$cumulate_ignore_zero|g;
		s|\@cmdfile_update_interval\@|$cmdfile_update_interval|g;
		s|\@configure_args\@|$ac_configure_args|g;
		s|\@config_dir\@|$config_dir|g;
		s|\$\{contrib_dir\}|$contrib_dir|g;
		s|\@empty_output_is_unknown\@|$empty_output_is_unknown|g;
		s|\@ethtool\@|$ethtool|g;
		s|\@exec_open3\@|$exec_open3|g;
		s|\@extinfo_in_status\@|$extinfo_in_status|g;
		s|\@extended_perfdata\@|$extended_perfdata|g;
		s|\@feed_passive_autocreate\@|$feed_passive_autocreate|g;
		s|\@feed_passive_dir\@|$feed_passive_dir|g;
		s|\@feed_passive_dir_permissions\@|$feed_passive_dir_permissions|g;
		s|\@file_extension\@|$file_extension|g;
		s|\@findbin\@|$findbin|g;
		s|\@gunzip\@|$gunzip|g;
		s|\@hostname\@|$hostname|g;
		s|\@ignore_missing_cmd_file\@|$ignore_missing_cmd_file|g;
		s|\@illegal_chars\@|$illegal_chars|g;
		s|\@indent_label\@|$indent_label|g;
		s|\@indent\@|$indent|g;
		s|\@livestatus\@|$livestatus|g;
		s|\@nagios_name\@|$nagios_name|g;
		s|\@name\@|$name|g;
		s|\@no_checks_rc\@|$no_checks_rc|g;
		s|\@notes_url\@|$notes_url|g;
		s|\@objects_cache\@|$objects_cache|g;
		s|\@objects_cache_delimiter\@|$objects_cache_delimiter|g;
		s|\@omd_environment\@|$omd_environment|g;
		s|\@perfdata_pass_through\@|$perfdata_pass_through|g;
		s|\@persistent\@|$persistent|g;
		s|\@pnp_url\@|$pnp_url|g;
		s|\@pnp_add2url\@|$pnp_add2url|g;
		s|\@pnp_version\@|$pnp_version|g;
		s|\@complain_unknown_macros\@|$complain_unknown_macros|g;
		s|\@report\@|$report|g;
		s|\@report_inherit_mask\@|$report_inherit_mask|g;
		s|\@loose_perfdata\@|$loose_perfdata|g;
		s|\@service_definition_template\@|$service_definition_template|g;
		s|\@signal_rc\@|$signal_rc|g;
		s|\@snmp_community\@|$snmp_community|g;
		s|\@snmp_port\@|$snmp_port|g;
		s|\@style_plus_minus\@|$style_plus_minus|g;
		s|\@status_dat\@|$status_dat|g;
		s|\@tag_notes_link\@|$tag_notes_link|g;
		s|\@target\@|$target|g;
		s|\@tmp_dir\@|$tmp_dir|g;
		s|\@tmp_etc\@|$tmp_etc|g;
		s|\@tmp_dir_permissions\@|$tmp_dir_permissions|g;
		s|\@parent_timeout\@|$parent_timeout|g;
		s|\@verbose\@|$verbose|g;
		s|\@sbindir\@|$sbindir|g;		# put all --with-vars before directories
		s|\@checkresults_dir\@|$checkresults_dir|g;
		s|\@sysconfdir\@|$sysconfdir|g;
		s|\@datarootdir\@|$datarootdir|g;
		s|\@image_path\@|$image_path|g;		
		s|\@localstatedir\@|$localstatedir|g;
		s|\@libexecdir\@|$libexecdir|g;	
		s|\@plugin_path\@|$plugin_path|g;		
		s|\$\{exec_prefix\}|$exec_prefix|g;	# must be next to last
		s|\@prefix\@|@prefix@|g;		# must be 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;
	}

}