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 @echo " (harmless ELF linker warnings may appear here)"
100 @tmpldd=`mktemp -t chkldd`; \
101 chroot ${DESTDIR}/ find ${CHECK_DEPRECATED_DIRS:O:u} \
102 -type f \( -name '*.so*' -o -perm +111 \) | \
103 chroot ${DESTDIR}/ xargs ldd 2>/dev/null > $${tmpldd}; \
104 count=0; for item in ${TO_REMOVE_LATE}; do \
105 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
106 echo "${DESTDIR}$${item} is deprecated"; \
108 for object in `cat $${tmpldd} | awk -v library=$${item} \
109 -f ${.CURDIR}/../tools/tools/chkldd/chkldd.awk`; do \
110 echo "${TO_REMOVE_LATE}" | grep -q "$${object}" \
111 || deps="$${deps} $${object}"; \
113 if [ -n "$${deps}" ]; then \
114 echo " but it's still linked from these objects:"; \
118 count=`expr $$count + 1`; \
122 if [ "$$count" -gt 0 ]; then \
123 echo "==================================================================" ; \
124 echo "= You have $$count now deprecated files." ; \
125 echo "= Once you are sure that none of your third party (ports or local)" ; \
126 echo "= software are still using them, rerun with:" ; \
127 echo "= make upgrade -DREMOVE_DEPRECATED" ; \
128 echo "==================================================================" ; \
132 (pw -V ${DESTDIR}/etc usershow mail -q > /dev/null) || \
133 pw -V ${DESTDIR}/etc useradd mail -u 6 -g 6 \
135 -d /nonexistent -s /sbin/nologin
136 (pw -V ${DESTDIR}/etc usershow _pflogd -q > /dev/null) || \
137 pw -V ${DESTDIR}/etc useradd _pflogd -u 64 \
138 -c "pflogd privsep user" \
139 -d /var/empty -s /sbin/nologin
140 (pw -V ${DESTDIR}/etc usershow _sdpd -q > /dev/null) || \
141 pw -V ${DESTDIR}/etc useradd _sdpd -u 70 \
142 -c "sdpd privsep user" \
143 -d /var/empty -s /sbin/nologin
144 (pw -V ${DESTDIR}/etc usershow _dhcp -q > /dev/null) || \
145 pw -V ${DESTDIR}/etc useradd _dhcp -u 77 \
147 -d /var/empty -s /sbin/nologin
148 (pw -V ${DESTDIR}/etc groupshow input -q > /dev/null) || \
149 pw -V ${DESTDIR}/etc groupadd input -g 43
150 (pw -V ${DESTDIR}/etc groupshow video -q > /dev/null) || \
151 pw -V ${DESTDIR}/etc groupadd video -g 44
152 (pw -V ${DESTDIR}/etc groupshow authpf -q > /dev/null) || \
153 pw -V ${DESTDIR}/etc groupadd authpf -g 63
154 (pw -V ${DESTDIR}/etc groupshow _pflogd -q > /dev/null) || \
155 pw -V ${DESTDIR}/etc groupadd _pflogd -g 64
156 (pw -V ${DESTDIR}/etc groupshow _sdpd -q > /dev/null) || \
157 pw -V ${DESTDIR}/etc groupadd _sdpd -g 70
158 (pw -V ${DESTDIR}/etc groupshow _dhcp -q > /dev/null) || \
159 pw -V ${DESTDIR}/etc groupadd _dhcp -g 77
162 @if [ -n "`grep '^sendmail.*/usr/libexec/sendmail/sendmail' ${DESTDIR}/etc/mail/mailer.conf`" ]; then \
163 echo "==================================================================" ; \
164 echo "= sendmail is being removed from the base system." ; \
165 echo "= /etc/mail/mailer.conf is still configured to use sendmail." ; \
166 echo "= See http://www.dragonflybsd.com/docs/docs/newhandbook/mta/" ; \
167 echo "= Quick: cp /usr/src/libexec/dma/mailer-conf/mailer.conf.dma " ; \
168 echo "= ${DESTDIR}/etc/mail/mailer.conf ; make upgrade" ; \
169 echo "==================================================================" ; \
173 upgrade_base: upgrade_check preupgrade remove-obsolete-files
174 # files that should be dirs (not possible with Makefile_upgrade.inc)
175 .for f in usr/include/dev/misc/ppi usr/share/initrd/sbin var/db/entropy
176 [ -d ${DESTDIR}/${f} ] || rm -f ${DESTDIR}/${f}
178 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
179 cd ${UPGRADE_SRCDIR}/../share/mk; ${MAKE} install
181 cd ${UPGRADE_SRCDIR}; \
182 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
183 ${BINUPDATE} ${DESTDIR}/etc; \
184 cap_mkdb ${DESTDIR}/etc/login.conf; \
185 for f in ${BIN1}; do \
186 [ -e "${DESTDIR}/etc/$${f##*/}" ] || \
187 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
188 $$f ${DESTDIR}/etc; \
190 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
191 ${BIN2} ${DESTDIR}/etc;
192 cd ${UPGRADE_SRCDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
193 ${DEFAULTS} ${DESTDIR}/etc/defaults
194 cd ${UPGRADE_SRCDIR}/periodic; ${MAKE} install
195 mkdir -p ${DESTDIR}/etc/rc.d
196 cd ${UPGRADE_SRCDIR}/rc.d; ${MAKE} install
197 cd ${UPGRADE_SRCDIR}/devd; ${MAKE} install
198 # "../share/termcap/make etc-termcap" expanded inline here:
199 ${LN} -fs /usr/share/misc/termcap ${DESTDIR}/etc/termcap
200 # "../usr.sbin/rmt/make etc-rmt" expanded inline here:
201 ${LN} -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt
202 cd ${UPGRADE_SRCDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
203 ${MTREE} ${DESTDIR}/etc/mtree
204 cd ${UPGRADE_SRCDIR}/bluetooth; ${MAKE} install
205 cd ${UPGRADE_SRCDIR}/calendar; ${MAKE} install
206 cd ${UPGRADE_SRCDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 Makefile.usr ${DESTDIR}/usr/Makefile
207 .if !exists(${DESTDIR}/etc/pam.d)
208 mkdir -p ${DESTDIR}/etc/pam.d
209 cd ${UPGRADE_SRCDIR}/pam.d; ${MAKE} install
210 sh ${DESTDIR}/etc/pam.d/convert.sh ${DESTDIR}/etc/pam.d ${DESTDIR}/etc/pam.conf
212 .for pamconf in README convert.sh atrun cron passwd su system
213 .if !exists(${DESTDIR}/etc/pam.d/${pamconf})
214 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${UPGRADE_SRCDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
218 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
219 cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
220 COPYRIGHT ${DESTDIR}/
222 rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
223 rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
224 ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
225 ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
226 .if exists(${DESTDIR}/usr/lib/gcc2)
227 ldconfig -m ${DESTDIR}/usr/lib/gcc2
229 .for lib in ${COMPAT_LIBS:M*.so.*}
230 .if exists(${DESTDIR}/usr/lib/${lib})
231 chflags noschg ${DESTDIR}/usr/lib/${lib}
232 rm -f ${DESTDIR}/usr/lib/${lib}
235 cd ${.CURDIR}/../lib/libssh; ${MAKE} -f Makefile.etc install
236 .if exists(${DESTDIR}/boot)
237 .if exists(${DESTDIR}/kernel)
238 chflags noschg ${DESTDIR}/kernel
239 mv ${DESTDIR}/kernel ${DESTDIR}/boot/kernel
240 chflags schg ${DESTDIR}/boot/kernel
242 .if exists(${DESTDIR}/modules)
243 mv ${DESTDIR}/modules ${DESTDIR}/boot/modules
244 rm -rf ${DESTDIR}/boot/modules/modules
246 .if exists(${DESTDIR}/kernel.old)
247 mv ${DESTDIR}/kernel.old ${DESTDIR}/boot/kernel.old
249 .if exists(${DESTDIR}/modules.old)
250 mv ${DESTDIR}/modules.old ${DESTDIR}/boot/modules.old
251 rm -rf ${DESTDIR}/boot/modules.old/modules.old
254 .if exists(${DESTDIR}/etc/settings.conf)
255 mv ${DESTDIR}/etc/settings.conf ${DESTDIR}/etc/pkg_radd.conf
257 for ext in a so.0; do \
258 f=${DESTDIR}/usr/lib/libpthread.$$ext; \
259 dest=$$(readlink "$$f"); \
262 ln -fs thread/$$dest $$f ;; \
266 mkdir -p ${DESTDIR}/dev
267 mkdir -p ${DESTDIR}/var/run/sem
268 chmod 1777 ${DESTDIR}/var/run/sem
270 # The existence of cleartext_pass_ok means pam config files are out of date.
271 @set - `fgrep -e cleartext_pass_ok -e pam_opie ${DESTDIR}/etc/pam.d/*`; \
274 echo "It appears your PAM configuration files need to be updated"; \
275 echo "This can be done by manually editing the files or:"; \
276 echo " cd ${UPGRADE_SRCDIR}/pam.d"; \
277 echo " make install"; \
280 # Move the dhcpcd duid, secret and lease files back outside the chroot.
281 # Then ensure the chroot is empty.
282 DHCPCD_DB="${DESTDIR}/var/db/dhcpcd"; \
283 DHCPCD_CHROOT=`pw -V ${DESTDIR}/etc usershow _dhcp | cut -d: -f9`; \
284 DHCPCD_CHROOT_DB="${DESTDIR}$$DHCPCD_CHROOT/var/db/dhcpcd"; \
285 if [ -f "$$DHCPCD_CHROOT_DB/duid" ] && \
286 [ ! -f "$$DHCPCD_DB/duid" ]; then \
287 mkdir -p "$$DHCPCD_DB" && \
288 mv "$$DHCPCD_CHROOT_DB"/* "$$DHCPCD_DB"; \
289 chown -R root:wheel "$$DHCPCD_DB"; \
290 rm -rf "$$DHCPCD_CHROOT"/*; \
292 if [ "$$DHCPCD_CHROOT" != /var/empty ]; then \
293 pw -V ${DESTDIR}/etc usermod _dhcp -d /var/empty; \
294 rm -rf "$$DHCPCD_CHROOT"; \
297 upgrade_etc: upgrade_base remove-deprecated-files
298 @echo "Upgrade was successful"
302 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
303 ${BINUPDATE} ${DESTDIR}/etc; \
304 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
305 ${BIN1} ${DESTDIR}/etc; \
306 cap_mkdb ${DESTDIR}/etc/login.conf; \
307 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
308 ${BIN2} ${DESTDIR}/etc; \
309 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
310 master.passwd nsmb.conf ${DESTDIR}/etc; \
311 pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
312 cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
313 ${DEFAULTS} ${DESTDIR}/etc/defaults
314 cd ${.CURDIR}/pam.d; ${MAKE} install
315 cd ${.CURDIR}/bluetooth; ${MAKE} install
316 cd ${.CURDIR}/calendar; ${MAKE} install
317 cd ${.CURDIR}/periodic; ${MAKE} install
318 cd ${.CURDIR}/rc.d; ${MAKE} install
319 cd ${.CURDIR}/devd; ${MAKE} install
320 cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
321 cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
323 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
324 Makefile.usr ${DESTDIR}/usr/Makefile
326 .if exists(${.CURDIR}/../${dir}/Makefile.etc)
327 cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc obj
328 cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc install
331 mkdir -p ${DESTDIR}/dev
332 cd ${.CURDIR}/../share/skel; \
333 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
334 dot.cshrc ${DESTDIR}/root/.cshrc; \
335 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
336 dot.login ${DESTDIR}/root/.login; \
337 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
338 dot.profile ${DESTDIR}/root/.profile; \
339 rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
340 cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
341 ${MTREE} ${DESTDIR}/etc/mtree
342 cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
343 ${PPPCNF} ${DESTDIR}/etc/ppp
344 cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
345 ${ETCMAIL} ${DESTDIR}/etc/mail
346 @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
347 ! -f ${DESTDIR}/etc/aliases ]; then \
349 ${LN} -s mail/aliases ${DESTDIR}/etc/aliases; \
351 ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
352 ${DESTDIR}/etc/dumpdates
353 ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
354 ${DESTDIR}/var/db/locate.database
355 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
356 ${DESTDIR}/var/log/auth.log
357 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
358 ${DESTDIR}/var/log/cron
359 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
360 ${DESTDIR}/var/log/daemon
361 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
362 ${DESTDIR}/var/log/lpd-errs
363 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
364 ${DESTDIR}/var/log/maillog
365 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
366 ${DESTDIR}/var/log/lastlogx
367 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
368 ${DESTDIR}/var/log/messages
369 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
370 ${DESTDIR}/var/log/security
371 ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
372 ${DESTDIR}/var/log/slip.log
373 ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
374 ${DESTDIR}/var/log/ppp.log
375 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
376 ${DESTDIR}/var/log/wtmpx
377 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
378 ${DESTDIR}/var/run/utmpx
379 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
381 cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
382 COPYRIGHT ${DESTDIR}/
383 rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
384 rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
385 ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
386 ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
388 cd ${.CURDIR}/../share/man; ${MAKE} makedb
394 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.root.dist \
396 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.var.dist \
398 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.usr.dist \
400 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.include.dist \
401 -p ${DESTDIR}/usr/include
402 -chflags xlink ${DESTDIR}/* ${DESTDIR}/usr/* ${DESTDIR}/var/* \
404 cd ${DESTDIR}/; test -e sys || (rm -f sys; ${LN} -s usr/src/sys sys)
405 .if !defined(NO_SHARE)
406 cd ${DESTDIR}/usr/share/nls; \
408 rm -rf "en_US.US-ASCII"; \
409 ${LN} -s "C" "POSIX"; \
410 ${LN} -s "C" "en_US.US-ASCII"
414 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
415 ${BINUPDATE} ${BIN1} ${BIN2} nsmb.conf \
416 ${DESTDIR}/usr/share/examples/etc
417 cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
418 ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
420 .include <bsd.prog.mk>