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