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