summaryrefslogtreecommitdiff
path: root/scripts/ypMakefile.in
blob: 69213ac65805f07ee6af8464c127ff5abae7ac7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
#
# Makefile for the NIS databases
#
# This Makefile should only be run on the NIS master server of a domain.
# All updated maps will be pushed to all NIS slave servers listed in the
# /var/yp/ypservers file. Please make sure that the hostnames of all
# NIS servers in your domain are listed in /var/yp/ypservers.
#
# This Makefile can be modified to support more NIS maps if desired.
#

# Set the following variable to "-b" to have NIS servers use the domain
# name resolver for hosts not in the current domain. This is only needed,
# if you have SunOS slave YP server, which gets here maps from this
# server. The NYS YP server will ignore the YP_INTERDOMAIN key.
#B=-b
B=

# If we have only one server, we don't have to push the maps to the
# slave servers (NOPUSH=true). If you have slave servers, change this
# to "NOPUSH=false" and put all hostnames of your slave servers in the file
# /var/yp/ypservers.
NOPUSH=true

# yppush copies updated NIS databases (or maps) from the master NIS server
# to the slave servers within a NIS domain and listens for their answer.
# yppush will ask portmap to assign it a random port number to listen on
# by default. To specify a fixed port number or any aditional options,
# edit variable YPPUSH_ARGS.
# e.g. YPPUSH_ARGS = --port 836
YPPUSH_ARGS =

# We do not put password entries with lower UIDs (the root and system
# entries) in the NIS password database, for security. MINUID is the
# lowest uid that will be included in the password maps. If you
# create shadow maps, the UserID for a shadow entry is taken from
# the passwd file. If no entry is found, this shadow entry is
# ignored.
# MINGID is the lowest gid that will be included in the group maps.
MINUID=$(shell TMP=`egrep '^UID_MIN\s+[0-9]+' /etc/login.defs|sed -e 's/^UID_MIN//'` ; [ -n "$$TMP" ] && echo "$$TMP" || echo 1000)
MINGID=$(shell TMP=`egrep '^GID_MIN\s+[0-9]+' /etc/login.defs|sed -e 's/^GID_MIN//'` ; [ -n "$$TMP" ] && echo "$$TMP" || echo 1000)

# Should we merge the passwd file with the shadow file ?
# MERGE_PASSWD=true|false
MERGE_PASSWD=true

# Should we merge the group file with the gshadow file ?
# MERGE_GROUP=true|false
MERGE_GROUP=true

# These are commands which this Makefile needs to properly rebuild the
# NIS databases. Don't change these unless you have a good reason.
AWK = @AWK@
MAKE = @MAKE@
UMASK = umask 066

#
# These are the source directories for the NIS files; normally
# that is /etc but you may want to move the source for the password
# and group files to (for example) /var/yp/ypfiles. The directory
# for passwd, group and shadow is defined by YPPWDDIR, the rest is
# taken from YPSRCDIR.
#
YPSRCDIR = /etc
YPPWDDIR = /etc
YPBINDIR = @YPBINDIR@
YPSBINDIR = @SBINDIR@
YPDIR = @YPMAPDIR@
YPMAPDIR = $(YPDIR)/$(DOMAIN)

# These are the files from which the NIS databases are built. You may edit
# these to taste in the event that you wish to keep your NIS source files
# seperate from your NIS server's actual configuration files.
#
GROUP       = $(YPPWDDIR)/group
PASSWD      = $(YPPWDDIR)/passwd
SHADOW	    = $(YPPWDDIR)/shadow
GSHADOW     = $(YPPWDDIR)/gshadow
ADJUNCT     = $(YPPWDDIR)/passwd.adjunct
#ALIASES     = $(YPSRCDIR)/aliases  # aliases could be in /etc or /etc/mail
ALIASES     = @ALIASES@
ETHERS      = $(YPSRCDIR)/ethers     # ethernet addresses (for rarpd)
BOOTPARAMS  = $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd)
HOSTS       = $(YPSRCDIR)/hosts
NETWORKS    = $(YPSRCDIR)/networks
PRINTCAP    = $(YPSRCDIR)/printcap
PROTOCOLS   = $(YPSRCDIR)/protocols
PUBLICKEYS  = $(YPSRCDIR)/publickey
RPC 	    = $(YPSRCDIR)/rpc
SERVICES    = $(YPSRCDIR)/services
NETGROUP    = $(YPSRCDIR)/netgroup
NETID	    = $(YPSRCDIR)/netid
AMD_HOME    = $(YPSRCDIR)/amd.home
TIMEZONE    = $(YPSRCDIR)/timezone
LOCALE      = $(YPSRCDIR)/locale
NETMASKS    = $(YPSRCDIR)/netmasks
AUTO_MAPS   = auto.master auto.home auto.local

