Remove am-utils, the Berkeley automounter suite (amd, amq, etc.)
[dragonfly.git] / usr.sbin / ypserv / Makefile.yp
1 #
2 # Makefile for the NIS databases
3 #
4 # $FreeBSD: src/usr.sbin/ypserv/Makefile.yp,v 1.38 2006/06/08 09:12:07 maxim Exp $
5 #
6 # This Makefile should only be run on the NIS master server of a domain.
7 # All updated maps will be pushed to all NIS slave servers listed in the
8 # /var/yp/ypservers file. Please make sure that the hostnames of all
9 # NIS servers in your domain are listed in /var/yp/ypservers.
10 #
11 # This Makefile can be modified to support more NIS maps if desired.
12 #
13
14 # If this machine is an NIS master, comment out this next line so
15 # that changes to the NIS maps can be propagated to the slave servers.
16 # (By default we assume that we are only serving a small domain with
17 # only one server.)
18 #
19 NOPUSH = "True"
20
21 # If you want to use a FreeBSD NIS server to serve non-FreeBSD clients
22 # (i.e. clients who expect the password field in the passwd maps to be
23 # valid) then uncomment this line. This will cause $YPDIR/passwd to
24 # be generated with valid password fields. This is insecure: FreeBSD
25 # normally only serves the master.passwd maps (which have real encrypted
26 # passwords in them) to the superuser on other FreeBSD machines, but
27 # non-FreeBSD clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX,
28 # etc...) will only work properly in 'unsecure' mode.
29
30 #UNSECURE = "True"
31
32 # The following line encodes the YP_INTERDOMAIN key into the hosts.byname
33 # and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve
34 # hosts not in the current domain. Commenting this line out will disable
35 # the DNS lookups.
36 B=-b
37
38 # Normally, the master.passwd.* maps are guarded against access from
39 # non-privileged users. By commenting out the following line, the YP_SECURE
40 # key will be removed from these maps, allowing anyone to access them.
41 S=-s
42
43 # These are commands which this Makefile needs to properly rebuild the
44 # NIS databases. Don't change these unless you have a good reason. Also
45 # be sure not to place an @ in front of /usr/bin/awk: it isn't necessary
46 # and it'll break everything in sight.
47 #
48 AWK = /usr/bin/awk
49 RM  = @/bin/rm -f
50 MV  = @/bin/mv -f
51 RMV  = /bin/mv -f
52
53 MKDB = /usr/sbin/yp_mkdb
54 DBLOAD = $(MKDB) -m `hostname`
55 MKNETID = /usr/libexec/mknetid
56 NEWALIASES = /usr/bin/newaliases
57 YPPUSH = /usr/sbin/yppush
58 .if !defined(UPDATE_DOMAIN)
59 DOMAIN = `/bin/domainname`
60 .else
61 DOMAIN = $(UPDATE_DOMAIN)
62 .endif
63 REVNETGROUP = /usr/libexec/revnetgroup
64 TMP = `echo $@.$$$$`
65
66 # It is advisable to create a separate directory to contain the
67 # source files used to generate your NIS maps. If you intend to
68 # support multiple domains, something like /src/dir/$DOMAIN
69 # would work well.
70 YPSRCDIR = /etc
71 .if !defined(YP_DIR)
72 YPDIR = /var/yp
73 .else
74 YPDIR = $(YP_DIR)
75 .endif
76 YPMAPDIR = $(YPDIR)/$(DOMAIN)
77
78 # These are the files from which the NIS databases are built. You may edit
79 # these to taste in the event that you wish to keep your NIS source files
80 # separate from your NIS server's actual configuration files. Note that the
81 # NIS passwd and master.passwd files are stored in /var/yp: the server's
82 # real password database is not used by default. However, you may use
83 # the real /etc/passwd and /etc/master.passwd files by:
84 #
85 #
86 # - invoking yppasswdd with `-t /etc/master.passwd' (yppasswdd will do a
87 #   'pwd_mkdb' as needed if /etc/master.passwd is thus specified).
88 # - Specifying the location of the master.passwd file using the
89 #   MASTER_PASSWD variable, i.e.:
90 #
91 #   # make MASTER_PASSWD=/path/to/some/other/master.passwd
92 #
93 # - (optionally): editing this Makefile to change the default location.
94 #
95 # To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw
96 # passwd file will be generated from the master.passwd file automagically.
97 #
98 ETHERS    = $(YPSRCDIR)/ethers     # ethernet addresses (for rarpd)
99 BOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd)
100 HOSTS     = $(YPSRCDIR)/hosts
101 IPNODES   = $(YPDIR)/ipnodes
102 NETWORKS  = $(YPSRCDIR)/networks
103 PROTOCOLS = $(YPSRCDIR)/protocols
104 RPC       = $(YPSRCDIR)/rpc
105 SERVICES  = $(YPSRCDIR)/services
106 SHELLS    = $(YPSRCDIR)/shells
107 GROUP     = $(YPSRCDIR)/group
108 ALIASES   = $(YPSRCDIR)/mail/aliases
109 NETGROUP  = $(YPDIR)/netgroup
110 PASSWD    = $(YPDIR)/passwd
111 .if !defined(MASTER_PASSWD)
112 MASTER    = $(YPDIR)/master.passwd
113 .else
114 MASTER    = $(MASTER_PASSWD)
115 .endif
116 YPSERVERS = $(YPDIR)/ypservers  # List of all NIS servers for a domain
117 PUBLICKEY = $(YPSRCDIR)/publickey
118 NETID     = $(YPSRCDIR)/netid
119
120 # List of maps that are always built.
121 # If you want to omit some of them, feel free to comment
122 # them out from this list.
123 TARGETS= servers hosts networks protocols rpc services shells group
124 #TARGETS+= aliases
125
126 # Sanity checks: filter out targets we can't build
127 # Note that we don't build the ethers or boorparams maps by default
128 # since /etc/ethers and /etc/bootparams are not likely to be present
129 # on all systems.
130 .if exists($(ETHERS))
131 TARGETS+= ethers
132 .else
133 ETHERS= /dev/null
134 .endif
135
136 .if exists($(BOOTPARAMS))
137 TARGETS+= bootparams
138 .else
139 BOOTPARAMS= /dev/null
140 .endif
141
142 .if exists($(NETGROUP))
143 TARGETS+= netgrp
144 .else
145 NETGROUP= /dev/null
146 .endif
147
148 .if exists($(MASTER))
149 TARGETS+= passwd master.passwd netid
150 .else
151 MASTER= /dev/null
152 TARGETS+= nopass
153 .endif
154
155 .if exists($(PUBLICKEY))
156 TARGETS+= publickey
157 .else
158 PUBLICKEY= /dev/null
159 .endif
160
161 .if exists($(IPNODES))
162 TARGETS+= ipnodes
163 .else
164 IPNODES= /dev/null
165 .endif
166
167 target: 
168         @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \
169         cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \
170         make -f ../Makefile all; echo "NIS Map update completed."
171
172 all: $(TARGETS)
173
174 ethers:    ethers.byname ethers.byaddr
175 bootparam: bootparams
176 hosts:     hosts.byname hosts.byaddr
177 ipnodes:   ipnodes.byname ipnodes.byaddr
178 networks:  networks.byaddr networks.byname
179 protocols: protocols.bynumber protocols.byname
180 rpc:       rpc.byname rpc.bynumber
181 services:  services.byname
182 passwd:    passwd.byname passwd.byuid
183 group:     group.byname group.bygid
184 netgrp:    netgroup
185 netid:     netid.byname
186 servers:   ypservers
187 publickey: publickey.byname
188 aliases:   mail.aliases
189
190 master.passwd:  master.passwd.byname master.passwd.byuid
191
192 #
193 # This is a special target used only when doing in-place updates with
194 # rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd
195 # server and won't need to be remade. They will have to be pushed to the
196 # slaves however. Calling this target implicitly insures that this will
197 # happen.
198 #
199 pushpw:
200         @$(DBLOAD) -c
201         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi
202         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi
203         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi
204         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi
205
206 pushmap:
207         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi
208
209 nopass:
210         @echo ""
211         @echo "                ********WARNING********"
212         @echo "  Couldn't find the master.passwd source file. This file"
213         @echo "  is needed to generate the master.passwd and passwd maps."
214         @echo "  The default location is /var/yp/master.passwd. You should"
215         @echo "  edit /var/yp/Makefile and set the MASTER variable to point"
216         @echo "  to the source file you wish to use for building the passwd"
217         @echo "  maps, or else invoke make(1) in the following manner:"
218         @echo ""
219         @echo "        make MASTER_PASSWD=/path/to/master.passwd"
220         @echo ""
221
222 mail.aliases: $(ALIASES)
223         @echo "Updating $@..."
224         @$(NEWALIASES) -oA$(ALIASES)
225         @$(MKDB) -u $(ALIASES).db \
226                 | $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \
227                 $(RMV) $(TMP) $@
228         @$(DBLOAD) -c
229         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
230         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
231
232
233 ypservers: $(YPSERVERS)
234         @echo "Updating $@..."
235         @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \
236                 $(YPSERVERS) \
237                 | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \
238                 $(RMV) $(TMP) $@
239         @$(DBLOAD) -c
240         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
241         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
242
243 ethers.byname: $(ETHERS)
244         @echo "Updating $@..."
245 .if ${ETHERS} == "/dev/null"
246         @echo "Ethers source file not found -- skipping"
247 .else
248         @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
249                 print $$2"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \
250                 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
251         @$(DBLOAD) -c
252         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
253         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
254 .endif
255
256 ethers.byaddr: $(ETHERS)
257         @echo "Updating $@..."
258 .if ${ETHERS} == "/dev/null"
259         @echo "Ethers source file not found -- skipping"
260 .else
261         @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
262                 print $$1"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \
263                 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
264         @$(DBLOAD) -c
265         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
266         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
267 .endif
268
269
270 bootparams: $(BOOTPARAMS)
271         @echo "Updating $@..."
272 .if ${BOOTPARAMS} == "/dev/null"
273         @echo "Bootparams source file not found -- skipping"
274 .else
275         @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
276                 print $$0 }' $(BOOTPARAMS) | $(DBLOAD) -i $(BOOTPARAMS) \
277                 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
278         @$(DBLOAD) -c
279         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
280         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
281 .endif
282
283
284 netgroup: $(NETGROUP) netgroup.byhost netgroup.byuser
285         @echo "Updating $@..."
286 .if ${NETGROUP} == "/dev/null"
287         @echo "Netgroup source file not found -- skipping"
288 .else
289         @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
290                 print $$0 }' $(NETGROUP) | $(DBLOAD) -i $(NETGROUP) \
291                 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
292         @$(DBLOAD) -c
293         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
294         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
295 .endif
296
297
298 netgroup.byhost: $(NETGROUP)
299         @echo "Updating $@..."
300 .if ${NETGROUP} == "/dev/null"
301         @echo "Netgroup source file not found -- skipping"
302 .else
303         @$(REVNETGROUP) -h -f $(NETGROUP) | \
304         $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
305                 print $$0 }' | $(DBLOAD) -i $(NETGROUP) \
306                 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
307         @$(DBLOAD) -c
308         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
309         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
310 .endif
311
312
313 netgroup.byuser: $(NETGROUP)
314         @echo "Updating $@..."
315 .if ${NETGROUP} == "/dev/null"
316         @echo "Netgroup source file not found -- skipping"
317 .else
318         @$(REVNETGROUP) -u -f $(NETGROUP) | \
319         $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
320                 print $$0 }' | $(DBLOAD) -i $(NETGROUP) \
321                 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
322         @$(DBLOAD) -c
323         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
324         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
325 .endif
326
327
328 hosts.byname: $(HOSTS)
329         @echo "Updating $@..."
330         @$(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \
331                 print $$n"\t"$$0 }' $(HOSTS) | $(DBLOAD) ${B} -i $(HOSTS)  \
332                 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
333         @$(DBLOAD) -c
334         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
335         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
336
337
338 hosts.byaddr: $(HOSTS)
339         @echo "Updating $@..."
340         @$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $(HOSTS) \
341                 | $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP); \
342                 $(RMV) $(TMP) $@
343         @$(DBLOAD) -c
344         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
345         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
346
347
348 ipnodes.byname: $(IPNODES)
349         @echo "Updating $@..."
350 .if ${IPNODES} == "/dev/null"
351         @echo "Ipnodes source file not found -- skipping"
352 .else
353         @$(AWK) '/^[0-9a-fA-F:]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \
354                 print $$n"\t"$$0 }' $(IPNODES) | $(DBLOAD) ${B} -i $(IPNODES)  \
355                 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
356         @$(DBLOAD) -c
357         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
358         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
359 .endif
360
361
362 ipnodes.byaddr: $(IPNODES)
363         @echo "Updating $@..."
364 .if ${IPNODES} == "/dev/null"
365         @echo "Ipnodes source file not found -- skipping"
366 .else
367         @$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $(IPNODES) \
368                 | $(DBLOAD) ${B} -i $(IPNODES) -o $(YPMAPDIR)/$@ - $(TMP); \
369                 $(RMV) $(TMP) $@
370         @$(DBLOAD) -c
371         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
372         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
373 .endif
374
375
376 networks.byname: $(NETWORKS)
377         @echo "Updating $@..."
378         @$(AWK) \
379            '$$1 !~ "^#.*"  { print $$1"\t"$$0; \
380                           for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
381                               print $$n"\t"$$0 \
382                 }' $(NETWORKS) \
383                 | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \
384                 $(RMV) $(TMP) $@
385         @$(DBLOAD) -c
386         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
387         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
388
389
390 networks.byaddr: $(NETWORKS)
391         @echo "Updating $@..."
392         @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(NETWORKS) \
393                 | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \
394                 $(RMV) $(TMP) $@
395         @$(DBLOAD) -c
396         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
397         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
398
399
400 protocols.byname: $(PROTOCOLS)
401         @echo "Updating $@..."
402         @$(AWK) \
403            '$$1 !~ "^#.*"       { print $$1"\t"$$0; \
404                           for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
405                               print $$n"\t"$$0 \
406                         }' $(PROTOCOLS) | $(DBLOAD) -i $(PROTOCOLS) \
407                 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
408         @$(DBLOAD) -c
409         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
410         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
411
412
413 protocols.bynumber: $(PROTOCOLS)
414         @echo "Updating $@..."
415         @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(PROTOCOLS) \
416                 | $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP); \
417                 $(RMV) $(TMP) $@
418         @$(DBLOAD) -c
419         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
420         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
421
422
423 rpc.byname: $(RPC)
424         @echo "Updating $@..."
425         @$(AWK) \
426            '$$1 !~ "^#.*"  { print $$1"\t"$$0; \
427                           for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
428                               print $$n"\t"$$0 \
429                 }' $(RPC) | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \
430                 $(RMV) $(TMP) $@
431         @$(DBLOAD) -c
432         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
433         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
434
435
436 rpc.bynumber: $(RPC)
437         @echo "Updating $@..."
438         @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(RPC) \
439                 | $(DBLOAD)  -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \
440                 $(RMV) $(TMP) $@
441         @$(DBLOAD) -c
442         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
443         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
444
445
446 services.byname: $(SERVICES)
447         @echo "Updating $@..."
448         @$(AWK) \
449            '$$1 !~ "^#.*"  { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \
450                                 if (split($$2, t, "/")) { \
451                                         printf("%s/%s", $$n, t[2]) }; \
452                                         print "\t"$$0;  \
453                                         if (n == 1) n = 2; \
454                            } ; print $$2"\t"$$0 ; \
455                 }' $(SERVICES) \
456                 | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \
457                 $(RMV) $(TMP) $@
458         @$(DBLOAD) -c
459         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
460         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
461
462 shells: $(SHELLS)
463         @echo "Updating $@..."
464         @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \
465                 $(SHELLS) \
466                 | $(DBLOAD) -i $(SHELLS) -o $(YPMAPDIR)/$@ - $(TMP); \
467          $(RMV) $(TMP) $@
468         @$(DBLOAD) -c
469         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
470         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
471
472 publickey.byname: $(PUBLICKEY)
473         @echo "Updating $@..."
474 .if ${PUBLICKEY} == "/dev/null"
475         @echo "Publickey source file not found -- skipping"
476 .else
477         @$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $(PUBLICKEY) \
478                 | $(DBLOAD)  -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \
479                 $(RMV) $(TMP) $@
480         @$(DBLOAD) -c
481         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
482         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
483 .endif
484
485
486 $(PASSWD): $(MASTER)
487         @echo "Creating new $@ file from $(MASTER)..."
488         @if [ ! $(UNSECURE) ]; then \
489         $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
490                 print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \
491                 > $(PASSWD) ; \
492         else \
493         $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
494                 print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \
495                 > $(PASSWD) ; fi
496
497
498 passwd.byname: $(PASSWD)
499         @echo "Updating $@..."
500         @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
501                 print $$1"\t"$$0 }' $(PASSWD) \
502                 | $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
503                 $(RMV) $(TMP) $@
504         @$(DBLOAD) -c
505         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
506         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
507
508
509 passwd.byuid: $(PASSWD)
510         @echo "Updating $@..."
511         @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
512                 print $$3"\t"$$0 }' $(PASSWD) \
513                 | $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
514                 $(RMV) $(TMP) $@
515         @$(DBLOAD) -c
516         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
517         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
518
519
520 group.byname: $(GROUP)
521         @echo "Updating $@..."
522         @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
523                 print $$1"\t"$$0 }' $(GROUP) \
524                 | $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
525                 $(RMV) $(TMP) $@
526         @$(DBLOAD) -c
527         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
528         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
529
530
531 group.bygid: $(GROUP)
532         @echo "Updating $@..."
533         @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
534                 print $$3"\t"$$0 }' $(GROUP) \
535                 | $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
536                 $(RMV) $(TMP) $@
537         @$(DBLOAD) -c
538         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
539         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
540
541
542 netid.byname: $(GROUP) $(PASSWD) $(HOSTS)
543         @echo "Updating $@..."
544         @$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \
545                 -d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \
546                 $(RMV) $(TMP) $@
547         @$(DBLOAD) -c
548         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
549         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
550
551
552 master.passwd.byname: $(MASTER)
553         @echo "Updating $@..."
554 .if ${MASTER} == "/dev/null"
555         @echo "Master.passwd source file not found -- skipping"
556 .else
557         @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
558                 print $$1"\t"$$0 }' $(MASTER) \
559                 | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
560                 $(RMV) $(TMP) $@
561         @$(DBLOAD) -c
562         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
563         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
564 .endif
565
566
567 master.passwd.byuid: $(MASTER)
568         @echo "Updating $@..."
569 .if ${MASTER} == "/dev/null"
570         @echo "Master.passwd source file not found -- skipping"
571 .else
572         @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
573                 print $$3"\t"$$0 }' $(MASTER) \
574                 | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
575                 $(RMV) $(TMP) $@
576         @$(DBLOAD) -c
577         @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
578         @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
579 .endif