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 \
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
22 # Initial distribution files are installed read-write (644)
24 BIN1= amd.map auth.conf \
25 crontab csh.cshrc csh.login csh.logout \
26 devtab dhclient.conf dm.conf dntpd.conf \
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 \
35 etc.${MACHINE_ARCH}/ttys
36 .if defined(BINARY_UPGRADE) # location of these depends on upgrade method
39 BIN1+= ${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config
42 .if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
43 .if !defined(NO_OPENSSH)
44 DIRS+= secure/lib/libssh \
48 DIRS+= secure/usr.bin/openssl
51 # Files that should be installed read-only-executable (555) root:wheel
53 BIN2= pccard_ether rc.firewall rc.suspend rc.resume
55 DEFAULTS= compilers.conf devfs.conf make.conf mkinitrd.conf periodic.conf \
56 pfi.conf rc.conf uuids
58 MTREE= BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
63 ETCMAIL=aliases mailer.conf access.sample virtusertable.sample \
66 # Use this directory as the source for new configuration files when upgrading
67 UPGRADE_SRCDIR?=${.CURDIR}
69 # Include file which contains obsolete files
70 .if exists(${DESTDIR}/etc/upgrade/Makefile_upgrade.inc)
71 .include "${DESTDIR}/etc/upgrade/Makefile_upgrade.inc"
74 remove-obsolete-files:
75 @if [ -z "${TO_REMOVE}" ]; then \
76 echo "Please do a 'make installworld' first."; \
77 echo "See build(7) for further information."; \
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}"; \
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}"; \
97 (pw -V ${DESTDIR}/etc usershow mail -q > /dev/null) || \
98 pw -V ${DESTDIR}/etc useradd mail -u 6 -g 6 \
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 \
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
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 "==================================================================" ; \
136 upgrade_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}
141 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
142 cd ${UPGRADE_SRCDIR}/../share/mk; ${MAKE} install
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; \
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 # "../share/termcap/make etc-termcap" expanded inline here:
164 ${LN} -fs /usr/share/misc/termcap ${DESTDIR}/etc/termcap
165 # "../usr.sbin/rmt/make etc-rmt" expanded inline here:
166 ${LN} -fs /usr/sbin/rmt ${DESTDIR}/etc/rmt
167 cd ${UPGRADE_SRCDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
168 ${MTREE} ${DESTDIR}/etc/mtree
169 cd ${UPGRADE_SRCDIR}/bluetooth; ${MAKE} install
170 cd ${UPGRADE_SRCDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 Makefile.usr ${DESTDIR}/usr/Makefile
171 .if !exists(${DESTDIR}/etc/pam.d)
172 mkdir -p ${DESTDIR}/etc/pam.d
173 cd ${UPGRADE_SRCDIR}/pam.d; ${MAKE} install
174 sh ${DESTDIR}/etc/pam.d/convert.sh ${DESTDIR}/etc/pam.d ${DESTDIR}/etc/pam.conf
176 .for pamconf in README convert.sh atrun cron passwd rsh su system
177 .if !exists(${DESTDIR}/etc/pam.d/${pamconf})
178 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${UPGRADE_SRCDIR}/pam.d/${pamconf} ${DESTDIR}/etc/pam.d
182 # these removals must occur AFTER any pam conversion
183 csh -c "rm -f /usr/lib/pam_{cleartext_pass_ok,deny,opie,opieaccess,permit,radius,skey,ssh,tacplus,unix}.so"
185 .if !defined(BINARY_UPGRADE) # binary upgrade just copies these files
186 cd ${UPGRADE_SRCDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
187 COPYRIGHT ${DESTDIR}/
189 rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
190 rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
191 rm -f ${DESTDIR}/usr/include/sys/ata.h
192 ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
193 ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
194 ${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
195 .if exists(${DESTDIR}/usr/lib/gcc2)
196 ldconfig -m ${DESTDIR}/usr/lib/gcc2
198 .for lib in ${COMPAT_LIBS:M*.so.*}
199 .if exists(${DESTDIR}/usr/lib/${lib})
200 chflags noschg ${DESTDIR}/usr/lib/${lib}
201 rm -f ${DESTDIR}/usr/lib/${lib}
204 .if !defined(NO_OPENSSH)
205 cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc obj
206 cd ${.CURDIR}/../secure/lib/libssh; ${MAKE} -f Makefile.etc install
208 .if exists(${DESTDIR}/boot)
209 .if exists(${DESTDIR}/kernel)
210 chflags noschg ${DESTDIR}/kernel
211 mv ${DESTDIR}/kernel ${DESTDIR}/boot/kernel
212 chflags schg ${DESTDIR}/boot/kernel
214 .if exists(${DESTDIR}/modules)
215 mv ${DESTDIR}/modules ${DESTDIR}/boot/modules
216 rm -rf ${DESTDIR}/boot/modules/modules
218 .if exists(${DESTDIR}/kernel.old)
219 mv ${DESTDIR}/kernel.old ${DESTDIR}/boot/kernel.old
221 .if exists(${DESTDIR}/modules.old)
222 mv ${DESTDIR}/modules.old ${DESTDIR}/boot/modules.old
223 rm -rf ${DESTDIR}/boot/modules.old/modules.old
226 .if exists(${DESTDIR}/etc/settings.conf)
227 mv ${DESTDIR}/etc/settings.conf ${DESTDIR}/etc/pkg_radd.conf
229 for ext in a so.0; do \
230 f=${DESTDIR}/usr/lib/libpthread.$$ext; \
231 dest=$$(readlink "$$f"); \
233 libthread_xu.*|libc_r.*) \
234 ln -fs thread/$$dest $$f ;; \
238 mkdir -p ${DESTDIR}/dev
240 # The existence of cleartext_pass_ok means pam config files are out of date.
241 @set - `fgrep cleartext_pass_ok ${DESTDIR}/etc/pam.d/*`; \
244 echo "It appears your PAM configuration files need to be updated"; \
245 echo "This can be done by manually editing the files or:"; \
246 echo " cd ${UPGRADE_SRCDIR}/pam.d"; \
247 echo " make install"; \
252 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
253 ${BINUPDATE} ${DESTDIR}/etc; \
254 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
255 ${BIN1} ${DESTDIR}/etc; \
256 cap_mkdb ${DESTDIR}/etc/login.conf; \
257 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 555 \
258 ${BIN2} ${DESTDIR}/etc; \
259 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 \
260 master.passwd nsmb.conf opieaccess ${DESTDIR}/etc; \
261 pwd_mkdb -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
262 cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
263 ${DEFAULTS} ${DESTDIR}/etc/defaults
264 cd ${.CURDIR}/pam.d; ${MAKE} install
265 cd ${.CURDIR}/bluetooth; ${MAKE} install
266 cd ${.CURDIR}/periodic; ${MAKE} install
267 cd ${.CURDIR}/rc.d; ${MAKE} install
268 cd ${.CURDIR}/devd; ${MAKE} install
269 cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
270 cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
272 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
273 Makefile.usr ${DESTDIR}/usr/Makefile
275 .if exists(${.CURDIR}/../${dir}/Makefile.etc)
276 cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc obj
277 cd ${.CURDIR}/../${dir}; ${MAKE} -f Makefile.etc install
280 mkdir -p ${DESTDIR}/dev
281 cd ${.CURDIR}/root; \
282 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
283 dot.cshrc ${DESTDIR}/root/.cshrc; \
284 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
285 dot.klogin ${DESTDIR}/root/.klogin; \
286 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
287 dot.login ${DESTDIR}/root/.login; \
288 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
289 dot.profile ${DESTDIR}/root/.profile; \
290 rm -f ${DESTDIR}/.cshrc ${DESTDIR}/.profile; \
291 cd ${.CURDIR}/mtree; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
292 ${MTREE} ${DESTDIR}/etc/mtree
293 cd ${.CURDIR}/ppp; ${INSTALL} -o root -g ${BINGRP} -m 600 \
294 ${PPPCNF} ${DESTDIR}/etc/ppp
295 cd ${.CURDIR}/mail; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
296 ${ETCMAIL} ${DESTDIR}/etc/mail
297 @if [ -d ${DESTDIR}/etc/mail -a -f ${DESTDIR}/etc/mail/aliases -a \
298 ! -f ${DESTDIR}/etc/aliases ]; then \
300 ${LN} -s mail/aliases ${DESTDIR}/etc/aliases; \
302 ${INSTALL} -o ${BINOWN} -g operator -m 664 /dev/null \
303 ${DESTDIR}/etc/dumpdates
304 ${INSTALL} -o nobody -g ${BINGRP} -m 644 /dev/null \
305 ${DESTDIR}/var/db/locate.database
306 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
307 ${DESTDIR}/var/log/auth.log
308 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
309 ${DESTDIR}/var/log/cron
310 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
311 ${DESTDIR}/var/log/daemon
312 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
313 ${DESTDIR}/var/log/lpd-errs
314 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 640 /dev/null \
315 ${DESTDIR}/var/log/maillog
316 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
317 ${DESTDIR}/var/log/lastlog
318 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
319 ${DESTDIR}/var/log/lastlogx
320 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
321 ${DESTDIR}/var/log/messages
322 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
323 ${DESTDIR}/var/log/security
324 ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
325 ${DESTDIR}/var/log/slip.log
326 ${INSTALL} -o ${BINOWN} -g network -m 640 /dev/null \
327 ${DESTDIR}/var/log/ppp.log
328 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
329 ${DESTDIR}/var/log/wtmp
330 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
331 ${DESTDIR}/var/log/wtmpx
332 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
333 ${DESTDIR}/var/run/utmp
334 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
335 ${DESTDIR}/var/run/utmpx
336 ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 ${.CURDIR}/minfree \
338 cd ${.CURDIR}/..; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
339 COPYRIGHT ${DESTDIR}/
340 rm -f ${DESTDIR}/usr/include/machine/ioctl_bt848.h
341 rm -f ${DESTDIR}/usr/include/machine/ioctl_meteor.h
342 rm -f ${DESTDIR}/usr/include/sys/ata.h
343 ${LN} -s "../dev/video/bktr/ioctl_bt848.h" ${DESTDIR}/usr/include/machine/ioctl_bt848.h
344 ${LN} -s "../dev/video/meteor/ioctl_meteor.h" ${DESTDIR}/usr/include/machine/ioctl_meteor.h
345 ${LN} -s nata.h ${DESTDIR}/usr/include/sys/ata.h
347 cd ${.CURDIR}/../share/man; ${MAKE} makedb
353 mtree -deU -f ${.CURDIR}/mtree/BSD.root.dist -p ${DESTDIR}/
354 mtree -deU -f ${.CURDIR}/mtree/BSD.var.dist -p ${DESTDIR}/var
355 mtree -deU -f ${.CURDIR}/mtree/BSD.usr.dist -p ${DESTDIR}/usr
356 mtree -deU -f ${.CURDIR}/mtree/BSD.include.dist \
357 -p ${DESTDIR}/usr/include
358 -chflags xlink ${DESTDIR}/* ${DESTDIR}/usr/* ${DESTDIR}/var/* \
360 cd ${DESTDIR}/; test -e sys || (rm -f sys; ${LN} -s usr/src/sys sys)
361 cd ${DESTDIR}/usr/share/nls; \
362 set - `grep "^[a-zA-Z]" ${.CURDIR}/nls.alias`; \
363 while [ $$# -gt 0 ] ; \
366 ${LN} -s "$$2" "$$1"; \
371 cd ${.CURDIR}; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
372 ${BINUPDATE} ${BIN1} ${BIN2} nsmb.conf opieaccess \
373 ${DESTDIR}/usr/share/examples/etc
374 cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 \
375 ${DEFAULTS} ${DESTDIR}/usr/share/examples/etc/defaults
377 .include <bsd.prog.mk>