YPSERVERS = $(YPDIR)/ypservers	# List of all NIS slave servers

target: Makefile
	@test ! -d $(LOCALDOMAIN) && mkdir $(LOCALDOMAIN) ; \
	cd $(LOCALDOMAIN)  ; \
	$(NOPUSH) || $(MAKE) -f ../Makefile ypservers; \
	$(MAKE) -f ../Makefile all

# If you don't want some of these maps built, feel free to comment
# them out from this list.

all:  passwd group hosts rpc services netid protocols netgrp mail \
	shadow publickey # networks ethers bootparams printcap \
	# amd.home autofs passwd.adjunct \
	# timezone locale netmasks


########################################################################
#                                                                      #
#  DON'T EDIT ANYTHING BELOW IF YOU DON'T KNOW WHAT YOU ARE DOING !!!  #
#                                                                      #
########################################################################

DBLOAD = $(YPBINDIR)/makedbm -c -m `$(YPBINDIR)/yphelper --hostname`
MKNETID = $(YPBINDIR)/mknetid
YPPUSH = $(YPSBINDIR)/yppush $(YPPUSH_ARGS)
MERGER = $(YPBINDIR)/yphelper
DOMAIN = `basename \`pwd\``
LOCALDOMAIN = `/bin/domainname`
REVNETGROUP = $(YPBINDIR)/revnetgroup
CREATE_PRINTCAP = $(YPBINDIR)/create_printcap

ethers:	   	ethers.byname ethers.byaddr
hosts:	   	hosts.byname hosts.byaddr
networks:  	networks.byaddr networks.byname
protocols: 	protocols.bynumber protocols.byname
rpc:	   	rpc.byname rpc.bynumber
services:  	services.byname services.byservicename
passwd:    	passwd.byname passwd.byuid
group:     	group.byname group.bygid
shadow:	   	shadow.byname
passwd.adjunct:	passwd.adjunct.byname
netid:	   	netid.byname
netgrp:	   	netgroup netgroup.byhost netgroup.byuser
publickey: 	publickey.byname
mail:	   	mail.aliases
timezone:      timezone.byname
locale:                locale.byname
netmasks:      netmasks.byaddr
autofs:     	$(AUTO_MAPS)

ypservers: $(YPSERVERS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 != "" && $$1 !~ "#") print $$0"\t"$$0 }' \
	    $(YPSERVERS) | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

$(YPSERVERS):
	@echo -n "Generating $*..."
	@uname -n > $(YPSERVERS)

bootparams: $(BOOTPARAMS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 != "" && $$1 !~ "#" && $$1 != "+") \
		print $$0 }' $(BOOTPARAMS) | $(DBLOAD) -r -i $(BOOTPARAMS) \
		 -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


ethers.byname: $(ETHERS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 != "" && $$1 !~ "#" && $$1 != "+") \
		print $$2"\t"$$0 }' $(ETHERS) | $(DBLOAD) -r -i $(ETHERS) \
						-o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


ethers.byaddr: $(ETHERS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 != "" && $$1 !~ "#" && $$1 != "+") \
		print $$1"\t"$$0 }' $(ETHERS) | $(DBLOAD) -r -i $(ETHERS) \
						-o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


netgroup: $(NETGROUP) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 != "" && $$1 !~ "#" && $$1 != "+") \
		print $$0 }' $(NETGROUP) | $(DBLOAD) -i $(NETGROUP) \
		 -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


netgroup.byhost: $(NETGROUP) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(REVNETGROUP) -h < $(NETGROUP) | $(DBLOAD) -i $(NETGROUP) \
		-o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


netgroup.byuser: $(NETGROUP) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(REVNETGROUP) -u < $(NETGROUP) | $(DBLOAD) -i $(NETGROUP) \
		-o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


hosts.byname: $(HOSTS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "#"; n++) \
		print $$n"\t"$$0 }' $(HOSTS) | $(DBLOAD) -r $(B) -l \
			-i $(HOSTS) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

hosts.byaddr: $(HOSTS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 !~ "#" && $$1 != "") print $$1"\t"$$0 }' \
	   $(HOSTS) | $(DBLOAD) -r $(B) -i $(HOSTS) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


