xref: /dragonfly/etc/Makefile (revision 59b0b316)
1#	from: @(#)Makefile	5.11 (Berkeley) 5/21/91
2# $FreeBSD: src/etc/Makefile,v 1.219.2.38 2003/03/04 09:49:00 ru Exp $
3
4SUBDIR=	sendmail
5
6# Files that should be installed read-only (444)
7#
8BINUPDATE= devd.conf fbtab gettytab network.subr \
9	pf.os \
10	protocols \
11	rc rc.firewall6 \
12	rc.sendmail rc.shutdown \
13	rc.subr rpc \
14	etc.${MACHINE_ARCH}/disktab
15.if defined(BINARY_UPGRADE) # location of these depends on upgrade method
16BINUPDATE+=mail.rc locate.rc
17.else
18BINUPDATE+=${.CURDIR}/../usr.bin/mail/misc/mail.rc \
19	${.CURDIR}/../usr.bin/locate/locate/locate.rc
20.endif
21
22# Initial distribution files are installed read-write (644)
23#
24BIN1=	auth.conf auto_master \
25	crontab csh.cshrc csh.login csh.logout \
26	devtab dhclient.conf dm.conf dntpd.conf \
27	ftpusers group \
28	hosts hosts.allow hosts.equiv hosts.lpd \
29	inetd.conf login.access login.conf \
30	motd modems netconfig networks newsyslog.conf \
31	nscd.conf pf.conf phones printcap profile \
32	regdomain.xml remote sensorsd.conf services \
33	shells sysctl.conf syslog.conf \
34	wpa_supplicant.conf \
35	etc.${MACHINE_ARCH}/ttys
36.if defined(BINARY_UPGRADE) # location of these depends on upgrade method
37BIN1+=	manpath.config
38.else
39BIN1+=	${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config
40.endif
41
42.if !defined(NO_CRYPT)
43DIRS+=	lib/libssh \
44	usr.bin/openssl \
45	usr.bin/ssh \
46	usr.sbin/sshd
47.endif
48
49# Files that should be installed read-only-executable (555) root:wheel
50#
51BIN2=	pccard_ether rc.firewall rc.suspend rc.resume
52
53DEFAULTS= compilers.conf devfs.conf make.conf mkinitrd.conf periodic.conf \
54	  pfi.conf rc.conf uuids
55
56MTREE=	BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
57	BSD.var.dist
58
59PPPCNF=	ppp.conf
60
61ETCMAIL=aliases mailer.conf access.sample virtusertable.sample \
62	mailertable.sample
63
64# Use this directory as the source for new configuration files when upgrading
65UPGRADE_SRCDIR?=${.CURDIR}
66
67# Include file which contains obsolete files
68.if exists(${DESTDIR}/etc/upgrade/Makefile_upgrade.inc)
69.include "${DESTDIR}/etc/upgrade/Makefile_upgrade.inc"
70.endif
71
72remove-obsolete-files:
73	@if [ -z "${TO_REMOVE}" ]; then \
74		echo "Please do a 'make installworld' first."; \
75		echo "See build(7) for further information."; \
76		/usr/bin/false; \
77	fi;
78	@echo "===> Remove now obsolete files"
79	@for item in ${TO_REMOVE}; do \
80		if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
81			echo "${DESTDIR}$${item}"; \
82			chflags -Rf noschg "${DESTDIR}$${item}"; \
83			rm -rf "${DESTDIR}$${item}"; \
84		fi; \
85	done;
86	@for item in ${TO_REMOVE:M*/man/man[1-9]/*:C@/man/man([1-9])/@/man/cat\1/@g}; do \
87		if [ -e ${DESTDIR}$${item} ]; then \
88			echo "${DESTDIR}$${item}"; \
89			chflags -Rf noschg "${DESTDIR}$${item}"; \
90			rm -rf "${DESTDIR}$${item}"; \
91		fi; \
92	done
93
94preupgrade:
95	(pw -V ${DESTDIR}/etc usershow mail -q > /dev/null) || \
96		pw -V ${DESTDIR}/etc useradd mail -u 6 -g 6 \
97		   -c "Mail user" \
98		   -d /nonexistent -s /sbin/nologin
99	(pw -V ${DESTDIR}/etc usershow _pflogd -q > /dev/null) || \
100		pw -V ${DESTDIR}/etc useradd _pflogd -u 64 \
101		   -c "pflogd privsep user" \
102		   -d /var/empty -s /sbin/nologin
103	(pw -V ${DESTDIR}/etc usershow _sdpd -q > /dev/null) || \
104		pw -V ${DESTDIR}/etc useradd _sdpd -u 70 \
105		   -c "sdpd privsep user" \
106		   -d /var/empty -s /sbin/nologin
107	(pw -V ${DESTDIR}/etc usershow _dhcp -q > /dev/null) || \
108		pw -V ${DESTDIR}/etc useradd _dhcp -u 77 \
109		   -c "DHCP programs" \
110		   -d /var/empty -s /sbin/nologin
111	(pw -V ${DESTDIR}/etc groupshow video -q > /dev/null) || \
112		pw -V ${DESTDIR}/etc groupadd video -g 44
113	(pw -V ${DESTDIR}/etc groupshow authpf -q > /dev/null) || \
114		pw -V ${DESTDIR}/etc groupadd authpf -g 63
115	(pw -V ${DESTDIR}/etc groupshow _pflogd -q > /dev/null) || \
116		pw -V ${DESTDIR}/etc groupadd _pflogd -g 64
117	(pw -V ${DESTDIR}/etc groupshow _sdpd -q > /dev/null) || \
118		pw -V ${DESTDIR}/etc groupadd _sdpd -g 70
119	(pw -V ${DESTDIR}/etc groupshow _dhcp -q > /dev/null) || \
120		pw -V ${DESTDIR}/etc groupadd _dhcp -g 77
121
122upgrade_check:
123	@if [ -n "`grep '^sendmail.*/usr/libexec/sendmail/sendmail' ${DESTDIR}/etc/mail/mailer.conf`" ]; then \
124		echo "==================================================================" ; \
125		echo "=  sendmail is being removed from the base system." ; \
126		echo "=  /etc/mail/mailer.conf is still configured to use sendmail." ; \
127		echo "=  See http://www.dragonflybsd.com/docs/docs/newhandbook/mta/" ; \
128		echo "=  Quick: cp /usr/src/libexec/dma/mailer-conf/mailer.conf.dma " ; \
129		echo "=            ${DESTDIR}/etc/mail/mailer.conf ; make upgrade" ; \
130		echo "==================================================================" ; \
131		/usr/bin/false ; \
132	fi
133
134upgrade_etc:	upgrade_check preupgrade remove-obsolete-files
135	# files that should be dirs (not possible with Makefile_upgrade.inc)
136.for f in usr/include/dev/misc/ppi usr/share/initrd/sbin
137	[ -d ${DESTDIR}/${f} ] || rm -f ${DESTDIR}/${f}
138.endfor
139.if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
140	cd ${UPGRADE_SRCDIR}/../share/mk; ${MAKE} install
141.endif
142	cd ${UPGRADE_SRCDIR}; \
143	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
144		${BINUPDATE} ${DESTDIR}/etc; \
145	    cap_mkdb ${DESTDIR}/etc/login.conf; \
146	    for f in ${BIN1}; do \
147		[ -e "${DESTDIR}/etc/$${f##*/}" ] || \
148		    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
149			$$f ${DESTDIR}/etc; \
150	    done; \
151	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
152		${BIN2} ${DESTDIR}/etc;
153	cd ${UPGRADE_SRCDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
154	    ${DEFAULTS} ${DESTDIR}/etc/defaults
155	cd ${UPGRADE_SRCDIR}/periodic; ${MAKE} install
156	mkdir -p ${DESTDIR}/etc/rc.d
157	cd ${UPGRADE_SRCDIR}/rc.d; ${MAKE} install
158	cd ${UPGRADE_SRCDIR}/devd; ${MAKE} install
159	mkdir -p ${DESTDIR}/etc/autofs
160	cd ${UPGRADE_SRCDIR}/autofs; ${MAKE} install
161	# "../share/termcap/make etc-termcap" expanded inline here:
162	${LN} -fs /usr/share/misc/termcap ${DESTDIR}/etc/termcap
163	# "../usr.sbin/rmt/make etc-rmt" expanded inline here:
164	${LN} -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt
165	cd ${UPGRADE_SRCDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
166	    ${MTREE} ${DESTDIR}/etc/mtree
167	cd ${UPGRADE_SRCDIR}/bluetooth; ${MAKE} install
168	cd ${UPGRADE_SRCDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 Makefile.usr ${DESTDIR}/usr/Makefile
169.if !exists(${DESTDIR}/etc/pam.d)
170	mkdir -p ${DESTDIR}/etc/pam.d
171	cd ${UPGRADE_SRCDIR}/pam.d; ${MAKE} install
172	sh ${DESTDIR}/etc/pam.d/convert.sh ${DESTDIR}/etc/pam.d ${DESTDIR}/etc/pam.conf
173.else
174.for pamconf in README convert.sh atrun cron passwd rsh su system
175.if !exists(${DESTDIR}/etc/pam.d/${pamconf})
176	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${UPGRADE_SRCDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
177.endif
178.endfor
179.endif
180	# these removals must occur AFTER any pam conversion
181	csh -c "rm -f /usr/lib/pam_{cleartext_pass_ok,deny,opie,opieaccess,permit,radius,skey,ssh,tacplus,unix}.so"
182	rm -f /etc/pam.conf
183.if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
184	cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
185	    COPYRIGHT ${DESTDIR}/
186.endif
187	rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
188	rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
189	rm -f ${DESTDIR}/usr/include/sys/ata.h
190	${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
191	${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
192	${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
193.if exists(${DESTDIR}/usr/lib/gcc2)
194	ldconfig -m ${DESTDIR}/usr/lib/gcc2
195.endif
196.for lib in ${COMPAT_LIBS:M*.so.*}
197.if exists(${DESTDIR}/usr/lib/${lib})
198	chflags noschg ${DESTDIR}/usr/lib/${lib}
199	rm -f ${DESTDIR}/usr/lib/${lib}
200.endif
201.endfor
202	cd ${.CURDIR}/../lib/libssh; ${MAKE} -f Makefile.etc obj
203	cd ${.CURDIR}/../lib/libssh; ${MAKE} -f Makefile.etc install
204.if exists(${DESTDIR}/boot)
205.if exists(${DESTDIR}/kernel)
206	chflags noschg ${DESTDIR}/kernel
207	mv ${DESTDIR}/kernel ${DESTDIR}/boot/kernel
208	chflags schg ${DESTDIR}/boot/kernel
209.endif
210.if exists(${DESTDIR}/modules)
211	mv ${DESTDIR}/modules ${DESTDIR}/boot/modules
212	rm -rf ${DESTDIR}/boot/modules/modules
213.endif
214.if exists(${DESTDIR}/kernel.old)
215	mv ${DESTDIR}/kernel.old ${DESTDIR}/boot/kernel.old
216.endif
217.if exists(${DESTDIR}/modules.old)
218	mv ${DESTDIR}/modules.old ${DESTDIR}/boot/modules.old
219	rm -rf ${DESTDIR}/boot/modules.old/modules.old
220.endif
221.endif
222.if exists(${DESTDIR}/etc/settings.conf)
223	mv ${DESTDIR}/etc/settings.conf ${DESTDIR}/etc/pkg_radd.conf
224.endif
225	for ext in a so.0; do \
226		f=${DESTDIR}/usr/lib/libpthread.$$ext; \
227		dest=$$(readlink "$$f"); \
228		case "$$dest" in \
229		libthread_xu.*|libc_r.*) \
230			ln -fs thread/$$dest $$f ;; \
231		esac; \
232	done
233	ldconfig -R
234	mkdir -p ${DESTDIR}/dev
235	mkdir -p ${DESTDIR}/var/run/sem
236	chmod 1777 ${DESTDIR}/var/run/sem
237
238# The existence of cleartext_pass_ok means pam config files are out of date.
239	@set - `fgrep cleartext_pass_ok ${DESTDIR}/etc/pam.d/*`; \
240	if [ $$# -gt 0 ] ; \
241	then \
242		echo "It appears your PAM configuration files need to be updated"; \
243		echo "This can be done by manually editing the files or:"; \
244		echo "	cd ${UPGRADE_SRCDIR}/pam.d"; \
245		echo "	make install"; \
246	fi
247
248distribution:
249	cd ${.CURDIR}; \
250	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
251		${BINUPDATE} ${DESTDIR}/etc; \
252	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
253		${BIN1} ${DESTDIR}/etc; \
254	    cap_mkdb ${DESTDIR}/etc/login.conf; \
255	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
256		${BIN2} ${DESTDIR}/etc; \
257	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
258		master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
259	    pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
260	cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
261	    ${DEFAULTS} ${DESTDIR}/etc/defaults
262	cd ${.CURDIR}/pam.d; ${MAKE} install
263	cd ${.CURDIR}/bluetooth; ${MAKE} install
264	cd ${.CURDIR}/periodic; ${MAKE} install
265	cd ${.CURDIR}/rc.d; ${MAKE} install
266	cd ${.CURDIR}/devd; ${MAKE} install
267	cd ${.CURDIR}/autofs; ${MAKE} install
268	cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
269	cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
270	cd ${.CURDIR}; \
271	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
272		Makefile.usr ${DESTDIR}/usr/Makefile
273.for dir in ${DIRS}
274.if exists(${.CURDIR}/../${dir}/Makefile.etc)
275	cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc obj
276	cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc install
277.endif
278.endfor
279	mkdir -p ${DESTDIR}/dev
280	cd ${.CURDIR}/root; \
281	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
282		dot.cshrc ${DESTDIR}/root/.cshrc; \
283	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
284		dot.klogin ${DESTDIR}/root/.klogin; \
285	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
286		dot.login ${DESTDIR}/root/.login; \
287	    ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
288		dot.profile ${DESTDIR}/root/.profile; \
289	    rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
290	cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
291	    ${MTREE} ${DESTDIR}/etc/mtree
292	cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
293	    ${PPPCNF} ${DESTDIR}/etc/ppp
294	cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
295	    ${ETCMAIL} ${DESTDIR}/etc/mail
296	@if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
297	      ! -f ${DESTDIR}/etc/aliases ]; then \
298		set -x; \
299		${LN} -s mail/aliases ${DESTDIR}/etc/aliases; \
300	fi
301	${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
302	    ${DESTDIR}/etc/dumpdates
303	${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
304	    ${DESTDIR}/var/db/locate.database
305	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
306	    ${DESTDIR}/var/log/auth.log
307	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
308	    ${DESTDIR}/var/log/cron
309	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
310	    ${DESTDIR}/var/log/daemon
311	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
312	    ${DESTDIR}/var/log/lpd-errs
313	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
314	    ${DESTDIR}/var/log/maillog
315	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
316	    ${DESTDIR}/var/log/lastlog
317	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
318	    ${DESTDIR}/var/log/lastlogx
319	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
320	    ${DESTDIR}/var/log/messages
321	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
322	    ${DESTDIR}/var/log/security
323	${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
324	    ${DESTDIR}/var/log/slip.log
325	${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
326	    ${DESTDIR}/var/log/ppp.log
327	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
328	    ${DESTDIR}/var/log/wtmp
329	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
330	    ${DESTDIR}/var/log/wtmpx
331	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
332	    ${DESTDIR}/var/run/utmp
333	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
334	    ${DESTDIR}/var/run/utmpx
335	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
336	    ${DESTDIR}/var/crash
337	cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
338	    COPYRIGHT ${DESTDIR}/
339	rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
340	rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
341	rm -f ${DESTDIR}/usr/include/sys/ata.h
342	${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
343	${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
344	${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
345.if !defined(NOMAN)
346	cd ${.CURDIR}/../share/man; ${MAKE} makedb
347.endif
348
349#
350#
351distrib-dirs:
352	mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
353	mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
354	mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
355	mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
356		-p ${DESTDIR}/usr/include
357	-chflags xlink ${DESTDIR}/* ${DESTDIR}/usr/* ${DESTDIR}/var/* \
358			${DESTDIR}/home/*
359	cd ${DESTDIR}/; test -e sys || (rm -f sys;  ${LN} -s usr/src/sys sys)
360	cd ${DESTDIR}/usr/share/nls; \
361	set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
362	while [ $$# -gt 0 ] ; \
363	do \
364		rm -rf "$$1"; \
365		${LN} -s "$$2" "$$1"; \
366		shift; shift; \
367	done
368
369etc-examples:
370	cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
371	    ${BINUPDATE} ${BIN1} ${BIN2} nsmb.conf opieaccess \
372	    ${DESTDIR}/usr/share/examples/etc
373	cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
374	    ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
375
376.include <bsd.prog.mk>
377