Makefile.yp revision 33100
1#
2# Makefile for the NIS databases
3#
4# $Id: Makefile.yp,v 1.3 1998/02/04 16:07:20 wpaul 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#
19NOPUSH = "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.
36B=-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.
41S=-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#
48AWK = /usr/bin/awk
49RM  = @/bin/rm -f
50MV  = @/bin/mv -f
51RMV  = /bin/mv -f
52RCAT = /bin/cat
53CAT = @$(RCAT)
54
55MKDB = /usr/sbin/yp_mkdb
56DBLOAD = $(MKDB) -m `hostname`
57MKNETID = /usr/libexec/mknetid
58NEWALIASES = /usr/bin/newaliases
59YPPUSH = /usr/sbin/yppush
60.if !defined(UPDATE_DOMAIN)
61DOMAIN = `/bin/domainname`
62.else
63DOMAIN = $(UPDATE_DOMAIN)
64.endif
65REVNETGROUP = /usr/libexec/revnetgroup
66TMP = `echo $@.$$$$`
67
68# It is advisable to create a separate directory to contain the
69# source files used to generate your NIS maps. If you intend to
70# support multiple domains, something like /src/dir/$DOMAIN
71# would work well.
72YPSRCDIR = /etc
73.if !defined(YP_DIR)
74YPDIR = /var/yp
75.else
76YPDIR = $(YP_DIR)
77.endif
78YPMAPDIR = $(YPDIR)/$(DOMAIN)
79
80# These are the files from which the NIS databases are built. You may edit
81# these to taste in the event that you wish to keep your NIS source files
82# seperate from your NIS server's actual configuration files. Note that the
83# NIS passwd and master.passwd files are stored in /var/yp: the server's
84# real password database is not used by default. However, you may use
85# the real /etc/passwd and /etc/master.passwd files by:
86#
87#
88# - invoking yppasswdd without the -m option (yppasswdd will use
89#   /etc/master.passwd if no alternate master.passwd file is specified
90#   and do a 'pwd_mkdb' as needed).
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)/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 (index($$2,"udp")) { printf("%s/udp",$$n) } \
440			    else { printf("%s/tcp",$$n) }; print "\t"$$0 ; \
441			    if (n == 1) n = 2; \
442			  } ; print $$2"\t"$$0 ; \
443		}' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \
444		$(RMV) $(TMP) $@
445	@$(DBLOAD) -c
446	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
447	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
448
449
450publickey.byname: $(PUBLICKEY)
451	@echo "Updating $@..."
452.if ${PUBLICKEY} == "/dev/null"
453	@echo "Publickey source file not found -- skipping"
454.else
455	$(CAT) $(PUBLICKEY) | \
456	$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $^ \
457		| $(DBLOAD)  -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \
458		$(RMV) $(TMP) $@
459	@$(DBLOAD) -c
460	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
461	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
462.endif
463
464
465$(PASSWD): $(MASTER)
466	@echo "Creating new $@ file from $(MASTER)..."
467	@if [ ! $(UNSECURE) ]; then \
468	$(RCAT) $(MASTER) | \
469	$(AWK) -F: '{if ($$1 != "+") \
470		print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
471		> $(PASSWD) ; \
472	else $(RCAT) $(MASTER) | \
473	$(AWK) -F: '{if ($$1 != "+") \
474		print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
475		> $(PASSWD) ; fi
476
477
478passwd.byname: $(PASSWD)
479	@echo "Updating $@..."
480	$(CAT) $(PASSWD) | \
481	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
482		| $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
483		$(RMV) $(TMP) $@
484	@$(DBLOAD) -c
485	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
486	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
487
488
489passwd.byuid: $(PASSWD)
490	@echo "Updating $@..."
491	$(CAT) $(PASSWD) | \
492	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
493		| $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
494		$(RMV) $(TMP) $@
495	@$(DBLOAD) -c
496	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
497	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
498	@$(MAKE) -f ../Makefile netid
499
500
501group.byname: $(GROUP)
502	@echo "Updating $@..."
503	$(CAT) $(GROUP) | \
504	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
505		| $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
506		$(RMV) $(TMP) $@
507	@$(DBLOAD) -c
508	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
509	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
510
511
512group.bygid: $(GROUP)
513	@echo "Updating $@..."
514	$(CAT) $(GROUP) | \
515	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
516		| $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
517		$(RMV) $(TMP) $@
518	@$(DBLOAD) -c
519	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
520	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
521	@$(MAKE) -f ../Makefile netid
522
523
524netid.byname: $(GROUP) $(PASSWD)
525	@echo "Updating $@..."
526	@$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \
527		-d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \
528		$(RMV) $(TMP) $@
529	@$(DBLOAD) -c
530	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
531	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
532
533
534master.passwd.byname: $(MASTER)
535	@echo "Updating $@..."
536.if ${MASTER} == "/dev/null"
537	@echo "Master.passwd source file not found -- skipping"
538.else
539	$(CAT) $(MASTER) | \
540	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
541		| $(DBLOAD) ${S} -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
542		$(RMV) $(TMP) $@
543	@$(DBLOAD) -c
544	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
545	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
546.endif
547
548
549master.passwd.byuid: $(MASTER)
550	@echo "Updating $@..."
551.if ${MASTER} == "/dev/null"
552	@echo "Master.passwd source file not found -- skipping"
553.else
554	$(CAT) $(MASTER) | \
555	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
556		| $(DBLOAD) ${S} -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
557		$(RMV) $(TMP) $@
558	@$(DBLOAD) -c
559	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
560	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
561.endif
562
563
564amd.host: $(AMDHOST)
565	@echo "Updating $@..."
566	$(CAT) $(AMDHOST) | \
567	$(AWK) '$$1 !~ "^#.*"  { \
568	  for (i = 1; i <= NF; i++) \
569	  if (i == NF) { \
570	    if (substr($$i, length($$i), 1) == "\\") \
571	      printf("%s", substr($$i, 1, length($$i) - 1)); \
572	    else \
573	      printf("%s\n", $$i); \
574	  } \
575	  else \
576	    printf("%s ", $$i); \
577	}' | \
578	$(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP); \
579		$(RMV) $(TMP) $@
580	@$(DBLOAD) -c
581	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
582	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
583
584