networks.byname: $(NETWORKS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if($$1 !~ "#" && $$1 != "") { print $$1"\t"$$0; \
		 for (n=3; n<=NF && $$n !~ "#"; n++) print $$n"\t"$$0 \
			}}' $(NETWORKS) | $(DBLOAD) -r -i $(NETWORKS) \
			 -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


networks.byaddr: $(NETWORKS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 !~ "#" && $$1 != "") print $$2"\t"$$0 }' \
		 $(NETWORKS) | $(DBLOAD) -r -i $(NETWORKS) \
		 -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


protocols.byname: $(PROTOCOLS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 !~ "#" && $$1 != "") { print $$1"\t"$$0; \
		for (n=3; n<=NF && $$n !~ "#"; n++) \
		print $$n"\t"$$0}}' $(PROTOCOLS) | $(DBLOAD) -r -i \
			$(PROTOCOLS) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


protocols.bynumber: $(PROTOCOLS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 !~ "#" && $$1 != "") print $$2"\t"$$0 }' \
		$(PROTOCOLS) | $(DBLOAD) -r -i $(PROTOCOLS) \
		 -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


rpc.byname: $(RPC) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 !~ "#"  && $$1 != "") { print $$1"\t"$$0; \
		for (n=3; n<=NF && $$n !~ "#"; n++)  print $$n"\t"$$0 \
		  }}' $(RPC) | $(DBLOAD) -r -i $(RPC) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


rpc.bynumber: $(RPC) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 !~ "#" && $$1 != "") print $$2"\t"$$0 }' $(RPC) \
		| $(DBLOAD) -r -i $(RPC) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


services.byname: $(SERVICES) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 !~ "#" && $$1 != "") print $$2"\t"$$0 }' \
		$(SERVICES) | $(DBLOAD) -r -i $(SERVICES) \
		-o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

services.byservicename: $(SERVICES) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 !~ "#" && $$1 != "") { \
		split($$2,A,"/") ; TMP = "/" A[2] ; \
		print $$1 TMP"\t"$$0 ; \
		if (! seen[$$1]) { seen[$$1] = 1 ; print $$1"\t"$$0 ; } \
		for (N = 3; N <= NF && $$N !~ "#" ; N++) { \
			if ($$N !~ "#" && $$N != "") print $$N TMP"\t"$$0 ; \
			if (! seen[$$N]) { seen[$$N] = 1 ; print $$N"\t"$$0 ; } \
		} } } ' \
		$(SERVICES) | $(DBLOAD) -r -i $(SERVICES) \
		-o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


ifeq (x$(MERGE_PASSWD),xtrue)
passwd.byname: $(PASSWD) $(SHADOW) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(UMASK); \
	$(MERGER) -p $(PASSWD) $(SHADOW) | \
	   $(AWK) -F: '!/^[-+#]/ { if ($$1 != "" && $$3 >= $(MINUID) ) \
	   print $$1"\t"$$0 }' | $(DBLOAD) -i $(PASSWD) \
		-o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

passwd.byuid: $(PASSWD) $(SHADOW) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(UMASK); \
	$(MERGER) -p $(PASSWD) $(SHADOW) | \
	   $(AWK) -F: '!/^[-+#]/ { if ($$1 != "" && $$3 >= $(MINUID) ) \
	   print $$3"\t"$$0 }' | $(DBLOAD) -i $(PASSWD) \
		 -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

# Don't build a shadow map !
shadow.byname:
	@echo "Updating $@... Ignored -> merged with passwd"

else

passwd.byname: $(PASSWD) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(UMASK); \
	$(AWK) -F: '!/^[-+#]/ { if ($$1 != "" && $$3 >= $(MINUID) ) \
	   print $$1"\t"$$0 }' $(PASSWD) | $(DBLOAD) -i $(PASSWD) \
		-o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

passwd.byuid: $(PASSWD) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(UMASK); \
	$(AWK) -F: '!/^[-+#]/ { if ($$1 != "" && $$3 >= $(MINUID) ) \
	   print $$3"\t"$$0 }' $(PASSWD) | $(DBLOAD) -i $(PASSWD) \
		 -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

shadow.byname: $(SHADOW) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(UMASK); \
	$(AWK) -F: '{ if (FILENAME ~ /shadow$$/) { \
		if (UID[$$1] >= $(MINUID) ) print $$1"\t"$$0; \
			} else UID[$$1] = $$3; }' $(PASSWD) $(SHADOW) \
		| $(DBLOAD) -s -i $(SHADOW) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@
endif

