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