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