passwd.adjunct.byname: $(ADJUNCT) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(UMASK); \
	$(AWK) -F: '!/^[-+#]/ { if ($$1 != "" ) print $$1"\t"$$0 }' \
		$(ADJUNCT) | $(DBLOAD) -s -i $(ADJUNCT) -o $(YPMAPDIR)/$@ - $@
	@chmod 700 $(YPDIR)/$(DOMAIN)/$@*
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

ifeq (x$(MERGE_GROUP),xtrue)
group.byname: $(GROUP) $(GSHADOW) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(UMASK); \
	$(MERGER) -g $(GROUP) $(GSHADOW) | \
	$(AWK) -F: '!/^[-+#]/ { if ($$1 != "" && $$3 >= $(MINGID) ) \
	print $$1"\t"$$0 }' | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

group.bygid: $(GROUP) $(GSHADOW) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(UMASK); \
	$(MERGER) -g $(GROUP) $(GSHADOW) | \
	$(AWK) -F: '!/^[-+#]/ { if ($$1 != "" && $$3 >= $(MINGID) ) \
	print $$3"\t"$$0 }' | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

else

group.byname: $(GROUP) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(UMASK); \
	$(AWK) -F: '!/^[-+#]/ { if ($$1 != "" && $$3 >= $(MINGID) ) \
					print $$1"\t"$$0 }' $(GROUP) \
		| $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

group.bygid: $(GROUP) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(UMASK); \
	$(AWK) -F: '!/^[-+#]/ { if ($$1 != "" && $$3 >= $(MINGID) ) \
					print $$3"\t"$$0 }' $(GROUP) \
		| $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@
endif

netid.byname: $(GROUP) $(PASSWD) $(HOSTS) $(wildcard $(NETID)) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -d $(DOMAIN) \
		-n $(NETID) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


mail.aliases: $(ALIASES) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ \
			if ($$1 ~ "^#.*") \
				next; \
			if ($$1 == "" || $$1 == "+") { \
				if (line != "") \
					{print line; line = "";} \
				next; \
			} \
			if ($$0 ~ /^[[:space:]]/) \
				line = line $$0; \
			else { \
				if (line != "") \
					{print line; line = "";} \
				line = $$0; \
			} \
		} \
		END {if (line != "") print line}' \
		$(ALIASES) | $(DBLOAD) --aliases \
			-i $(ALIASES) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


publickey.byname: $(PUBLICKEYS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if($$1 !~ "#" && $$1 != "") { print $$1"\t"$$2 }}' \
		$(PUBLICKEYS) | $(DBLOAD) -i $(PUBLICKEYS) \
		 -o $(YPMAPDIR)/$@ - $@
	@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


printcap: $(PRINTCAP) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(CREATE_PRINTCAP) < $(PRINTCAP) | \
		$(DBLOAD) -i $(PRINTCAP) -o $(YPMAPDIR)/$@ - $@
	@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

$(AUTO_MAPS): %: $(YPSRCDIR)/%
	@echo "Updating $@..."
	-@sed -e "/^#/d" -e s/#.*$$// "$<" | $(DBLOAD) \
		-i "$<" -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

amd.home: $(AMD_HOME) $(YPDIR)/Makefile
	@echo "Updating $@..."
	-@sed -e "s/#.*$$//" -e "/^$$/d" $(AMD_HOME) | \
	$(AWK) '{\
		for (i = 1; i <= NF; i++)\
		   if (i == NF) { \
		      if (substr($$i, length($$i), 1) == "\\") \
	                   printf("%s", substr($$i, 1, length($$i) -1)); \
	               else \
			  printf("%s\n",$$i); \
	              } \
		   else \
		      printf("%s ",$$i);\
		}' | $(DBLOAD) -i $(AMD_HOME) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@

timezone.byname: $(TIMEZONE) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 != "" && $$1 !~ "#") \
		print $$2"\t"$$0 }' $(TIMEZONE) | $(DBLOAD) \
			-r -i $(TIMEZONE) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


locale.byname: $(LOCALE) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 != "" && $$1 !~ "#") \
	     print $$2"\t"$$0"\n"$$1"\t"$$2"\t"$$1 }' $(LOCALE) | $(DBLOAD) \
		-r -i $(LOCALE) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@


netmasks.byaddr: $(NETMASKS) $(YPDIR)/Makefile
	@echo "Updating $@..."
	@$(AWK) '{ if ($$1 != "" && $$1 !~ "#") \
		print $$1"\t"$$2 }' $(NETMASKS) | $(DBLOAD) \
			-r -i $(NETMASKS) -o $(YPMAPDIR)/$@ - $@
	-@$(NOPUSH) || $(YPPUSH) -d $(DOMAIN) $@