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
|
$NetBSD: patch-Makefile.in,v 1.3 2017/05/24 07:42:39 manu Exp $
Adjustments to build procedure.
--- Makefile.in.orig 2017-05-09 19:03:31.000000000 +0200
+++ Makefile.in 2017-05-22 04:04:17.000000000 +0200
@@ -24,11 +24,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
LOGDIR=@localstatedir@
CHECKRESULTDIR=@CHECKRESULTDIR@
-CFGDIR=@sysconfdir@
+SAMPDIR=@prefix@/share/examples/nagios
BINDIR=@bindir@
-CGIDIR=@sbindir@
+CGIDIR=@libexecdir@
LIBEXECDIR=@libexecdir@
LIBDIR=@libdir@
INCLUDEDIR=@includedir@/nagios
HTMLDIR=@datadir@
@@ -36,9 +36,8 @@
LN_S=@LN_S@
INSTALL=@INSTALL@
INSTALL_OPTS=@INSTALL_OPTS@
COMMAND_OPTS=@COMMAND_OPTS@
-HTTPD_CONF=@HTTPD_CONF@
LN_HTTPD_SITES_ENABLED=@LN_HTTPD_SITES_ENABLED@
INIT_DIR=@init_dir@
INIT_OPTS=@INIT_OPTS@
CGICFGDIR=$(CGIDIR)
@@ -72,77 +71,8 @@
all:
cd $(SRC_BASE) && $(MAKE)
cd $(SRC_CGI) && $(MAKE)
cd $(SRC_HTM) && $(MAKE)
- if [ x$(USE_EVENTBROKER) = xyes ]; then \
- cd $(SRC_MODULE) && $(MAKE); \
- fi
- cd $(SRC_WORKERS) && $(MAKE) $@
-
- @echo ""
- @echo "*** Compile finished ***"
- @echo ""
- @echo "If the main program and CGIs compiled without any errors, you"
- @echo "can continue with installing Nagios as follows (type 'make'"
- @echo "without any arguments for a list of all possible options):"
- @echo ""
- @echo " make install"
- @echo " - This installs the main program, CGIs, and HTML files"
- @echo ""
- @echo " make install-init"
- @echo " - This installs the init script in $(DESTDIR)$(INIT_DIR)"
- @echo ""
- @echo " make install-commandmode"
- @echo " - This installs and configures permissions on the"
- @echo " directory for holding the external command file"
- @echo ""
- @echo " make install-config"
- @echo " - This installs *SAMPLE* config files in $(DESTDIR)$(CFGDIR)"
- @echo " You'll have to modify these sample files before you can"
- @echo " use Nagios. Read the HTML documentation for more info"
- @echo " on doing this. Pay particular attention to the docs on"
- @echo " object configuration files, as they determine what/how"
- @echo " things get monitored!"
- @echo ""
- @echo " make install-webconf"
- @echo " - This installs the Apache config file for the Nagios"
- @echo " web interface"
- @echo ""
- @echo " make install-exfoliation"
- @echo " - This installs the Exfoliation theme for the Nagios"
- @echo " web interface"
- @echo ""
- @echo " make install-classicui"
- @echo " - This installs the classic theme for the Nagios"
- @echo " web interface"
- @echo ""
- @echo ""
- @echo "*** Support Notes *******************************************"
- @echo ""
- @echo "If you have questions about configuring or running Nagios,"
- @echo "please make sure that you:"
- @echo ""
- @echo " - Look at the sample config files"
- @echo " - Read the documentation on the Nagios Library at:"
- @echo " https://library.nagios.com"
- @echo ""
- @echo "before you post a question to one of the mailing lists."
- @echo "Also make sure to include pertinent information that could"
- @echo "help others help you. This might include:"
- @echo ""
- @echo " - What version of Nagios you are using"
- @echo " - What version of the plugins you are using"
- @echo " - Relevant snippets from your config files"
- @echo " - Relevant error messages from the Nagios log file"
- @echo ""
- @echo "For more information on obtaining support for Nagios, visit:"
- @echo ""
- @echo " https://support.nagios.com"
- @echo ""
- @echo "*************************************************************"
- @echo ""
- @echo "Enjoy."
- @echo ""
$(SRC_LIB)/libnagios.a:
cd $(SRC_LIB) && $(MAKE)
@@ -246,13 +176,8 @@
$(MAKE) install-exfoliation
$(MAKE) install-basic
install-basic:
- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LIBEXECDIR)
- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)
- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(LOGDIR)/archives
- $(INSTALL) -m 775 $(COMMAND_OPTS) -d $(DESTDIR)$(CHECKRESULTDIR)
- chmod g+s $(DESTDIR)$(CHECKRESULTDIR)
@echo ""
@echo "*** Main program, CGIs and HTML files installed ***"
@echo ""
@@ -271,22 +196,22 @@
@echo ""
install-config:
- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)
- $(INSTALL) -m 775 $(INSTALL_OPTS) -d $(DESTDIR)$(CFGDIR)/objects
- $(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/nagios.cfg $(DESTDIR)$(CFGDIR)/nagios.cfg
- $(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/cgi.cfg $(DESTDIR)$(CFGDIR)/cgi.cfg
- $(INSTALL) -b -m 660 $(INSTALL_OPTS) sample-config/resource.cfg $(DESTDIR)$(CFGDIR)/resource.cfg
- $(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/templates.cfg $(DESTDIR)$(CFGDIR)/objects/templates.cfg
- $(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/commands.cfg $(DESTDIR)$(CFGDIR)/objects/commands.cfg
- $(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/contacts.cfg $(DESTDIR)$(CFGDIR)/objects/contacts.cfg
- $(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/timeperiods.cfg $(DESTDIR)$(CFGDIR)/objects/timeperiods.cfg
- $(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/localhost.cfg $(DESTDIR)$(CFGDIR)/objects/localhost.cfg
- $(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/windows.cfg $(DESTDIR)$(CFGDIR)/objects/windows.cfg
- $(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/printer.cfg $(DESTDIR)$(CFGDIR)/objects/printer.cfg
- $(INSTALL) -b -m 664 $(INSTALL_OPTS) sample-config/template-object/switch.cfg $(DESTDIR)$(CFGDIR)/objects/switch.cfg
-
+ [ -d $(DESTDIR)$(SAMPDIR) ] || ${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(SAMPDIR)
+ [ -d $(DESTDIR)$(SAMPDIR)/objects ] || ${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(SAMPDIR)/objects
+ ${BSD_INSTALL_DATA} -m 644 sample-config/nagios.cfg $(DESTDIR)$(SAMPDIR)/nagios.cfg-sample
+ ${BSD_INSTALL_DATA} -m 644 sample-config/cgi.cfg $(DESTDIR)$(SAMPDIR)/cgi.cfg-sample
+ ${BSD_INSTALL_DATA} -m 640 sample-config/resource.cfg $(DESTDIR)$(SAMPDIR)/resource.cfg-sample
+ ${BSD_INSTALL_DATA} -m 644 sample-config/template-object/templates.cfg $(DESTDIR)$(SAMPDIR)/objects/templates.cfg-sample
+ ${BSD_INSTALL_DATA} -m 644 sample-config/template-object/commands.cfg $(DESTDIR)$(SAMPDIR)/objects/commands.cfg-sample
+ ${BSD_INSTALL_DATA} -m 644 sample-config/template-object/contacts.cfg $(DESTDIR)$(SAMPDIR)/objects/contacts.cfg-sample
+ ${BSD_INSTALL_DATA} -m 644 sample-config/template-object/timeperiods.cfg $(DESTDIR)$(SAMPDIR)/objects/timeperiods.cfg-sample
+ ${BSD_INSTALL_DATA} -m 644 sample-config/template-object/localhost.cfg $(DESTDIR)$(SAMPDIR)/objects/localhost.cfg-sample
+ ${BSD_INSTALL_DATA} -m 644 sample-config/template-object/windows.cfg $(DESTDIR)$(SAMPDIR)/objects/windows.cfg-sample
+ ${BSD_INSTALL_DATA} -m 644 sample-config/template-object/printer.cfg $(DESTDIR)$(SAMPDIR)/objects/printer.cfg-sample
+ ${BSD_INSTALL_DATA} -m 644 sample-config/template-object/switch.cfg $(DESTDIR)$(SAMPDIR)/objects/switch.cfg-sample
+
@echo ""
@echo "*** Config files installed ***"
@echo ""
@echo "Remember, these are *SAMPLE* config files. You'll need to read"
@@ -305,15 +230,15 @@
@echo ""
install-exfoliation:
@cd contrib/exfoliation; \
- $(INSTALL) $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/stylesheets; \
+ $(BSD_INSTALL_DATA_DIR) -d $(DESTDIR)$(HTMLDIR)/stylesheets; \
for file in $$(find ./stylesheets/ -type f); do \
- $(INSTALL) -m 644 $(INSTALL_OPTS) $${file} $(DESTDIR)$(HTMLDIR)/$${file}; \
+ $(BSD_INSTALL_DATA) $${file} $(DESTDIR)$(HTMLDIR)/$${file}; \
done; \
- $(INSTALL) $(INSTALL_OPTS) -d $(DESTDIR)$(HTMLDIR)/images; \
+ $(BSD_INSTALL_DATA_DIR) $(DESTDIR)$(HTMLDIR)/images; \
for file in $$(find ./images -type f); do \
- $(INSTALL) -m 644 $(INSTALL_OPTS) $${file} $(DESTDIR)$(HTMLDIR)/$${file}; \
+ $(BSD_INSTALL_DATA) $${file} $(DESTDIR)$(HTMLDIR)/$${file}; \
done; \
cd ../..
@echo ""
@@ -349,9 +274,12 @@
@echo ""
install-commandmode:
- $(INSTALL) -m 775 $(COMMAND_OPTS) -d $(DESTDIR)$(LOGDIR)/rw
+ ${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(LOGDIR)/archives
+ ${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(LOGDIR)/rw
+ ${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(CHECKRESULTDIR)
+ chmod g+s $(DESTDIR)$(LOGDIR)/archives
chmod g+s $(DESTDIR)$(LOGDIR)/rw
@echo ""
@echo "*** External command directory configured ***"
|