xref: /freebsd/usr.sbin/ypserv/Makefile.yp (revision 4451976029159d285d7682f0740d07cb10cb94c1)
1778c7b1cSBill Paul#
2778c7b1cSBill Paul# Makefile for the NIS databases
3778c7b1cSBill Paul#
444519760SBill Paul# $Id: Makefile.yp,v 1.12 1996/08/09 17:55:18 adam Exp $
5778c7b1cSBill Paul#
6778c7b1cSBill Paul# This Makefile should only be run on the NIS master server of a domain.
7778c7b1cSBill Paul# All updated maps will be pushed to all NIS slave servers listed in the
8778c7b1cSBill Paul# /var/yp/ypservers file. Please make sure that the hostnames of all
9778c7b1cSBill Paul# NIS servers in your domain are listed in /var/yp/ypservers.
10778c7b1cSBill Paul#
11778c7b1cSBill Paul# This Makefile can be modified to support more NIS maps if desired.
12778c7b1cSBill Paul#
13778c7b1cSBill Paul
14778c7b1cSBill Paul# If this machine is an NIS master, comment out this next line so
15778c7b1cSBill Paul# that changes to the NIS maps can be propagated to the slave servers.
16778c7b1cSBill Paul# (By default we assume that we are only serving a small domain with
17778c7b1cSBill Paul# only one server.)
18778c7b1cSBill Paul#
19778c7b1cSBill PaulNOPUSH = "True"
20778c7b1cSBill Paul
21778c7b1cSBill Paul# If you want to use a FreeBSD NIS server to serve non-FreeBSD clients
22778c7b1cSBill Paul# (i.e. clients who expect the password field in the passwd maps to be
23778c7b1cSBill Paul# valid) then uncomment this line. This will cause $YPDIR/passwd to
24778c7b1cSBill Paul# be generated with valid password fields. This is insecure: FreeBSD
25778c7b1cSBill Paul# normally only serves the master.passwd maps (which have real encrypted
26778c7b1cSBill Paul# passwords in them) to the superuser on other FreeBSD machines, but
27778c7b1cSBill Paul# non-FreeBSD clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX,
28778c7b1cSBill Paul# etc...) will only work properly in 'unsecure' mode.
29778c7b1cSBill Paul#
30778c7b1cSBill Paul#UNSECURE = "True"
31778c7b1cSBill Paul
3244519760SBill Paul# The following line encodes the YP_INTERDOMAIN key into the hosts.byname
3344519760SBill Paul# and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve
3444519760SBill Paul# hosts not in the current domain. Commenting this line out will disable
3544519760SBill Paul# the DNS lookups.
3644519760SBill PaulB=-b
3744519760SBill Paul
3844519760SBill Paul# Normally, the master.passwd.* maps are guarded against access from
3944519760SBill Paul# non-privileged users. By commenting out the following line, the YP_SECURE
4044519760SBill Paul# key will be removed from these maps, allowing anyone to access them.
4144519760SBill PaulS=-s
4244519760SBill Paul
43778c7b1cSBill Paul# These are commands which this Makefile needs to properly rebuild the
44778c7b1cSBill Paul# NIS databases. Don't change these unless you have a good reason. Also
45778c7b1cSBill Paul# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary
46778c7b1cSBill Paul# and it'll break everything in sight.
47778c7b1cSBill Paul#
48778c7b1cSBill PaulAWK = /usr/bin/awk
49778c7b1cSBill PaulRM  = @/bin/rm -f
50b2264be8SBill PaulMV  = @/bin/mv -f
51778c7b1cSBill PaulRCAT = /bin/cat
52778c7b1cSBill PaulCAT = @$(RCAT)
53778c7b1cSBill Paul
54de88f160SAdam DavidMKDB = /usr/sbin/yp_mkdb
55de88f160SAdam DavidDBLOAD = $(MKDB) -m `hostname`
56778c7b1cSBill PaulMKNETID = /usr/libexec/mknetid
57b2264be8SBill PaulNEWALIASES = /usr/bin/newaliases
581fff226dSBill PaulYPPUSH = /usr/sbin/yppush
59920491cfSBill Paul.if !defined(UPDATE_DOMAIN)
60778c7b1cSBill PaulDOMAIN = `/bin/domainname`
61920491cfSBill Paul.else
62920491cfSBill PaulDOMAIN = $(UPDATE_DOMAIN)
63920491cfSBill Paul.endif
64778c7b1cSBill PaulREVNETGROUP = /usr/libexec/revnetgroup
65b2264be8SBill PaulNFILE = /tmp/ypmake
66b2264be8SBill PaulTMP = `$(RCAT) $(NFILE)`
67778c7b1cSBill Paul
68de88f160SAdam David# It is advisable to create a separate directory to contain the
69de88f160SAdam David# source files used to generate your NIS maps. If you intend to
70b2264be8SBill Paul# support multiple domains, something like /src/dir/$DOMAIN
71b2264be8SBill Paul# would work well.
72778c7b1cSBill PaulYPSRCDIR = /etc
73778c7b1cSBill PaulYPDIR = /var/yp
74778c7b1cSBill PaulYPMAPDIR = $(YPDIR)/$(DOMAIN)
75778c7b1cSBill Paul
76778c7b1cSBill Paul# These are the files from which the NIS databases are built. You may edit
77778c7b1cSBill Paul# these to taste in the event that you wish to keep your NIS source files
78778c7b1cSBill Paul# seperate from your NIS server's actual configuration files. Note that the
79778c7b1cSBill Paul# NIS passwd and master.passwd files are stored in /var/yp: the server's
80778c7b1cSBill Paul# real password database is not used by default. However, you may use
81778c7b1cSBill Paul# the real /etc/passwd and /etc/master.passwd files by:
82778c7b1cSBill Paul#
83778c7b1cSBill Paul#
84778c7b1cSBill Paul# - invoking yppasswdd without the -m option (yppasswdd will use
85778c7b1cSBill Paul#   /etc/master.passwd if no alternate master.passwd file is specified
86778c7b1cSBill Paul#   and do a 'pwd_mkdb' as needed).
87778c7b1cSBill Paul# - Specifying the location of the master.passwd file using the
88778c7b1cSBill Paul#   MASTER_PASSWD variable, i.e.:
89778c7b1cSBill Paul#
90778c7b1cSBill Paul#   # make MASTER_PASSWD=/path/to/some/other/master.passwd
91778c7b1cSBill Paul#
92778c7b1cSBill Paul# - (optionally): editing this Makefile to change the default location.
93778c7b1cSBill Paul#
94778c7b1cSBill Paul# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw
95778c7b1cSBill Paul# passwd file will be generated from the master.passwd file automagically.
96778c7b1cSBill Paul#
97778c7b1cSBill PaulETHERS    = $(YPSRCDIR)/ethers	   # ethernet addresses (for rarpd)
98778c7b1cSBill PaulBOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd)
99778c7b1cSBill PaulHOSTS     = $(YPSRCDIR)/hosts
100778c7b1cSBill PaulNETWORKS  = $(YPSRCDIR)/networks
101778c7b1cSBill PaulPROTOCOLS = $(YPSRCDIR)/protocols
102778c7b1cSBill PaulRPC 	  = $(YPSRCDIR)/rpc
103778c7b1cSBill PaulSERVICES  = $(YPSRCDIR)/services
104778c7b1cSBill PaulGROUP     = $(YPSRCDIR)/group
105b2264be8SBill PaulALIASES   = $(YPSRCDIR)/aliases
106b2264be8SBill PaulNETGROUP  = $(YPDIR)/netgroup
107778c7b1cSBill PaulPASSWD    = $(YPDIR)/passwd
108778c7b1cSBill Paul.if !defined(MASTER_PASSWD)
109778c7b1cSBill PaulMASTER    = $(YPDIR)/master.passwd
110778c7b1cSBill Paul.else
111778c7b1cSBill PaulMASTER	  = $(MASTER_PASSWD)
112778c7b1cSBill Paul.endif
113778c7b1cSBill PaulYPSERVERS = $(YPDIR)/ypservers	# List of all NIS servers for a domain
114778c7b1cSBill PaulPUBLICKEY = $(YPSRCDIR)/publickey
1151fe3e67aSBill PaulNETID     = $(YPSRCDIR)/netid
11657948c0bSPeter WemmAMDHOST   = $(YPSRCDIR)/amd.host
117778c7b1cSBill Paul
118778c7b1cSBill Paultarget:
119b2264be8SBill Paul	@$(RM) $(NFILE)
120778c7b1cSBill Paul	@if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \
121920491cfSBill Paul	cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \
122778c7b1cSBill Paul	make -f ../Makefile all; echo "NIS Map update completed."
123778c7b1cSBill Paul
124778c7b1cSBill Paul# If you don't want some of these maps built, feel free to comment
125778c7b1cSBill Paul# them out from this list.
126778c7b1cSBill Paul# Note that we don't build the ethers or boorparams maps by default
127778c7b1cSBill Paul# since /etc/ethers and /etc/bootparams are not likely to be present
128778c7b1cSBill Paul# on all systems.
129778c7b1cSBill Paul#
130778c7b1cSBill Paul
131b2264be8SBill Paulall:  master.passwd passwd hosts group networks protocols rpc \
132a6dbeb65SPeter Wemm      services servers netid
133a6dbeb65SPeter Wemm      # aliases publickey netgrp ethers bootparam amd.host
134778c7b1cSBill Paul
135778c7b1cSBill Paulethers:	   ethers.byname ethers.byaddr
136778c7b1cSBill Paulbootparam: bootparams
137778c7b1cSBill Paulhosts:	   hosts.byname hosts.byaddr
138778c7b1cSBill Paulnetworks:  networks.byaddr networks.byname
139778c7b1cSBill Paulprotocols: protocols.bynumber protocols.byname
140778c7b1cSBill Paulrpc:	   rpc.byname rpc.bynumber
141778c7b1cSBill Paulservices:  services.byname
142778c7b1cSBill Paulpasswd:    passwd.byname passwd.byuid
143778c7b1cSBill Paulgroup:     group.byname group.bygid
144778c7b1cSBill Paulnetgrp:    netgroup
145778c7b1cSBill Paulnetid:	   netid.byname
146778c7b1cSBill Paulservers:   ypservers
147778c7b1cSBill Paulpublickey: publickey.byname
148b2264be8SBill Paulaliases:   mail.aliases
149778c7b1cSBill Paul
150778c7b1cSBill Paulmaster.passwd:	master.passwd.byname master.passwd.byuid
151778c7b1cSBill Paul
152b3e93234SBill Paul#
153b3e93234SBill Paul# This is a special target used only when doing in-place updates with
154b3e93234SBill Paul# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd
155b3e93234SBill Paul# server and won't need to be remade. They will have to be pushed to the
156b3e93234SBill Paul# slaves however. Calling this target implicitly insures that this will
157b3e93234SBill Paul# happen.
158b3e93234SBill Paul#
159b3e93234SBill Paulpushpw:
160b3e93234SBill Paul	@$(DBLOAD) -c
161b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi
162b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi
163b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi
164b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi
165b3e93234SBill Paul
166b2264be8SBill Paulmail.aliases: $(ALIASES)
167b2264be8SBill Paul	@echo "Updating $@..."
168b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
169de88f160SAdam David	@$(NEWALIASES) -oA$(ALIASES)
170d91013b5SAdam David	@$(MKDB) -u $(ALIASES).db \
171b2264be8SBill Paul		| $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP)
172b2264be8SBill Paul	@$(MV) $(TMP) $@
173b2264be8SBill Paul	@$(DBLOAD) -c
174b2264be8SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
175b2264be8SBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
176b2264be8SBill Paul
177778c7b1cSBill Paul
178778c7b1cSBill Paulypservers: $(YPSERVERS)
179778c7b1cSBill Paul	@echo "Updating $@..."
180b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
181778c7b1cSBill Paul	$(CAT) $(YPSERVERS) | \
182778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#") print $$0"\t"$$0 }' $^ \
183b2264be8SBill Paul		| $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP)
184b2264be8SBill Paul	@$(MV) $(TMP) $@
185b2264be8SBill Paul	@$(DBLOAD) -c
186778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
187778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
188778c7b1cSBill Paul
189b2264be8SBill Paul
190778c7b1cSBill Paulethers.byname: $(ETHERS)
191778c7b1cSBill Paul	@echo "Updating $@..."
192b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
193778c7b1cSBill Paul	$(CAT) $(ETHERS) | \
194778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
195778c7b1cSBill Paul		print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \
196b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
197b2264be8SBill Paul	@$(MV) $(TMP) $@
198b2264be8SBill Paul	@$(DBLOAD) -c
199a6dbeb65SPeter Wemm	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
200778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
201778c7b1cSBill Paul
202778c7b1cSBill Paul
203778c7b1cSBill Paulethers.byaddr: $(ETHERS)
204778c7b1cSBill Paul	@echo "Updating $@..."
205b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
206778c7b1cSBill Paul	$(CAT) $(ETHERS) | \
207778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
208778c7b1cSBill Paul		print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \
209b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
210b2264be8SBill Paul	@$(MV) $(TMP) $@
211b2264be8SBill Paul	@$(DBLOAD) -c
212778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
213778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
214778c7b1cSBill Paul
215778c7b1cSBill Paul
216778c7b1cSBill Paulbootparams: $(BOOTPARAMS)
217778c7b1cSBill Paul	@echo "Updating $@..."
218b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
219778c7b1cSBill Paul	$(CAT) $(BOOTPARAMS) | \
220778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
221778c7b1cSBill Paul		print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \
222b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
223b2264be8SBill Paul	@$(MV) $(TMP) $@
224b2264be8SBill Paul	@$(DBLOAD) -c
225778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
226778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
227778c7b1cSBill Paul
228778c7b1cSBill Paul
229778c7b1cSBill Paulnetgroup: $(NETGROUP) netgroup.byhost netgroup.byuser
230778c7b1cSBill Paul	@echo "Updating $@..."
231b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
232778c7b1cSBill Paul	$(CAT) $(NETGROUP) | \
233778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
234778c7b1cSBill Paul		print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
235b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
236b2264be8SBill Paul	@$(MV) $(TMP) $@
237b2264be8SBill Paul	@$(DBLOAD) -c
238778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
239778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
240778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
241778c7b1cSBill Paul
242778c7b1cSBill Paul
243778c7b1cSBill Paulnetgroup.byhost: $(NETGROUP)
244778c7b1cSBill Paul	@echo "Updating $@..."
245b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
246778c7b1cSBill Paul	$(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \
247778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
248778c7b1cSBill Paul		print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
249b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
250b2264be8SBill Paul	@$(MV) $(TMP) $@
251b2264be8SBill Paul	@$(DBLOAD) -c
252778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
253778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
254778c7b1cSBill Paul
255778c7b1cSBill Paul
256778c7b1cSBill Paulnetgroup.byuser: $(NETGROUP)
257778c7b1cSBill Paul	@echo "Updating $@..."
258b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
259778c7b1cSBill Paul	$(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \
260778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
261778c7b1cSBill Paul		print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
262b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
263b2264be8SBill Paul	@$(MV) $(TMP) $@
264b2264be8SBill Paul	@$(DBLOAD) -c
265778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
266778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
267778c7b1cSBill Paul
268778c7b1cSBill Paul
269778c7b1cSBill Paulhosts.byname: $(HOSTS)
270778c7b1cSBill Paul	@echo "Updating $@..."
271b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
272778c7b1cSBill Paul	$(CAT) $(HOSTS) | \
273778c7b1cSBill Paul	$(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "#"; n++) \
274778c7b1cSBill Paul		print $$n"\t"$$0 }' $^ | $(DBLOAD) -i $(HOSTS)  \
275b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
276b2264be8SBill Paul	@$(MV) $(TMP) $@
277b2264be8SBill Paul	@$(DBLOAD) -c
278778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
279778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
280778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
281778c7b1cSBill Paul
282b2264be8SBill Paul
283778c7b1cSBill Paulhosts.byaddr: $(HOSTS)
284778c7b1cSBill Paul	@echo "Updating $@..."
285b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
286778c7b1cSBill Paul	$(CAT) $(HOSTS) | \
287778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$1"\t"$$0 }' $^ \
288b2264be8SBill Paul		| $(DBLOAD) -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP)
289b2264be8SBill Paul	@$(MV) $(TMP) $@
290b2264be8SBill Paul	@$(DBLOAD) -c
291778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
292778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
293778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
294778c7b1cSBill Paul
295778c7b1cSBill Paul
296778c7b1cSBill Paulnetworks.byname: $(NETWORKS)
297778c7b1cSBill Paul	@echo "Updating $@..."
298b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
299778c7b1cSBill Paul	$(CAT) $(NETWORKS) | \
300778c7b1cSBill Paul	$(AWK) \
301778c7b1cSBill Paul	   '$$1 !~ "#"  { print $$1"\t"$$0; \
302778c7b1cSBill Paul			  for (n=3; n<=NF && $$n !~ "#"; n++) \
303778c7b1cSBill Paul			      print $$n"\t"$$0 \
304b2264be8SBill Paul		}' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP)
305b2264be8SBill Paul	@$(MV) $(TMP) $@
306b2264be8SBill Paul	@$(DBLOAD) -c
307778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
308778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
309778c7b1cSBill Paul
310778c7b1cSBill Paul
311778c7b1cSBill Paulnetworks.byaddr: $(NETWORKS)
312778c7b1cSBill Paul	@echo "Updating $@..."
313b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
314778c7b1cSBill Paul	$(CAT) $(NETWORKS) | \
315778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \
316b2264be8SBill Paul		| $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP)
317b2264be8SBill Paul	@$(MV) $(TMP) $@
318b2264be8SBill Paul	@$(DBLOAD) -c
319778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
320778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
321778c7b1cSBill Paul
322778c7b1cSBill Paul
323778c7b1cSBill Paulprotocols.byname: $(PROTOCOLS)
324778c7b1cSBill Paul	@echo "Updating $@..."
325b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
326778c7b1cSBill Paul	$(CAT) $(PROTOCOLS) | \
327778c7b1cSBill Paul	$(AWK) \
328778c7b1cSBill Paul	   '$$1 !~ "#"	{ print $$1"\t"$$0; \
329778c7b1cSBill Paul			  for (n=3; n<=NF && $$n !~ "#"; n++) \
330778c7b1cSBill Paul			      print $$n"\t"$$0 \
331778c7b1cSBill Paul			}' $^ | $(DBLOAD) -i $(PROTOCOLS) \
332b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
333b2264be8SBill Paul	@$(MV) $(TMP) $@
334b2264be8SBill Paul	@$(DBLOAD) -c
335778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
336778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
337778c7b1cSBill Paul
338778c7b1cSBill Paul
339778c7b1cSBill Paulprotocols.bynumber: $(PROTOCOLS)
340778c7b1cSBill Paul	@echo "Updating $@..."
341b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
342778c7b1cSBill Paul	$(CAT) $(PROTOCOLS) | \
343778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \
344b2264be8SBill Paul		| $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP)
345b2264be8SBill Paul	@$(MV) $(TMP) $@
346b2264be8SBill Paul	@$(DBLOAD) -c
347778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
348778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
349778c7b1cSBill Paul
350778c7b1cSBill Paul
351778c7b1cSBill Paulrpc.byname: $(RPC)
352778c7b1cSBill Paul	@echo "Updating $@..."
353b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
354778c7b1cSBill Paul	$(CAT) $(RPC) | \
355778c7b1cSBill Paul	$(AWK) \
356778c7b1cSBill Paul	   '$$1 !~ "#"  { print $$1"\t"$$0; \
357778c7b1cSBill Paul			  for (n=3; n<=NF && $$n !~ "#"; n++) \
358778c7b1cSBill Paul			      print $$n"\t"$$0 \
359b2264be8SBill Paul		}' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP)
360b2264be8SBill Paul	@$(MV) $(TMP) $@
361b2264be8SBill Paul	@$(DBLOAD) -c
362778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
363778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
364778c7b1cSBill Paul
365778c7b1cSBill Paul
366778c7b1cSBill Paulrpc.bynumber: $(RPC)
367778c7b1cSBill Paul	@echo "Updating $@..."
368b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
369778c7b1cSBill Paul	$(CAT) $(RPC) | \
370778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \
371b2264be8SBill Paul		| $(DBLOAD)  -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP)
372b2264be8SBill Paul	@$(MV) $(TMP) $@
373b2264be8SBill Paul	@$(DBLOAD) -c
374778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
375778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
376778c7b1cSBill Paul
377778c7b1cSBill Paul
378778c7b1cSBill Paulservices.byname: $(SERVICES)
379778c7b1cSBill Paul	@echo "Updating $@..."
380b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
381778c7b1cSBill Paul	$(CAT) $(SERVICES) | \
382778c7b1cSBill Paul	$(AWK) \
38388b4ff3cSPeter Wemm	   '$$1 !~ "#"  { for (n=1; n<=NF && $$n !~ "#"; n++) { \
38488b4ff3cSPeter Wemm			    if (index($$2,"udp")) { printf("%s/udp",$$n) } \
38588b4ff3cSPeter Wemm			    else { printf("%s/tcp",$$n) }; print "\t"$$0 ; \
38688b4ff3cSPeter Wemm			    if (n == 1) n = 2; \
38788b4ff3cSPeter Wemm			  } ; print $$2"\t"$$0 ; \
388b2264be8SBill Paul		}' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP)
389b2264be8SBill Paul	@$(MV) $(TMP) $@
390b2264be8SBill Paul	@$(DBLOAD) -c
391778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
392778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
393778c7b1cSBill Paul
394778c7b1cSBill Paul
395778c7b1cSBill Paulpublickey.byname: $(PUBLICKEY)
396778c7b1cSBill Paul	@echo "Updating $@..."
397b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
398b2264be8SBill Paul	$(TMP) = `$(RCAT) $(NFILE)`
399778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$1"\t"$$2 }' $^ \
400b2264be8SBill Paul		| $(DBLOAD)  -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP)
401b2264be8SBill Paul	@$(MV) $(TMP) $@
402b2264be8SBill Paul	@$(DBLOAD) -c
403778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
404778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
405778c7b1cSBill Paul
406778c7b1cSBill Paul
407778c7b1cSBill Paul$(PASSWD): $(MASTER)
408778c7b1cSBill Paul	@echo "Creating new $@ file from $(MASTER)..."
409778c7b1cSBill Paul	@if [ ! $(UNSECURE) ]; then \
410778c7b1cSBill Paul	$(RCAT) $(MASTER) | \
411778c7b1cSBill Paul	$(AWK) -F: '{if ($$1 != "+") \
412778c7b1cSBill Paul		print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
413778c7b1cSBill Paul		> $(PASSWD) ; \
414778c7b1cSBill Paul	else $(RCAT) $(MASTER) | \
415778c7b1cSBill Paul	$(AWK) -F: '{if ($$1 != "+") \
416778c7b1cSBill Paul		print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
417778c7b1cSBill Paul		> $(PASSWD) ; fi
418778c7b1cSBill Paul
419778c7b1cSBill Paul
420778c7b1cSBill Paulpasswd.byname: $(PASSWD)
421778c7b1cSBill Paul	@echo "Updating $@..."
422b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
423778c7b1cSBill Paul	$(CAT) $(PASSWD) | \
424778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
425b2264be8SBill Paul		| $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP)
426b2264be8SBill Paul	@$(MV) $(TMP) $@
427b2264be8SBill Paul	@$(DBLOAD) -c
428778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
429778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
430778c7b1cSBill Paul
431b2264be8SBill Paul
432778c7b1cSBill Paulpasswd.byuid: $(PASSWD)
433778c7b1cSBill Paul	@echo "Updating $@..."
434b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
435778c7b1cSBill Paul	$(CAT) $(PASSWD) | \
436778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
437b2264be8SBill Paul		| $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP)
438b2264be8SBill Paul	@$(MV) $(TMP) $@
439b2264be8SBill Paul	@$(DBLOAD) -c
440778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
441778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
442778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
443778c7b1cSBill Paul
444778c7b1cSBill Paul
445778c7b1cSBill Paulgroup.byname: $(GROUP)
446778c7b1cSBill Paul	@echo "Updating $@..."
447b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
448778c7b1cSBill Paul	$(CAT) $(GROUP) | \
449778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
450b2264be8SBill Paul		| $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP)
451b2264be8SBill Paul	@$(MV) $(TMP) $@
452b2264be8SBill Paul	@$(DBLOAD) -c
453778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
454778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
455778c7b1cSBill Paul
456778c7b1cSBill Paul
457778c7b1cSBill Paulgroup.bygid: $(GROUP)
458778c7b1cSBill Paul	@echo "Updating $@..."
459b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
460778c7b1cSBill Paul	$(CAT) $(GROUP) | \
461778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
462b2264be8SBill Paul		| $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP)
463b2264be8SBill Paul	@$(MV) $(TMP) $@
464b2264be8SBill Paul	@$(DBLOAD) -c
465778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
466778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
467778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
468778c7b1cSBill Paul
469778c7b1cSBill Paul
470778c7b1cSBill Paulnetid.byname: $(GROUP) $(PASSWD)
471778c7b1cSBill Paul	@echo "Updating $@..."
472b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
4731fe3e67aSBill Paul	@$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \
4741fe3e67aSBill Paul		-d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP)
475b2264be8SBill Paul	@$(MV) $(TMP) $@
476b2264be8SBill Paul	@$(DBLOAD) -c
477778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
478778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
479778c7b1cSBill Paul
480778c7b1cSBill Paul
481778c7b1cSBill Paulmaster.passwd.byname: $(MASTER)
482778c7b1cSBill Paul	@echo "Updating $@..."
483b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
484778c7b1cSBill Paul	$(CAT) $(MASTER) | \
485778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
486b2264be8SBill Paul		| $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP)
487b2264be8SBill Paul	@$(MV) $(TMP) $@
488b2264be8SBill Paul	@$(DBLOAD) -c
489778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
490778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
491778c7b1cSBill Paul
492778c7b1cSBill Paul
493778c7b1cSBill Paulmaster.passwd.byuid: $(MASTER)
494778c7b1cSBill Paul	@echo "Updating $@..."
495b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
496778c7b1cSBill Paul	$(CAT) $(MASTER) | \
497778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
498b2264be8SBill Paul		| $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP)
499b2264be8SBill Paul	@$(MV) $(TMP) $@
500b2264be8SBill Paul	@$(DBLOAD) -c
501778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
502778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
50357948c0bSPeter Wemm
50457948c0bSPeter Wemmamd.host: $(AMDHOST)
50557948c0bSPeter Wemm	@echo "Updating $@..."
50657948c0bSPeter Wemm	@echo $@.$$$$ > $(NFILE)
50757948c0bSPeter Wemm	$(CAT) $(AMDHOST) | \
50857948c0bSPeter Wemm	$(AWK) '$$1 !~ "#"  { \
50957948c0bSPeter Wemm	  for (i = 1; i <= NF; i++) \
51057948c0bSPeter Wemm	  if (i == NF) { \
51157948c0bSPeter Wemm	    if (substr($$i, length($$i), 1) == "\\") \
51257948c0bSPeter Wemm	      printf("%s", substr($$i, 1, length($$i) - 1)); \
51357948c0bSPeter Wemm	    else \
51457948c0bSPeter Wemm	      printf("%s\n", $$i); \
51557948c0bSPeter Wemm	  } \
51657948c0bSPeter Wemm	  else \
51757948c0bSPeter Wemm	    printf("%s ", $$i); \
51857948c0bSPeter Wemm	}' | \
51957948c0bSPeter Wemm	$(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP)
52057948c0bSPeter Wemm	@$(MV) $(TMP) $@
52157948c0bSPeter Wemm	@$(DBLOAD) -c
52257948c0bSPeter Wemm	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
52357948c0bSPeter Wemm	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
52457948c0bSPeter Wemm
525