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