xref: /openbsd/etc/Makefile (revision 833ea469)
1#	$OpenBSD: Makefile,v 1.297 2011/07/06 18:55:36 robert Exp $
2
3TZDIR=		/usr/share/zoneinfo
4LOCALTIME=	Canada/Mountain
5MTREEDIR=	/etc/mtree
6
7NOOBJ=
8
9.if exists(etc.${MACHINE}/Makefile.inc)
10.include "etc.${MACHINE}/Makefile.inc"
11.endif
12
13# -rw-r--r--
14BINOWN= root
15BINGRP= wheel
16BIN1=	changelist ccd.conf csh.cshrc csh.login csh.logout daily dhcpd.conf \
17	exports ftpusers ftpchroot gettytab group hosts hosts.lpd inetd.conf \
18	ksh.kshrc locate.rc man.conf monthly motd mrouted.conf myname \
19	netstart networks newsyslog.conf printcap protocols \
20	rbootd.conf rc rc.conf rc.local rc.securelevel rc.shutdown \
21	remote rpc services shells syslog.conf weekly \
22	etc.${MACHINE}/disktab dhclient.conf mailer.conf ntpd.conf \
23	moduli pf.os sensorsd.conf ifstated.conf
24
25.if ${MACHINE} != "aviion" && ${MACHINE} != "mvme68k" && \
26    ${MACHINE} != "mvme88k"
27BIN1+=	wsconsctl.conf
28.endif
29
30# -rw-rw-r--
31BIN2=	motd
32
33# -r-xr-xr-x
34RCDAEMONS=	apmd bgpd bootparamd cron dhcpd dhcrelay dvmrpd ftpd ftpproxy \
35		hostapd hotplugd httpd identd ifstated iked inetd isakmpd ldapd \
36		ldattach ldpd lpd mopd mrouted named nsd ntpd rarpd rbootd relayd \
37		ripd route6d rtadvd rtsold rwhod sasyncd sendmail sensorsd smtpd \
38		snmpd sshd syslogd timed watchdogd
39
40MISETS=	base${OSrev}.tgz comp${OSrev}.tgz \
41	man${OSrev}.tgz game${OSrev}.tgz etc${OSrev}.tgz
42
43# Use NOGZIP on architectures where the gzip'ing would take too much time
44# (pmax or slower :-)).  This way you get only tar'ed snap files and you can
45# gzip them on a faster machine
46.ifndef NOGZIP
47GZIPCMD?=	gzip
48GZIPFLAGS?=	-9
49GZIPEXT?=	.gz
50.else
51GZIPCMD=	cat
52GZIPFLAGS=
53GZIPEXT=
54.endif
55
56all clean cleandir depend etc install lint:
57
58install-mtree:
59	${INSTALL} -c -o root -g wheel -m 600 ${.CURDIR}/mtree/special \
60	    ${DESTDIR}${MTREEDIR}
61	${INSTALL} -c -o root -g wheel -m 444 ${.CURDIR}/mtree/4.4BSD.dist \
62	    ${DESTDIR}${MTREEDIR}
63	${INSTALL} -c -o root -g wheel -m 444 ${.CURDIR}/mtree/BSD.local.dist \
64	    ${DESTDIR}${MTREEDIR}
65	${INSTALL} -c -o root -g wheel -m 444 ${.CURDIR}/mtree/BSD.x11.dist \
66	    ${DESTDIR}${MTREEDIR}
67
68.ifndef DESTDIR
69distribution-etc-root-var distribution distrib-dirs release:
70	@echo setenv DESTDIR before doing that!
71	@false
72.else
73distribution-etc-root-var: distrib-dirs
74	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 ${BIN1} ${DESTDIR}/etc
75	ksh ttys.pty | cat etc.${MACHINE}/ttys - > ${DESTDIR}/etc/ttys && \
76	    chown ${BINOWN} ${DESTDIR}/etc/ttys && \
77	    chgrp ${BINGRP} ${DESTDIR}/etc/ttys && \
78	    chmod 644 ${DESTDIR}/etc/ttys
79	cat sysctl.conf etc.${MACHINE}/sysctl.conf > ${DESTDIR}/etc/sysctl.conf && \
80	    chown ${BINOWN} ${DESTDIR}/etc/sysctl.conf && \
81	    chgrp ${BINGRP} ${DESTDIR}/etc/sysctl.conf && \
82	    chmod 644 ${DESTDIR}/etc/sysctl.conf
83	cat fbtab.head etc.${MACHINE}/fbtab fbtab.tail > ${DESTDIR}/etc/fbtab && \
84	    chown ${BINOWN} ${DESTDIR}/etc/fbtab && \
85	    chgrp ${BINGRP} ${DESTDIR}/etc/fbtab && \
86	    chmod 644 ${DESTDIR}/etc/fbtab
87	awk -f ${.CURDIR}/mklogin.conf `test -f etc.${MACHINE}/login.conf.overrides && echo etc.${MACHINE}/login.conf.overrides` < ${.CURDIR}/login.conf.in > \
88	    ${DESTDIR}/etc/login.conf && \
89	    chown ${BINOWN}:${BINGRP} ${DESTDIR}/etc/login.conf && \
90	    chmod 644 ${DESTDIR}/etc/login.conf
91	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 ${BIN2} ${DESTDIR}/etc
92	${INSTALL} -c -o root -g wheel -m 600 hosts.equiv ${DESTDIR}/etc
93	${INSTALL} -c -o root -g crontab -m 600 crontab ${DESTDIR}/var/cron/tabs/root
94	${INSTALL} -c -o root -g wheel -m 600 master.passwd ${DESTDIR}/etc
95	pwd_mkdb -p -d ${DESTDIR}/etc /etc/master.passwd
96	${INSTALL} -c -o root -g wheel -m 600 bgpd.conf ${DESTDIR}/etc
97	${INSTALL} -c -o root -g wheel -m 600 ospfd.conf ${DESTDIR}/etc
98	${INSTALL} -c -o root -g wheel -m 600 ospf6d.conf ${DESTDIR}/etc
99	${INSTALL} -c -o root -g wheel -m 600 ripd.conf ${DESTDIR}/etc
100	${INSTALL} -c -o root -g wheel -m 600 dvmrpd.conf ${DESTDIR}/etc
101	${INSTALL} -c -o root -g wheel -m 600 ldpd.conf ${DESTDIR}/etc
102	${INSTALL} -c -o root -g wheel -m 600 pf.conf ${DESTDIR}/etc
103	${INSTALL} -c -o root -g operator -m 644 chio.conf ${DESTDIR}/etc
104	${INSTALL} -c -o root -g wheel -m 600 hostapd.conf ${DESTDIR}/etc
105	${INSTALL} -c -o root -g wheel -m 600 relayd.conf ${DESTDIR}/etc
106	${INSTALL} -c -o root -g wheel -m 600 iked.conf ${DESTDIR}/etc
107	${INSTALL} -c -o root -g wheel -m 600 ipsec.conf ${DESTDIR}/etc
108	${INSTALL} -c -o root -g wheel -m 600 sasyncd.conf ${DESTDIR}/etc
109	${INSTALL} -c -o root -g wheel -m 600 snmpd.conf ${DESTDIR}/etc
110	${INSTALL} -c -o root -g wheel -m 600 ldapd.conf ${DESTDIR}/etc
111	${INSTALL} -c -o root -g _nsd -m 640 nsd.conf ${DESTDIR}/etc
112	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 \
113	    etc.${MACHINE}/MAKEDEV ${DESTDIR}/dev
114	cd root; \
115		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
116		    ${DESTDIR}/root/.cshrc; \
117		${INSTALL} -c -o root -g wheel -m 600 dot.klogin \
118		    ${DESTDIR}/root/.klogin; \
119		${INSTALL} -c -o root -g wheel -m 644 dot.login \
120		    ${DESTDIR}/root/.login; \
121		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
122		    ${DESTDIR}/root/.profile; \
123		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
124		    ${DESTDIR}/root/.Xdefaults; \
125		rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
126		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
127		    ${DESTDIR}/.cshrc; \
128		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
129		    ${DESTDIR}/.profile
130	cd skel; \
131		${INSTALL} -c -o root -g wheel -m 644 dot.cshrc \
132		    ${DESTDIR}/etc/skel/.cshrc; \
133		${INSTALL} -c -o root -g wheel -m 644 dot.login \
134		    ${DESTDIR}/etc/skel/.login; \
135		${INSTALL} -c -o root -g wheel -m 644 dot.mailrc \
136		    ${DESTDIR}/etc/skel/.mailrc; \
137		${INSTALL} -c -o root -g wheel -m 644 dot.profile \
138		    ${DESTDIR}/etc/skel/.profile; \
139		${INSTALL} -c -o root -g wheel -m 644 dot.Xdefaults \
140		    ${DESTDIR}/etc/skel/.Xdefaults; \
141		${INSTALL} -c -o root -g wheel -m 600 /dev/null \
142		    ${DESTDIR}/etc/skel/.ssh/authorized_keys
143	cd kerberosV; \
144		${INSTALL} -c -o root -g wheel -m 644 README \
145		    ${DESTDIR}/etc/kerberosV; \
146		${INSTALL} -c -o root -g wheel -m 644 krb5.conf.example \
147		    ${DESTDIR}/etc/kerberosV
148	cd amd; \
149		${INSTALL} -c -o root -g wheel -m 644 master.sample \
150		    ${DESTDIR}/etc/amd
151	cd ppp; \
152		${INSTALL} -c -o root -g wheel -m 600 chap-secrets \
153		    ${DESTDIR}/etc/ppp; \
154		${INSTALL} -c -o root -g wheel -m 600 options \
155		    ${DESTDIR}/etc/ppp; \
156		${INSTALL} -c -o root -g wheel -m 600 options.leaf \
157		    ${DESTDIR}/etc/ppp; \
158		${INSTALL} -c -o root -g wheel -m 600 options.sample \
159		    ${DESTDIR}/etc/ppp; \
160		${INSTALL} -c -o root -g wheel -m 600 chatscript.sample \
161		    ${DESTDIR}/etc/ppp; \
162		${INSTALL} -c -o root -g wheel -m 600 pap-secrets \
163		    ${DESTDIR}/etc/ppp; \
164		${INSTALL} -c -o root -g wheel -m 600 ppp.conf.sample \
165		    ${DESTDIR}/etc/ppp; \
166		${INSTALL} -c -o root -g wheel -m 644 ppp.linkup.sample \
167		    ${DESTDIR}/etc/ppp; \
168		${INSTALL} -c -o root -g wheel -m 644 ppp.linkdown.sample \
169		    ${DESTDIR}/etc/ppp; \
170		${INSTALL} -c -o root -g wheel -m 644 ppp.secret.sample \
171		    ${DESTDIR}/etc/ppp
172	cd afs; \
173		${INSTALL} -c -o root -g wheel -m 644 afsd.conf \
174		    ${DESTDIR}/etc/afs; \
175		${INSTALL} -c -o root -g wheel -m 644 ThisCell \
176		    ${DESTDIR}/etc/afs; \
177		${INSTALL} -c -o root -g wheel -m 644 CellServDB \
178		    ${DESTDIR}/etc/afs; \
179		${INSTALL} -c -o root -g wheel -m 644 SuidCells \
180		    ${DESTDIR}/etc/afs; \
181		${INSTALL} -c -o root -g wheel -m 644 README \
182		    ${DESTDIR}/etc/afs
183	cd systrace; \
184		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_lpd \
185		    ${DESTDIR}/etc/systrace; \
186		${INSTALL} -c -o root -g wheel -m 600 usr_sbin_named \
187		    ${DESTDIR}/etc/systrace
188	cd bind; \
189		${INSTALL} -c -o root -g named -m 640 named-simple.conf \
190		    ${DESTDIR}/var/named/etc/named.conf; \
191		${INSTALL} -c -o root -g named -m 640 named-*.conf \
192		    ${DESTDIR}/var/named/etc; \
193		${INSTALL} -c -o root -g wheel -m 644 root.hint \
194		    ${DESTDIR}/var/named/etc; \
195		${INSTALL} -c -o root -g wheel -m 644 db.localhost \
196		    ${DESTDIR}/var/named/standard/localhost; \
197		${INSTALL} -c -o root -g wheel -m 644 db.loopback \
198		    ${DESTDIR}/var/named/standard/loopback; \
199		${INSTALL} -c -o root -g wheel -m 644 db.loopback6.arpa \
200		    ${DESTDIR}/var/named/standard/loopback6.arpa
201	/bin/rm -f ${DESTDIR}/etc/localtime
202	ln -s ${TZDIR}/${LOCALTIME} ${DESTDIR}/etc/localtime
203	/bin/rm -f ${DESTDIR}/etc/rmt
204	ln -s /usr/sbin/rmt ${DESTDIR}/etc/rmt
205	${INSTALL} -c -o root -g wheel -m 644 minfree \
206	    ${DESTDIR}/var/crash
207	${INSTALL} -c -o ${BINOWN} -g operator -m 664 /dev/null \
208	    ${DESTDIR}/etc/dumpdates
209	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
210	    ${DESTDIR}/var/cron/at.deny
211	${INSTALL} -c -o root -g crontab -m 660 /dev/null \
212	    ${DESTDIR}/var/cron/cron.deny
213	${INSTALL} -c -o root -g wheel -m 600 /dev/null \
214	    ${DESTDIR}/var/cron/log
215	${INSTALL} -c -o root -g wheel -m 444 /dev/null \
216	    ${DESTDIR}/var/db/locate.database
217	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
218	    ${DESTDIR}/var/log/authlog
219	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
220	    ${DESTDIR}/var/log/daemon
221	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
222	    ${DESTDIR}/var/log/failedlogin
223	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
224	    ${DESTDIR}/var/log/ftpd
225	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
226	    ${DESTDIR}/var/log/lastlog
227	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
228	    ${DESTDIR}/var/log/lpd-errs
229	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
230	    ${DESTDIR}/var/log/maillog
231	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
232	    ${DESTDIR}/var/log/messages
233	${INSTALL} -c -o ${BINOWN} -g wheel -m 600 /dev/null \
234	    ${DESTDIR}/var/log/secure
235	${INSTALL} -c -o ${BINOWN} -g wheel -m 664 /dev/null \
236	    ${DESTDIR}/var/log/sendmail.st
237	${INSTALL} -c -o ${BINOWN} -g wheel -m 644 /dev/null \
238	    ${DESTDIR}/var/log/wtmp
239	${INSTALL} -c -o ${BINOWN} -g wheel -m 640 /dev/null \
240	    ${DESTDIR}/var/log/xferlog
241	${INSTALL} -c -o ${BINOWN} -g utmp -m 664 /dev/null \
242	    ${DESTDIR}/var/run/utmp
243	cd ../gnu/usr.sbin/sendmail/cf/cf && exec ${MAKE} distribution
244	cd ../usr.sbin/ypserv/ypinit && exec ${MAKE} distribution
245	cd ../usr.bin/ssh && exec ${MAKE} distribution
246	cd ../usr.sbin/httpd && exec ${MAKE} -f Makefile.bsd-wrapper distribution
247	cd ../lib/libssl && exec ${MAKE} distribution
248	cd ../gnu/usr.bin/lynx && exec ${MAKE} -f Makefile.bsd-wrapper distribution
249	cd ../usr.bin/bgplg && exec ${MAKE} distribution
250	cd ../usr.bin/mail && exec ${MAKE} distribution
251	cd ../usr.sbin/ldapd && exec ${MAKE} distribution
252	cd mail && exec ${MAKE} distribution
253	${INSTALL} -c -o root -g wheel -m 600 root/root.mail \
254	    ${DESTDIR}/var/mail/root
255	${INSTALL} -c -o root -g wheel -m 440 ../usr.bin/sudo/sudoers \
256	    ${DESTDIR}/etc/sudoers
257	cd rc.d; \
258		${INSTALL} -c -o root -g wheel -m 644 rc.subr \
259		    ${DESTDIR}/etc/rc.d && \
260		${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \
261		    ${DESTDIR}/etc/rc.d
262
263distribution:
264	exec ${SUDO} ${MAKE} distribution-etc-root-var
265	cd .. && exec ${SUDO} ${MAKE} install
266	touch ${DESTDIR}/var/db/sysmerge/etcsum
267	TMPSUM=`mktemp /tmp/_etcsum.XXXXXXXXXX` || exit 1; \
268	sort ../distrib/sets/lists/etc/{mi,md.${MACHINE}} > $${TMPSUM}; \
269	cd ${DESTDIR} && \
270		xargs cksum < $${TMPSUM} > ${DESTDIR}/var/db/sysmerge/etcsum; \
271	rm -f $${TMPSUM}
272
273distrib-dirs:
274	if [ ! -d ${DESTDIR}/. ]; then \
275		${INSTALL} -d -o root -g wheel -m 755 ${DESTDIR}; \
276	fi
277	mtree -qdef mtree/4.4BSD.dist -p ${DESTDIR}/ -U
278	if [ ! -d ${DESTDIR}/usr/src ]; then \
279		${INSTALL} -d -o root -g wsrc -m 775 ${DESTDIR}/usr/src; \
280	fi
281	cd ${DESTDIR}/; rm -f sys; ln -s usr/src/sys sys
282
283.ifndef RELEASEDIR
284release:
285	@echo setenv RELEASEDIR before building a release.
286	@false
287.else
288
289release-sets:
290	cd ${.CURDIR}/../distrib/sets && exec ${SUDO} sh maketars ${OSrev}
291
292sha:
293	-cd ${RELEASEDIR}; \
294	    sum -a sha256 INSTALL.`arch -ks` ${MDEXT} ${MISETS} > SHA256
295
296release: distribution kernels release-sets distrib sha
297
298.endif
299
300.endif	# DESTDIR check
301
302distrib:
303	cd ${.CURDIR}/../distrib && \
304	    ${MAKE} && exec ${SUDO} ${MAKE} install
305
306DHSIZE=1024 1536 2048 3072 4096
307update-moduli:
308	( \
309		echo -n '#    $$Open'; echo 'BSD$$'; \
310		echo '# Time Type Tests Tries Size Generator Modulus'; \
311		( for i in ${DHSIZE}; do \
312			ssh-keygen -b $$i -G /dev/stdout; \
313		done) | \
314		ssh-keygen -T /dev/stdout \
315	) > moduli
316
317.PHONY: distribution-etc-root-var distribution distrib-dirs \
318	release allarchs kernels release-sets m4 install-mtree
319
320SUBDIR+= etc.alpha etc.amd64 etc.armish etc.aviion etc.hp300 etc.hppa
321SUBDIR+= etc.hppa64 etc.i386 etc.landisk etc.loongson etc.luna88k
322SUBDIR+= etc.mac68k etc.macppc etc.mvme68k etc.mvme88k etc.palm
323SUBDIR+= etc.sgi etc.socppc etc.sparc etc.sparc64 etc.vax etc.zaurus
324
325.include <bsd.subdir.mk>
326.include <bsd.prog.mk>
327