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 gettytab 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 \
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 # Include file which contains obsolete files
62 .if exists(${DESTDIR}/etc/upgrade/Makefile_upgrade.inc)
63 .include "${DESTDIR}/etc/upgrade/Makefile_upgrade.inc"
66 remove-obsolete-files:
67 @if [ -z "${TO_REMOVE}" ]; then \
68 echo "Please do a 'make installworld' first."; \
69 echo "See build(7) for further information."; \
72 @echo "===> Remove now obsolete files"
73 @for item in ${TO_REMOVE}; do \
74 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
75 echo "${DESTDIR}$${item}"; \
76 chflags -Rf noschg "${DESTDIR}$${item}"; \
77 rm -rf "${DESTDIR}$${item}"; \
81 remove-deprecated-files:
82 .if defined(REMOVE_DEPRECATED)
83 @echo "===> Remove now deprecated files"
84 @for item in ${TO_REMOVE_LATE}; do \
85 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
86 echo "${DESTDIR}$${item}"; \
87 chflags -Rf noschg "${DESTDIR}$${item}"; \
88 rm -rf "${DESTDIR}$${item}"; \
92 @echo "===> Checking for deprecated files"
93 @count=0; for item in ${TO_REMOVE_LATE}; do \
94 if [ -e ${DESTDIR}$${item} -o -L ${DESTDIR}$${item} ]; then \
95 echo "${DESTDIR}$${item} is deprecated"; \
96 count=`expr $$count + 1`; \
99 if [ "$$count" -gt 0 ]; then \
100 echo "==================================================================" ; \
101 echo "= You have $$count now deprecated files." ; \
102 echo "= Once you are sure that none of your third party (ports or local)" ; \
103 echo "= software are still using them, rerun with:" ; \
104 echo "= make upgrade -DREMOVE_DEPRECATED" ; \
105 echo "==================================================================" ; \
110 (pw -V ${DESTDIR}/etc usershow mail -q > /dev/null) || \
111 pw -V ${DESTDIR}/etc useradd mail -u 6 -g 6 \
113 -d /nonexistent -s /sbin/nologin
114 (pw -V ${DESTDIR}/etc usershow _pflogd -q > /dev/null) || \
115 pw -V ${DESTDIR}/etc useradd _pflogd -u 64 \
116 -c "pflogd privsep user" \
117 -d /var/empty -s /sbin/nologin
118 (pw -V ${DESTDIR}/etc usershow _sdpd -q > /dev/null) || \
119 pw -V ${DESTDIR}/etc useradd _sdpd -u 70 \
120 -c "sdpd privsep user" \
121 -d /var/empty -s /sbin/nologin
122 (pw -V ${DESTDIR}/etc usershow _dhcp -q > /dev/null) || \
123 pw -V ${DESTDIR}/etc useradd _dhcp -u 77 \
125 -d /var/empty -s /sbin/nologin
126 (pw -V ${DESTDIR}/etc groupshow input -q > /dev/null) || \
127 pw -V ${DESTDIR}/etc groupadd input -g 43
128 (pw -V ${DESTDIR}/etc groupshow video -q > /dev/null) || \
129 pw -V ${DESTDIR}/etc groupadd video -g 44
130 (pw -V ${DESTDIR}/etc groupshow authpf -q > /dev/null) || \
131 pw -V ${DESTDIR}/etc groupadd authpf -g 63
132 (pw -V ${DESTDIR}/etc groupshow _pflogd -q > /dev/null) || \
133 pw -V ${DESTDIR}/etc groupadd _pflogd -g 64
134 (pw -V ${DESTDIR}/etc groupshow _sdpd -q > /dev/null) || \
135 pw -V ${DESTDIR}/etc groupadd _sdpd -g 70
136 (pw -V ${DESTDIR}/etc groupshow _dhcp -q > /dev/null) || \
137 pw -V ${DESTDIR}/etc groupadd _dhcp -g 77
140 @if [ -n "`grep '^sendmail.*/usr/libexec/sendmail/sendmail' ${DESTDIR}/etc/mail/mailer.conf`" ]; then \
141 echo "==================================================================" ; \
142 echo "= sendmail is being removed from the base system." ; \
143 echo "= /etc/mail/mailer.conf is still configured to use sendmail." ; \
144 echo "= See http://www.dragonflybsd.com/docs/docs/newhandbook/mta/" ; \
145 echo "= Quick: cp /usr/src/libexec/dma/mailer-conf/mailer.conf.dma " ; \
146 echo "= ${DESTDIR}/etc/mail/mailer.conf ; make upgrade" ; \
147 echo "==================================================================" ; \
151 upgrade_base: upgrade_check preupgrade remove-obsolete-files
152 # files that should be dirs (not possible with Makefile_upgrade.inc)
153 .for f in usr/include/dev/misc/ppi usr/share/initrd/sbin var/db/entropy
154 [ -d ${DESTDIR}/${f} ] || rm -f ${DESTDIR}/${f}
156 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
157 cd ${UPGRADE_SRCDIR}/../share/mk; ${MAKE} install
159 cd ${UPGRADE_SRCDIR}; \
160 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
161 ${BINUPDATE} ${DESTDIR}/etc; \
162 cap_mkdb ${DESTDIR}/etc/login.conf; \
163 for f in ${BIN1}; do \
164 [ -e "${DESTDIR}/etc/$${f##*/}" ] || \
165 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
166 $$f ${DESTDIR}/etc; \
168 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
169 ${BIN2} ${DESTDIR}/etc;
170 cd ${UPGRADE_SRCDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
171 ${DEFAULTS} ${DESTDIR}/etc/defaults
172 cd ${UPGRADE_SRCDIR}/periodic; ${MAKE} install
173 mkdir -p ${DESTDIR}/etc/rc.d
174 cd ${UPGRADE_SRCDIR}/rc.d; ${MAKE} install
175 cd ${UPGRADE_SRCDIR}/devd; ${MAKE} install
176 # "../share/termcap/make etc-termcap" expanded inline here:
177 ${LN} -fs /usr/share/misc/termcap ${DESTDIR}/etc/termcap
178 # "../usr.sbin/rmt/make etc-rmt" expanded inline here:
179 ${LN} -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt
180 cd ${UPGRADE_SRCDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
181 ${MTREE} ${DESTDIR}/etc/mtree
182 cd ${UPGRADE_SRCDIR}/bluetooth; ${MAKE} install
183 cd ${UPGRADE_SRCDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 Makefile.usr ${DESTDIR}/usr/Makefile
184 .if !exists(${DESTDIR}/etc/pam.d)
185 mkdir -p ${DESTDIR}/etc/pam.d
186 cd ${UPGRADE_SRCDIR}/pam.d; ${MAKE} install
187 sh ${DESTDIR}/etc/pam.d/convert.sh ${DESTDIR}/etc/pam.d ${DESTDIR}/etc/pam.conf
189 .for pamconf in README convert.sh atrun cron passwd su system
190 .if !exists(${DESTDIR}/etc/pam.d/${pamconf})
191 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${UPGRADE_SRCDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
195 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
196 cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
197 COPYRIGHT ${DESTDIR}/
199 rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
200 rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
201 ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
202 ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
203 .if exists(${DESTDIR}/usr/lib/gcc2)
204 ldconfig -m ${DESTDIR}/usr/lib/gcc2
206 .for lib in ${COMPAT_LIBS:M*.so.*}
207 .if exists(${DESTDIR}/usr/lib/${lib})
208 chflags noschg ${DESTDIR}/usr/lib/${lib}
209 rm -f ${DESTDIR}/usr/lib/${lib}
212 cd ${.CURDIR}/../lib/libssh; ${MAKE} -f Makefile.etc install
213 .if exists(${DESTDIR}/boot)
214 .if exists(${DESTDIR}/kernel)
215 chflags noschg ${DESTDIR}/kernel
216 mv ${DESTDIR}/kernel ${DESTDIR}/boot/kernel
217 chflags schg ${DESTDIR}/boot/kernel
219 .if exists(${DESTDIR}/modules)
220 mv ${DESTDIR}/modules ${DESTDIR}/boot/modules
221 rm -rf ${DESTDIR}/boot/modules/modules
223 .if exists(${DESTDIR}/kernel.old)
224 mv ${DESTDIR}/kernel.old ${DESTDIR}/boot/kernel.old
226 .if exists(${DESTDIR}/modules.old)
227 mv ${DESTDIR}/modules.old ${DESTDIR}/boot/modules.old
228 rm -rf ${DESTDIR}/boot/modules.old/modules.old
231 .if exists(${DESTDIR}/etc/settings.conf)
232 mv ${DESTDIR}/etc/settings.conf ${DESTDIR}/etc/pkg_radd.conf
234 for ext in a so.0; do \
235 f=${DESTDIR}/usr/lib/libpthread.$$ext; \
236 dest=$$(readlink "$$f"); \
239 ln -fs thread/$$dest $$f ;; \
243 mkdir -p ${DESTDIR}/dev
244 mkdir -p ${DESTDIR}/var/run/sem
245 chmod 1777 ${DESTDIR}/var/run/sem
247 # The existence of cleartext_pass_ok means pam config files are out of date.
248 @set - `fgrep -e cleartext_pass_ok -e pam_opie ${DESTDIR}/etc/pam.d/*`; \
251 echo "It appears your PAM configuration files need to be updated"; \
252 echo "This can be done by manually editing the files or:"; \
253 echo " cd ${UPGRADE_SRCDIR}/pam.d"; \
254 echo " make install"; \
257 # Move the dhcpcd duid, secret and lease files back outside the chroot.
258 # Then ensure the chroot is empty.
259 DHCPCD_DB="${DESTDIR}/var/db/dhcpcd"; \
260 DHCPCD_CHROOT=`pw -V ${DESTDIR}/etc usershow _dhcp | cut -d: -f9`; \
261 DHCPCD_CHROOT_DB="${DESTDIR}$$DHCPCD_CHROOT/var/db/dhcpcd"; \
262 if [ -f "$$DHCPCD_CHROOT_DB/duid" ] && \
263 [ ! -f "$$DHCPCD_DB/duid" ]; then \
264 mkdir -p "$$DHCPCD_DB" && \
265 mv "$$DHCPCD_CHROOT_DB"/* "$$DHCPCD_DB"; \
266 chown -R root:wheel "$$DHCPCD_DB"; \
267 rm -rf "$$DHCPCD_CHROOT"/*; \
269 if [ "$$DHCPCD_CHROOT" != /var/empty ]; then \
270 pw -V ${DESTDIR}/etc usermod _dhcp -d /var/empty; \
271 rm -rf "$$DHCPCD_CHROOT"; \
274 upgrade_etc: upgrade_base remove-deprecated-files
275 @echo "Upgrade was successful"
279 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
280 ${BINUPDATE} ${DESTDIR}/etc; \
281 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
282 ${BIN1} ${DESTDIR}/etc; \
283 cap_mkdb ${DESTDIR}/etc/login.conf; \
284 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
285 ${BIN2} ${DESTDIR}/etc; \
286 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
287 master.passwd nsmb.conf ${DESTDIR}/etc; \
288 pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
289 cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
290 ${DEFAULTS} ${DESTDIR}/etc/defaults
291 cd ${.CURDIR}/pam.d; ${MAKE} install
292 cd ${.CURDIR}/bluetooth; ${MAKE} install
293 cd ${.CURDIR}/periodic; ${MAKE} install
294 cd ${.CURDIR}/rc.d; ${MAKE} install
295 cd ${.CURDIR}/devd; ${MAKE} install
296 cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
297 cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
299 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
300 Makefile.usr ${DESTDIR}/usr/Makefile
302 .if exists(${.CURDIR}/../${dir}/Makefile.etc)
303 cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc obj
304 cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc install
307 mkdir -p ${DESTDIR}/dev
308 cd ${.CURDIR}/root; \
309 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
310 dot.cshrc ${DESTDIR}/root/.cshrc; \
311 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
312 dot.klogin ${DESTDIR}/root/.klogin; \
313 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
314 dot.login ${DESTDIR}/root/.login; \
315 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
316 dot.profile ${DESTDIR}/root/.profile; \
317 rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
318 cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
319 ${MTREE} ${DESTDIR}/etc/mtree
320 cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
321 ${PPPCNF} ${DESTDIR}/etc/ppp
322 cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
323 ${ETCMAIL} ${DESTDIR}/etc/mail
324 @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
325 ! -f ${DESTDIR}/etc/aliases ]; then \
327 ${LN} -s mail/aliases ${DESTDIR}/etc/aliases; \
329 ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
330 ${DESTDIR}/etc/dumpdates
331 ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
332 ${DESTDIR}/var/db/locate.database
333 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
334 ${DESTDIR}/var/log/auth.log
335 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
336 ${DESTDIR}/var/log/cron
337 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
338 ${DESTDIR}/var/log/daemon
339 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
340 ${DESTDIR}/var/log/lpd-errs
341 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
342 ${DESTDIR}/var/log/maillog
343 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
344 ${DESTDIR}/var/log/lastlogx
345 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
346 ${DESTDIR}/var/log/messages
347 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
348 ${DESTDIR}/var/log/security
349 ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
350 ${DESTDIR}/var/log/slip.log
351 ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
352 ${DESTDIR}/var/log/ppp.log
353 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
354 ${DESTDIR}/var/log/wtmpx
355 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
356 ${DESTDIR}/var/run/utmpx
357 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
359 cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
360 COPYRIGHT ${DESTDIR}/
361 rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
362 rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
363 ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
364 ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
366 cd ${.CURDIR}/../share/man; ${MAKE} makedb
372 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.root.dist \
374 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.var.dist \
376 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.usr.dist \
378 mtree ${MTREE_FSCHG} -deU -f ${.CURDIR}/mtree/BSD.include.dist \
379 -p ${DESTDIR}/usr/include
380 -chflags xlink ${DESTDIR}/* ${DESTDIR}/usr/* ${DESTDIR}/var/* \
382 cd ${DESTDIR}/; test -e sys || (rm -f sys; ${LN} -s usr/src/sys sys)
383 .if !defined(NO_SHARE)
384 cd ${DESTDIR}/usr/share/nls; \
386 rm -rf "en_US.US-ASCII"; \
387 ${LN} -s "C" "POSIX"; \
388 ${LN} -s "C" "en_US.US-ASCII"
392 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
393 ${BINUPDATE} ${BIN1} ${BIN2} nsmb.conf \
394 ${DESTDIR}/usr/share/examples/etc
395 cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
396 ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
398 .include <bsd.prog.mk>