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