This repository has been archived by the owner on Mar 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile.in
350 lines (311 loc) · 13.7 KB
/
Makefile.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
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
#
# Makefile for LConf
#
# version info
VERSION=@PKG_VERSION@
TARBALL_NAME=LConf
# path settings
prefix = @prefix@
exec_prefix = @exec_prefix@
EXEC_DIR=@exec_dir@
PREFIX=@prefix@
PREFIX_QUOTED=`echo $(PREFIX) | sed s/\\\\//\\\\\\\\\\\\//g`
SYSCONF_DIR=@sysconfdir@
SYSCONF_DIR_QUOTED=`echo $(SYSCONF_DIR) | sed s/\\\\//\\\\\\\\\\\\//g`
LIB_DIR=@libdir@
LIB_DIR_QUOTED=`echo $(LIB_DIR) | sed s/\\\\//\\\\\\\\\\\\//g`
BIN_DIR=@bindir@
BIN_DIR_QUOTED=`echo $(BIN_DIR) | sed s/\\\\//\\\\\\\\\\\\//g`
LOCALSTATE_DIR=@localstatedir@
LOCALSTATE_DIR_QUOTED=`echo $(LOCALSTATE_DIR) | sed s/\\\\//\\\\\\\\\\\\//g`
TMP_DIR=@TMPDIR@
TMP_DIR_QUOTED=`echo $(TMP_DIR) | sed s/\\\\//\\\\\\\\\\\\//g`
TREE_REWRITE_METHOD=@TREEREWRITEMETHOD@
TREE_REWRITE_METHOD_QUOTED=`echo $(TREE_REWRITE_METHOD) | sed s/\\\\//\\\\\\\\\\\\//g`
SLAVESYNC__LOCAL_DIR=@SLAVESYNC_LOCAL_DIR@
SLAVESYNC__LOCAL_DIR_QUOTED=`echo $(SLAVESYNC__LOCAL_DIR) | sed s/\\\\//\\\\\\\\\\\\//g`
SLAVESYNC__REMOTE_DIR=@SLAVESYNC_REMOTE_DIR@
SLAVESYNC__REMOTE_DIR_QUOTED=`echo $(SLAVESYNC__REMOTE_DIR) | sed s/\\\\//\\\\\\\\\\\\//g`
SLAVESYNC__CHECKRESULT_SPOOL_DIR=@SLAVESYNC_CHECKRESULT_SPOOL_DIR@
SLAVESYNC__CHECKRESULT_SPOOL_DIR_QUOTED=`echo $(SLAVESYNC__CHECKRESULT_SPOOL_DIR) | sed s/\\\\//\\\\\\\\\\\\//g`
SLAVESYNC__EXTCMD_PIPE_PATH=@SLAVESYNC_EXTCMD_PIPE_PATH@
SLAVESYNC__EXTCMD_PIPE_PATH_QUOTED=`echo $(SLAVESYNC__EXTCMD_PIPE_PATH) | sed s/\\\\//\\\\\\\\\\\\//g`
SLAVESYNC__PID_FILE=@SLAVESYNC_PID_FILE@
SLAVESYNC__PID_FILE_QUOTED=`echo $(SLAVESYNC__PID_FILE) | sed s/\\\\//\\\\\\\\\\\\//g`
SLAVESYNC__LOG_DIR=@SLAVESYNC_LOG_DIR@
SLAVESYNC__LOG_DIR_QUOTED=`echo $(SLAVESYNC__LOG_DIR) | sed s/\\\\//\\\\\\\\\\\\//g`
EXPORT_SCRIPT_DIR=@EXPORTSCRIPTDIR@
EXPORT_SCRIPT_DIR_QUOTED=`echo $(EXPORT_SCRIPT_DIR) | sed s/\\\\//\\\\\\\\\\\\//g`
# icinga config
ICINGA_BINPATH=@icinga_binpath@
ICINGA_BINPATH_QUOTED=`echo $(ICINGA_BINPATH) | sed s/\\\\//\\\\\\\\\\\\//g`
ICINGA_CONFIG=@icinga_config@
ICINGA_CONFIG_QUOTED=`echo $(ICINGA_CONFIG) | sed s/\\\\//\\\\\\\\\\\\//g`
ICINGA_USER=@icinga_user@
# icinga 2 config
ICINGA2_BINPATH=@icinga2_binpath@
ICINGA2_BINPATH_QUOTED=`echo $(ICINGA2_BINPATH) | sed s/\\\\//\\\\\\\\\\\\//g`
ICINGA2_CONFIG=@icinga2_config@
ICINGA2_CONFIG_QUOTED=`echo $(ICINGA2_CONFIG) | sed s/\\\\//\\\\\\\\\\\\//g`
ICINGA2_USER=@icinga2_user@
# lconf settings
LCONF_CLI_USER=@lconf_cli_user@
LCONF_CLI_GROUP=@lconf_cli_group@
LDAP_SERVER=@ldap_server@
LDAP_DN=@ldap_dn@
LDAP_BIND_DN=@ldap_bind_dn@
LDAP_BIND_PASSWORD=@ldap_bind_password@
LDAP_PREFIX=@ldap_prefix@
LDAP_CONFIG_STYLE=@ldap_config_style@
LDAP_PERSON=@ldap_person@
INSTALL=@INSTALL@
INSTALL_OPTS=-o $(LCONF_CLI_USER) -g $(LCONF_CLI_GROUP)
ifeq ($(LDAP_CONFIG_STYLE),old)
LDAP_CONFIG_STYLE="old (with slapd.conf)"
LDAP_ADD_SCHEMA="cp src/netways.schema /path/to/your/ldap/schema/ and include the following line into your slapd.conf: include /path/to/your/ldap/schema/netways.schema"
else
LDAP_CONFIG_STYLE="new (with cn=config)"
LDAP_ADD_SCHEMA="ldapadd -Y EXTERNAL -H ldapi:/// -f src/netways.schema.ldif"
endif
all:
# generate files
# BIN
# LConfExport.pl
cat src/LConfExport.pl.in | sed -e "s/@PREFIX@/$(PREFIX_QUOTED)/g" \
-e "s/@EXPORT_SCRIPT_DIR@/$(EXPORT_SCRIPT_DIR_QUOTED)/g" \
-e "s/@SYSCONF_DIR@/$(SYSCONF_DIR_QUOTED)/g" \
-e "s/@BIN_DIR@/$(BIN_DIR_QUOTED)/g" \
-e "s/@LIB_DIR@/$(LIB_DIR_QUOTED)/g" \
-e "s/@VERSION@/$(VERSION)/g" \
> src/LConfExport.pl
chmod 755 src/LConfExport.pl
# LConfImport.pl
cat src/LConfImport.pl.in | sed -e "s/@PREFIX@/$(PREFIX_QUOTED)/g" \
-e "s/@EXPORT_SCRIPT_DIR@/$(EXPORT_SCRIPT_DIR_QUOTED)/g" \
-e "s/@SYSCONF_DIR@/$(SYSCONF_DIR_QUOTED)/g" \
-e "s/@BIN_DIR@/$(BIN_DIR_QUOTED)/g" \
-e "s/@LIB_DIR@/$(LIB_DIR_QUOTED)/g" \
-e "s/@VERSION@/$(VERSION)/g" \
> src/LConfImport.pl
chmod 755 src/LConfImport.pl
# LConfSlaveExport.pl
cat src/LConfSlaveExport.pl.in | sed -e "s/@PREFIX@/$(PREFIX_QUOTED)/g" \
-e "s/@EXPORT_SCRIPT_DIR@/$(EXPORT_SCRIPT_DIR_QUOTED)/g" \
-e "s/@SYSCONF_DIR@/$(SYSCONF_DIR_QUOTED)/g" \
-e "s/@BIN_DIR@/$(BIN_DIR_QUOTED)/g" \
-e "s/@LIB_DIR@/$(LIB_DIR_QUOTED)/g" \
-e "s/@VERSION@/$(VERSION)/g" \
> src/LConfSlaveExport.pl
chmod 755 src/LConfSlaveExport.pl
# LConfSlaveExportRules.pl
cat src/LConfSlaveExportRules.pl.in | sed -e "s/@PREFIX@/$(PREFIX_QUOTED)/g" \
-e "s/@EXPORT_SCRIPT_DIR@/$(EXPORT_SCRIPT_DIR_QUOTED)/g" \
-e "s/@SYSCONF_DIR@/$(SYSCONF_DIR_QUOTED)/g" \
-e "s/@BIN_DIR@/$(BIN_DIR_QUOTED)/g" \
-e "s/@LIB_DIR@/$(LIB_DIR_QUOTED)/g" \
-e "s/@VERSION@/$(VERSION)/g" \
> src/LConfSlaveExportRules.pl
chmod 755 src/LConfSlaveExportRules.pl
# LConfSlaveSync.pl
cat src/LConfSlaveSync.pl.in | sed -e "s/@PREFIX@/$(PREFIX_QUOTED)/g" \
-e "s/@EXPORT_SCRIPT_DIR@/$(EXPORT_SCRIPT_DIR_QUOTED)/g" \
-e "s/@SYSCONF_DIR@/$(SYSCONF_DIR_QUOTED)/g" \
-e "s/@BIN_DIR@/$(BIN_DIR_QUOTED)/g" \
-e "s/@LIB_DIR@/$(LIB_DIR_QUOTED)/g" \
-e "s/@VERSION@/$(VERSION)/g" \
> src/LConfSlaveSync.pl
chmod 755 src/LConfSlaveSync.pl
# ETC
# config.pm
cat src/config.pm.in | sed \
-e "s/@LDAP_SERVER@/$(LDAP_SERVER)/g" \
-e "s/@LDAP_DN@/$(LDAP_DN)/g" \
-e "s/@LDAP_PREFIX@/$(LDAP_PREFIX)/g" \
-e "s/@LDAP_BIND_DN@/$(LDAP_BIND_DN)/g" \
-e "s/@LDAP_BIND_PASSWORD@/$(LDAP_BIND_PASSWORD)/g" \
-e "s/@LCONF_CLI_USER@/$(LCONF_CLI_USER)/g" \
-e "s/@PREFIX@/$(PREFIX_QUOTED)/g" \
-e "s/@EXPORT_SCRIPT_DIR@/$(EXPORT_SCRIPT_DIR_QUOTED)/g" \
-e "s/@SYSCONF_DIR@/$(SYSCONF_DIR_QUOTED)/g" \
-e "s/@BIN_DIR@/$(BIN_DIR_QUOTED)/g" \
-e "s/@LIB_DIR@/$(LIB_DIR_QUOTED)/g" \
-e "s/@TMP_DIR@/$(TMP_DIR_QUOTED)/g" \
-e "s/@TREE_REWRITE_METHOD@/$(TREE_REWRITE_METHOD_QUOTED)/g" \
-e "s/@LOCALSTATE_DIR@/$(LOCALSTATE_DIR_QUOTED)/g" \
-e "s/@SLAVESYNC__LOCAL_DIR@/$(SLAVESYNC__LOCAL_DIR_QUOTED)/g" \
-e "s/@SLAVESYNC__REMOTE_DIR@/$(SLAVESYNC__REMOTE_DIR_QUOTED)/g" \
-e "s/@SLAVESYNC__CHECKRESULT_SPOOL_DIR@/$(SLAVESYNC__CHECKRESULT_SPOOL_DIR_QUOTED)/g" \
-e "s/@SLAVESYNC__EXTCMD_PIPE_PATH@/$(SLAVESYNC__EXTCMD_PIPE_PATH_QUOTED)/g" \
-e "s/@SLAVESYNC__PID_FILE@/$(SLAVESYNC__PID_FILE_QUOTED)/g" \
-e "s/@SLAVESYNC__LOG_DIR@/$(SLAVESYNC__LOG_DIR_QUOTED)/g" \
> src/config.pm
# default-templates.{cfg,conf}.in
cat src/default-templates.cfg.in > src/default-templates.cfg
cat src/default-templates.conf.in > src/default-templates.conf
# LIB
# misc.pm
cat src/misc.pm.in > src/misc.pm
# ldap.pm
cat src/ldap.pm.in > src/ldap.pm
# generate.pm
cat src/generate.pm.in > src/generate.pm
# CONTRIB
# create_lconf-web-dn-mid.pl
cat contrib/create_lconf-web-dn-mid.pl.in | sed -e "s/@LDAP_PREFIX@/$(LDAP_PREFIX)/g" > contrib/create_lconf-web-dn-mid.pl
chmod 755 contrib/create_lconf-web-dn-mid.pl
# lconf-slavesync
cat contrib/lconf-slavesync.in > contrib/lconf-slavesync
chmod 755 contrib/lconf-slavesync
# LConfDeploy.sh
cat contrib/LConfDeploy.sh.in | sed \
-e "s/@SYSCONF_DIR@/$(SYSCONF_DIR_QUOTED)/g" \
-e "s/@BIN_DIR@/$(BIN_DIR_QUOTED)/g" \
-e "s/@LIB_DIR@/$(LIB_DIR_QUOTED)/g" \
-e "s/@VERSION@/$(VERSION)/g" \
-e "s/@ICINGA_BINPATH@/$(ICINGA_BINPATH_QUOTED)/g" \
-e "s/@ICINGA_CONFIG@/$(ICINGA_CONFIG_QUOTED)/g" \
-e "s/@ICINGA_USER@/$(ICINGA_USER)/g" \
> contrib/LConfDeploy.sh
chmod 755 contrib/LConfDeploy.sh
# LConfDeployIcinga2.sh
cat contrib/LConfDeployIcinga2.sh.in | sed \
-e "s/@SYSCONF_DIR@/$(SYSCONF_DIR_QUOTED)/g" \
-e "s/@BIN_DIR@/$(BIN_DIR_QUOTED)/g" \
-e "s/@LIB_DIR@/$(LIB_DIR_QUOTED)/g" \
-e "s/@TMP_DIR@/$(TMP_DIR_QUOTED)/g" \
-e "s/@VERSION@/$(VERSION)/g" \
-e "s/@ICINGA2_BINPATH@/$(ICINGA2_BINPATH_QUOTED)/g" \
-e "s/@ICINGA2_CONFIG@/$(ICINGA2_CONFIG_QUOTED)/g" \
-e "s/@ICINGA2_USER@/$(ICINGA2_USER)/g" \
> contrib/LConfDeployIcinga2.sh
chmod 755 contrib/LConfDeployIcinga2.sh
# LDAP SCHEMA + BASE.LDIF
# netways.schema
cat src/netways.schema.in | sed -e "s/@LDAP_PREFIX@/$(LDAP_PREFIX)/g" -e "s/@LDAP_PERSON@/$(LDAP_PERSON)/g" > src/netways.schema
# netways.schema.ldif
cat src/netways.schema.ldif.in | sed \
-e "s/@LDAP_PREFIX@/$(LDAP_PREFIX)/g" \
-e "s/@LDAP_PERSON@/$(LDAP_PERSON)/g" \
> src/netways.schema.ldif
# base.ldif
cat src/base.ldif.in | sed \
-e "s/@LDAP_DN@/$(LDAP_DN)/g" \
-e "s/@LDAP_PREFIX@/$(LDAP_PREFIX)/g" \
> src/base.ldif
# SUMMARY
make info
info:
@echo ""
@echo " * * * LConf $(VERSION) * * *"
@echo ""
@echo "targets:"
@echo ""
@echo " all - translate LConf"
@echo " install - install LConf (scripts & config"
@echo " install-basic - install scripts only (no config)"
@echo " install-config - install config only"
@echo " install-deploy-script - install Icinga 1.x deploy script from contrib/"
@echo " install-deploy-script-icinga2 - install Icinga 2.x deploy script from contrib/"
@echo " clean - clean up generated tmp files"
@echo ""
@echo ""
@echo " * * * Current Settings * * *"
@echo ""
@echo " config dir: "$(SYSCONF_DIR)
@echo " lib dir: "$(LIB_DIR)
@echo " bin dir: "$(BIN_DIR)
@echo " tmp dir: "$(TMP_DIR)
@echo " localstate dir: "$(LOCALSTATE_DIR)
@echo " export script dir: "$(EXPORT_SCRIPT_DIR)
@echo " slavesync local dir: "$(SLAVESYNC__LOCAL_DIR)
@echo " slavesync remote dir: "$(SLAVESYNC__REMOTE_DIR)
@echo " slavesync cr spool dir: "$(SLAVESYNC__CHECKRESULT_SPOOL_DIR)
@echo " slavesync extcmd pipe: "$(SLAVESYNC__EXTCMD_PIPE_PATH)
@echo " slavesync pid file: "$(SLAVESYNC__PID_FILE)
@echo " slavesync log dir: "$(SLAVESYNC__LOG_DIR)
@echo ""
@echo " lconf_cli_user: "$(LCONF_CLI_USER)
@echo " lconf_cli_group: "$(LCONF_CLI_GROUP)
@echo ""
@echo " ldap_server: "$(LDAP_SERVER)
@echo " ldap_dn: "$(LDAP_DN)
@echo " ldap_bind_dn: "$(LDAP_BIND_DN)
@echo " ldap_bind_password: "$(LDAP_BIND_PASSWORD)
@echo " ldap_prefix: "$(LDAP_PREFIX)
@echo " ldap_person: "$(LDAP_PERSON)
@echo ""
@echo " ldap_config_style: "$(LDAP_CONFIG_STYLE)
@echo ""
install: install-basic install-config
@echo ""
@echo ""
@echo " * * * LConf $(VERSION) - finish the installation * * *"
@echo ""
@echo "You have configured LConf with the "$(LDAP_CONFIG_STYLE)" ldap configuration."
@echo ""
@echo "Finish the installation with the following steps:"
@echo ""
@echo " 1) add the LConf schema to your ldap server"
@echo " 2) restart your ldap server"
@echo " 3) add the base ldif file to your ldap tree"
@echo ""
@echo "So... what's next?"
@echo ""
@echo " 1) "$(LDAP_ADD_SCHEMA)
@echo " 2) /etc/init.d/slapd restart"
@echo " 3) ldapadd -h "$(LDAP_SERVER)" -x -D \""$(LDAP_BIND_DN)"\" -W -f src/base.ldif"
@echo ""
@echo "Optional: Run 'make install-deploy-script(-icinga2)' for deployment script installation."
install-basic:
@echo "Installing LConf Backend..."
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(SYSCONF_DIR)
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(BIN_DIR)
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LIB_DIR)
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOCALSTATE_DIR)
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(TMP_DIR)
$(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(EXPORT_SCRIPT_DIR)
$(INSTALL) -m 750 $(INSTALL_OPTS) src/LConfExport.pl ${DESTDIR}$(BIN_DIR)/LConfExport.pl
$(INSTALL) -m 750 $(INSTALL_OPTS) src/LConfImport.pl ${DESTDIR}$(BIN_DIR)/LConfImport.pl
$(INSTALL) -m 750 $(INSTALL_OPTS) src/LConfSlaveExport.pl ${DESTDIR}$(BIN_DIR)/LConfSlaveExport.pl
$(INSTALL) -m 750 $(INSTALL_OPTS) src/LConfSlaveExportRules.pl ${DESTDIR}$(BIN_DIR)/LConfSlaveExportRules.pl
$(INSTALL) -m 750 $(INSTALL_OPTS) src/LConfSlaveSync.pl ${DESTDIR}$(BIN_DIR)/LConfSlaveSync.pl
$(INSTALL) -b -m 640 $(INSTALL_OPTS) src/default-templates.cfg ${DESTDIR}$(SYSCONF_DIR)/default-templates.cfg
$(INSTALL) -b -m 640 $(INSTALL_OPTS) src/default-templates.conf ${DESTDIR}$(SYSCONF_DIR)/default-templates.conf
$(INSTALL) -m 640 $(INSTALL_OPTS) src/misc.pm ${DESTDIR}$(LIB_DIR)/misc.pm
$(INSTALL) -m 640 $(INSTALL_OPTS) src/ldap.pm ${DESTDIR}$(LIB_DIR)/ldap.pm
$(INSTALL) -m 640 $(INSTALL_OPTS) src/generate.pm ${DESTDIR}$(LIB_DIR)/generate.pm
install-config:
@echo "Installing LConf Configuration..."
$(INSTALL) -b -m 640 $(INSTALL_OPTS) src/config.pm ${DESTDIR}$(SYSCONF_DIR)/config.pm
install-deploy-script:
@echo "Installing LConf Deploy Script..."
$(INSTALL) -m 755 $(INSTALL_OPTS) contrib/LConfDeploy.sh ${DESTDIR}$(BIN_DIR)/LConfDeploy.sh
install-deploy-script-icinga2:
@echo "Installing LConf Deploy Script for Icinga 2..."
$(INSTALL) -m 755 $(INSTALL_OPTS) contrib/LConfDeployIcinga2.sh ${DESTDIR}$(BIN_DIR)/LConfDeployIcinga2.sh
clean:
cd $(EXEC_DIR)
rm -f Makefile config.log config.status
rm -f src/LConfExport.pl src/LConfExport.pl.[0-9]
rm -f src/LConfImport.pl src/LConfImport.pl.[0-9]
rm -f src/LConfSlaveExport.pl src/LConfSlaveExport.pl.[0-9]
rm -f src/LConfSlaveExportRules.pl src/LConfSlaveExportRules.pl.[0-9]
rm -f src/LConfSlaveSync.pl src/LConfSlaveSync.pl.[0-9]
rm -f src/config.pm src/config.pm.[0-9]
rm -f src/misc.pm src/misc.pm.[0-9]
rm -f src/ldap.pm src/ldap.pm.[0-9]
rm -f src/generate.pm src/generate.pm.[0-9]
rm -f src/netways.schema
rm -f src/netways.schema.ldif
rm -f src/base.ldif src/base.ldif.[0-9]
rm -f src/default-templates.cfg src/default-templates.cfg.[0-9]
rm -f src/default-templates.conf src/default-templates.conf.[0-9]
rm -f contrib/create_lconf-web-dn-mid.pl
rm -f contrib/lconf-slavesync
rm -f contrib/LConfDeploy.sh
rm -f contrib/LConfDeployIcinga2.sh
create-tarball:
$(eval version := $(shell git describe --tags HEAD | sed 's/^v//'))
git archive -o "../${TARBALL_NAME}-$(version).tar.gz" --prefix="${TARBALL_NAME}-$(version)/" HEAD
@echo "You find your tarball here: ../${TARBALL_NAME}-$(version).tar.gz"
# vi: ts=4 sw=4 noexpandtab :