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 $
6 # Files that should be installed read-only (444)
8 BINUPDATE= devd.conf fbtab network.subr \
11 rc rc.firewall rc.firewall6 \
12 rc.sendmail rc.shutdown \
14 etc.${MACHINE_ARCH}/disktab
15 .if defined(BINARY_UPGRADE) # location of these depends on upgrade method
16 BINUPDATE+=mail.rc locate.rc
18 BINUPDATE+=${.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
24 # Initial distribution files are installed read-write (644)
27 crontab csh.cshrc csh.login csh.logout \
28 devtab dhclient.conf dntpd.conf \
29 ftpusers gettytab 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 \
37 etc.${MACHINE_ARCH}/ttys
39 DIRS+= lib/libssh usr.bin/openssl usr.bin/ssh usr.sbin/sshd
41 # Files that should be installed read-only-executable (555) root:wheel
43 BIN2= pccard_ether rc.suspend rc.resume
45 DEFAULTS= compilers.conf devfs.conf make.conf periodic.conf \
46 pfi.conf rc.conf uuids
48 MTREE= BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist
55 ETCMAIL=aliases mailer.conf access.sample virtusertable.sample \
58 # Use this directory as the source for new configuration files when upgrading
59 UPGRADE_SRCDIR?=${.CURDIR}
61 CHECK_DEPRECATED_DIRS+= /usr/local
63 # Include file which contains obsolete files
64 .if exists(${DESTDIR}/etc/upgrade/Makefile_upgrade.inc)
65 .include "${DESTDIR}/etc/upgrade/Makefile_upgrade.inc"
68 remove-obsolete-files:
69 @if [ -z "${TO_REMOVE}" ]; then \
70 echo "Please do a 'make installworld' first."; \
71 echo "See build(7) for further information."; \
74 @echo "===> Remove now obsolete files"
75 @for item in ${TO_REMOVE}; do \
76 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
77 echo "${DESTDIR}$${item}"; \
78 chflags -Rf noschg "${DESTDIR}$${item}"; \
79 rm -rf "${DESTDIR}$${item}"; \
83 remove-deprecated-files:
84 .if defined(REMOVE_DEPRECATED)
85 @echo "===> Remove now deprecated files"
86 @for item in ${TO_REMOVE_LATE}; do \
87 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
88 echo "${DESTDIR}$${item}"; \
89 chflags -Rf noschg "${DESTDIR}$${item}"; \
90 rm -rf "${DESTDIR}$${item}"; \
94 @make check-deprecated-files
97 check-deprecated-files:
98 @echo "===> Checking for deprecated files"
99 @tmpldd=`mktemp -t chkldd`; \
100 chroot ${DESTDIR}/ find ${CHECK_DEPRECATED_DIRS:O:u} \
101 -type f \( -name '*.so*' -o -perm +111 \) | \
102 chroot ${DESTDIR}/ xargs ldd 2>/dev/null > $${tmpldd}; \
103 count=0; for item in ${TO_REMOVE_LATE}; do \
104 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
105 echo "${DESTDIR}$${item} is deprecated"; \
107 for object in `cat $${tmpldd} | awk -v library=$${item} \
108 -f ${.CURDIR}/../tools/tools/chkldd/chkldd.awk`; do \
109 echo "${TO_REMOVE_LATE}" | grep -q "$${object}" \
110 || deps="$${deps} $${object}"; \
112 if [ -n "$${deps}" ]; then \
113 echo " but it's still linked from these objects:"; \
117 count=`expr $$count + 1`; \
121 if [ "$$count" -gt 0 ]; then \
122 echo "==================================================================" ; \
123 echo "= You have $$count now deprecated files." ; \
124 echo "= Once you are sure that none of your third party (ports or local)" ; \
125 echo "= software are still using them, rerun with:" ; \
126 echo "= make upgrade -DREMOVE_DEPRECATED" ; \
127 echo "==================================================================" ; \
131 (pw -V ${DESTDIR}/etc usershow mail -q > /dev/null) || \
132 pw -V ${DESTDIR}/etc useradd mail -u 6 -g 6 \
134 -d /nonexistent -s /sbin/nologin
135 (pw -V ${DESTDIR}/etc usershow _pflogd -q > /dev/null) || \
136 pw -V ${DESTDIR}/etc useradd _pflogd -u 64 \
137 -c "pflogd privsep user" \
138 -d /var/empty -s /sbin/nologin
139 (pw -V ${DESTDIR}/etc usershow _sdpd -q > /dev/null) || \
140 pw -V ${DESTDIR}/etc useradd _sdpd -u 70 \
141 -c "sdpd privsep user" \
142 -d /var/empty -s /sbin/nologin
143 (pw -V ${DESTDIR}/etc usershow _dhcp -q > /dev/null) || \
144 pw -V ${DESTDIR}/etc useradd _dhcp -u 77 \
146 -d /var/empty -s /sbin/nologin
147 (pw -V ${DESTDIR}/etc groupshow input -q > /dev/null) || \
148 pw -V ${DESTDIR}/etc groupadd input -g 43
149 (pw -V ${DESTDIR}/etc groupshow video -q > /dev/null) || \
150 pw -V ${DESTDIR}/etc groupadd video -g 44
151 (pw -V ${DESTDIR}/etc groupshow authpf -q > /dev/null) || \
152 pw -V ${DESTDIR}/etc groupadd authpf -g 63
153 (pw -V ${DESTDIR}/etc groupshow _pflogd -q > /dev/null) || \
154 pw -V ${DESTDIR}/etc groupadd _pflogd -g 64
155 (pw -V ${DESTDIR}/etc groupshow _sdpd -q > /dev/null) || \
156 pw -V ${DESTDIR}/etc groupadd _sdpd -g 70
157 (pw -V ${DESTDIR}/etc groupshow _dhcp -q > /dev/null) || \
158 pw -V ${DESTDIR}/etc groupadd _dhcp -g 77
161 @if [ -n "`grep '^sendmail.*/usr/libexec/sendmail/sendmail' ${DESTDIR}/etc/mail/mailer.conf`" ]; then \
162 echo "==================================================================" ; \
163 echo "= sendmail is being removed from the base system." ; \
164 echo "= /etc/mail/mailer.conf is still configured to use sendmail." ; \
165 echo "= See http://www.dragonflybsd.com/docs/docs/newhandbook/mta/" ; \
166 echo "= Quick: cp /usr/src/libexec/dma/mailer-conf/mailer.conf.dma " ; \
167 echo "= ${DESTDIR}/etc/mail/mailer.conf ; make upgrade" ; \
168 echo "==================================================================" ; \
172 upgrade_base: upgrade_check preupgrade remove-obsolete-files
173 # files that should be dirs (not possible with Makefile_upgrade.inc)
174 .for f in usr/include/dev/misc/ppi usr/share/initrd/sbin var/db/entropy
175 [ -d ${DESTDIR}/${f} ] || rm -f ${DESTDIR}/${f}
177 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
178 cd ${UPGRADE_SRCDIR}/../share/mk; ${MAKE} install
180 cd ${UPGRADE_SRCDIR}; \
181 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
182 ${BINUPDATE} ${DESTDIR}/etc; \
183 cap_mkdb ${DESTDIR}/etc/login.conf; \
184 for f in ${BIN1}; do \
185 [ -e "${DESTDIR}/etc/$${f##*/}" ] || \
186 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
187 $$f ${DESTDIR}/etc; \
189 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
190 ${BIN2} ${DESTDIR}/etc;
191 cd ${UPGRADE_SRCDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
192 ${DEFAULTS} ${DESTDIR}/etc/defaults
193 cd ${UPGRADE_SRCDIR}/periodic; ${MAKE} install
194 mkdir -p ${DESTDIR}/etc/rc.d
195 cd ${UPGRADE_SRCDIR}/rc.d; ${MAKE} install
196 cd ${UPGRADE_SRCDIR}/devd; ${MAKE} install
197 # "../share/termcap/make etc-termcap" expanded inline here:
198 ${LN} -fs /usr/share/misc/termcap ${DESTDIR}/etc/termcap
199 # "../usr.sbin/rmt/make etc-rmt" expanded inline here:
200 ${LN} -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt
201 cd ${UPGRADE_SRCDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
202 ${MTREE} ${DESTDIR}/etc/mtree
203 cd ${UPGRADE_SRCDIR}/bluetooth; ${MAKE} install
204 cd ${UPGRADE_SRCDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 Makefile.usr ${DESTDIR}/usr/Makefile
205 .if !exists(${DESTDIR}/etc/pam.d)
206 mkdir -p ${DESTDIR}/etc/pam.d
207 cd ${UPGRADE_SRCDIR}/pam.d; ${MAKE} install
208 sh ${DESTDIR}/etc/pam.d/convert.sh ${DESTDIR}/etc/pam.d ${DESTDIR}/etc/pam.conf
210 .for pamconf in README convert.sh atrun cron passwd su system
211 .if !exists(${DESTDIR}/etc/pam.d/${pamconf})
212 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${UPGRADE_SRCDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
216 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
217 cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
218 COPYRIGHT ${DESTDIR}/
220 rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
221 rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
222 ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
223 ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
224 .if exists(${DESTDIR}/usr/lib/gcc2)
225 ldconfig -m ${DESTDIR}/usr/lib/gcc2
227 .for lib in ${COMPAT_LIBS:M*.so.*}
228 .if exists(${DESTDIR}/usr/lib/${lib})
229 chflags noschg ${DESTDIR}/usr/lib/${lib}
230 rm -f ${DESTDIR}/usr/lib/${lib}
233 cd ${.CURDIR}/../lib/libssh; ${MAKE} -f Makefile.etc install
234 .if exists(${DESTDIR}/boot)
235 .if exists(${DESTDIR}/kernel)
236 chflags noschg ${DESTDIR}/kernel
237 mv ${DESTDIR}/kernel ${DESTDIR}/boot/kernel
238 chflags schg ${DESTDIR}/boot/kernel
240 .if exists(${DESTDIR}/modules)
241 mv ${DESTDIR}/modules ${DESTDIR}/boot/modules
242 rm -rf ${DESTDIR}/boot/modules/modules
244 .if exists(${DESTDIR}/kernel.old)
245 mv ${DESTDIR}/kernel.old ${DESTDIR}/boot/kernel.old
247 .if exists(${DESTDIR}/modules.old)
248 mv ${DESTDIR}/modules.old ${DESTDIR}/boot/modules.old
249 rm -rf ${DESTDIR}/boot/modules.old/modules.old
252 .if exists(${DESTDIR}/etc/settings.conf)
253 mv ${DESTDIR}/etc/settings.conf ${DESTDIR}/etc/pkg_radd.conf
255 for ext in a so.0; do \
256 f=${DESTDIR}/usr/lib/libpthread.$$ext; \
257 dest=$$(readlink "$$f"); \
260 ln -fs thread/$$dest $$f ;; \
264 mkdir -p ${DESTDIR}/dev
265 mkdir -p ${DESTDIR}/var/run/sem
266 chmod 1777 ${DESTDIR}/var/run/sem
268 # The existence of cleartext_pass_ok means pam config files are out of date.
269 @set - `fgrep -e cleartext_pass_ok -e pam_opie ${DESTDIR}/etc/pam.d/*`; \
272 echo "It appears your PAM configuration files need to be updated"; \
273 echo "This can be done by manually editing the files or:"; \
274 echo " cd ${UPGRADE_SRCDIR}/pam.d"; \
275 echo " make install"; \
278 # Move the dhcpcd duid, secret and lease files back outside the chroot.
279 # Then ensure the chroot is empty.
280 DHCPCD_DB="${DESTDIR}/var/db/dhcpcd"; \
281 DHCPCD_CHROOT=`pw -V ${DESTDIR}/etc usershow _dhcp | cut -d: -f9`; \
282 DHCPCD_CHROOT_DB="${DESTDIR}$$DHCPCD_CHROOT/var/db/dhcpcd"; \
283 if [ -f "$$DHCPCD_CHROOT_DB/duid" ] && \
284 [ ! -f "$$DHCPCD_DB/duid" ]; then \
285 mkdir -p "$$DHCPCD_DB" && \
286 mv "$$DHCPCD_CHROOT_DB"/* "$$DHCPCD_DB"; \
287 chown -R root:wheel "$$DHCPCD_DB"; \
288 rm -rf "$$DHCPCD_CHROOT"/*; \
290 if [ "$$DHCPCD_CHROOT" != /var/empty ]; then \
291 pw -V ${DESTDIR}/etc usermod _dhcp -d /var/empty; \
292 rm -rf "$$DHCPCD_CHROOT"; \
295 upgrade_etc: upgrade_base remove-deprecated-files
296 @echo "Upgrade was successful"
300 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
301 ${BINUPDATE} ${DESTDIR}/etc; \
302 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
303 ${BIN1} ${DESTDIR}/etc; \
304 cap_mkdb ${DESTDIR}/etc/login.conf; \
305 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
306 ${BIN2} ${DESTDIR}/etc; \
307 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
308 master.passwd nsmb.conf ${DESTDIR}/etc; \
309 pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
310 cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
311 ${DEFAULTS} ${DESTDIR}/etc/defaults
312 cd ${.CURDIR}/pam.d; ${MAKE} install
313 cd ${.CURDIR}/bluetooth; ${MAKE} install
314 cd ${.CURDIR}/periodic; ${MAKE} install
315 cd ${.CURDIR}/rc.d; ${MAKE} install
316 cd ${.CURDIR}/devd; ${MAKE} install
317 cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
318 cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
320 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
321 Makefile.usr ${DESTDIR}/usr/Makefile
323 .if exists(${.CURDIR}/../${dir}/Makefile.etc)
324 cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc obj
325 cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc install
328 mkdir -p ${DESTDIR}/dev
329 cd ${.CURDIR}/../share/skel; \
330 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
331 dot.cshrc ${DESTDIR}/root/.cshrc; \
332 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
333 dot.login ${DESTDIR}/root/.login; \
334 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
335 dot.profile ${DESTDIR}/root/.profile; \
336 rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
337 cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
338 ${MTREE} ${DESTDIR}/etc/mtree
339 cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
340 ${PPPCNF} ${DESTDIR}/etc/ppp
341 cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
342 ${ETCMAIL} ${DESTDIR}/etc/mail
343 @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
344 ! -f ${DESTDIR}/etc/aliases ]; then \
346 ${LN} -s mail/aliases ${DESTDIR}/etc/aliases; \
348 ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
349 ${DESTDIR}/etc/dumpdates
350 ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
351 ${DESTDIR}/var/db/locate.database
352 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
353 ${DESTDIR}/var/log/auth.log
354 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
355 ${DESTDIR}/var/log/cron
356 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
357 ${DESTDIR}/var/log/daemon
358 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
359 ${DESTDIR}/var/log/lpd-errs
360 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
361 ${DESTDIR}/var/log/maillog
362 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
363 ${DESTDIR}/var/log/lastlogx
364 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
365 ${DESTDIR}/var/log/messages
366 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
367 ${DESTDIR}/var/log/security
368 ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
369 ${DESTDIR}/var/log/slip.log
370 ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
371 ${DESTDIR}/var/log/ppp.log
372 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
373 ${DESTDIR}/var/log/wtmpx
374 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
375 ${DESTDIR}/var/run/utmpx
376 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
378 cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
379 COPYRIGHT ${DESTDIR}/
380 rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
381 rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
382 ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
383 ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
385 cd ${.CURDIR}/../share/man; ${MAKE} makedb
391 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.root.dist \
393 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.var.dist \
395 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.usr.dist \
397 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.include.dist \
398 -p ${DESTDIR}/usr/include
399 -chflags xlink ${DESTDIR}/* ${DESTDIR}/usr/* ${DESTDIR}/var/* \
401 cd ${DESTDIR}/; test -e sys || (rm -f sys; ${LN} -s usr/src/sys sys)
402 .if !defined(NO_SHARE)
403 cd ${DESTDIR}/usr/share/nls; \
405 rm -rf "en_US.US-ASCII"; \
406 ${LN} -s "C" "POSIX"; \
407 ${LN} -s "C" "en_US.US-ASCII"
411 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
412 ${BINUPDATE} ${BIN1} ${BIN2} nsmb.conf \
413 ${DESTDIR}/usr/share/examples/etc
414 cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
415 ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
417 .include <bsd.prog.mk>