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