xref: /freebsd/usr.sbin/ypserv/Makefile.yp (revision de88f1607c62bbc0b40586c3f5dce383c88b2049)
1778c7b1cSBill Paul#
2778c7b1cSBill Paul# Makefile for the NIS databases
3778c7b1cSBill Paul#
4de88f160SAdam David# $Id: Makefile.yp,v 1.7 1996/06/25 20:28:01 wpaul 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
32778c7b1cSBill Paul# These are commands which this Makefile needs to properly rebuild the
33778c7b1cSBill Paul# NIS databases. Don't change these unless you have a good reason. Also
34778c7b1cSBill Paul# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary
35778c7b1cSBill Paul# and it'll break everything in sight.
36778c7b1cSBill Paul#
37778c7b1cSBill PaulAWK = /usr/bin/awk
38778c7b1cSBill PaulRM  = @/bin/rm -f
39b2264be8SBill PaulMV  = @/bin/mv -f
40778c7b1cSBill PaulRCAT = /bin/cat
41778c7b1cSBill PaulCAT = @$(RCAT)
42778c7b1cSBill Paul
43de88f160SAdam DavidMKDB = /usr/sbin/yp_mkdb
44de88f160SAdam DavidDBLOAD = $(MKDB) -m `hostname`
45778c7b1cSBill PaulMKNETID = /usr/libexec/mknetid
46b2264be8SBill PaulNEWALIASES = /usr/bin/newaliases
471fff226dSBill PaulYPPUSH = /usr/sbin/yppush
48920491cfSBill Paul.if !defined(UPDATE_DOMAIN)
49778c7b1cSBill PaulDOMAIN = `/bin/domainname`
50920491cfSBill Paul.else
51920491cfSBill PaulDOMAIN = $(UPDATE_DOMAIN)
52920491cfSBill Paul.endif
53778c7b1cSBill PaulREVNETGROUP = /usr/libexec/revnetgroup
54b2264be8SBill PaulNFILE = /tmp/ypmake
55b2264be8SBill PaulTMP = `$(RCAT) $(NFILE)`
56778c7b1cSBill Paul
57de88f160SAdam David# It is advisable to create a separate directory to contain the
58de88f160SAdam David# source files used to generate your NIS maps. If you intend to
59b2264be8SBill Paul# support multiple domains, something like /src/dir/$DOMAIN
60b2264be8SBill Paul# would work well.
61778c7b1cSBill PaulYPSRCDIR = /etc
62778c7b1cSBill PaulYPDIR = /var/yp
63778c7b1cSBill PaulYPMAPDIR = $(YPDIR)/$(DOMAIN)
64778c7b1cSBill Paul
65778c7b1cSBill Paul# These are the files from which the NIS databases are built. You may edit
66778c7b1cSBill Paul# these to taste in the event that you wish to keep your NIS source files
67778c7b1cSBill Paul# seperate from your NIS server's actual configuration files. Note that the
68778c7b1cSBill Paul# NIS passwd and master.passwd files are stored in /var/yp: the server's
69778c7b1cSBill Paul# real password database is not used by default. However, you may use
70778c7b1cSBill Paul# the real /etc/passwd and /etc/master.passwd files by:
71778c7b1cSBill Paul#
72778c7b1cSBill Paul#
73778c7b1cSBill Paul# - invoking yppasswdd without the -m option (yppasswdd will use
74778c7b1cSBill Paul#   /etc/master.passwd if no alternate master.passwd file is specified
75778c7b1cSBill Paul#   and do a 'pwd_mkdb' as needed).
76778c7b1cSBill Paul# - Specifying the location of the master.passwd file using the
77778c7b1cSBill Paul#   MASTER_PASSWD variable, i.e.:
78778c7b1cSBill Paul#
79778c7b1cSBill Paul#   # make MASTER_PASSWD=/path/to/some/other/master.passwd
80778c7b1cSBill Paul#
81778c7b1cSBill Paul# - (optionally): editing this Makefile to change the default location.
82778c7b1cSBill Paul#
83778c7b1cSBill Paul# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw
84778c7b1cSBill Paul# passwd file will be generated from the master.passwd file automagically.
85778c7b1cSBill Paul#
86778c7b1cSBill PaulETHERS    = $(YPSRCDIR)/ethers	   # ethernet addresses (for rarpd)
87778c7b1cSBill PaulBOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd)
88778c7b1cSBill PaulHOSTS     = $(YPSRCDIR)/hosts
89778c7b1cSBill PaulNETWORKS  = $(YPSRCDIR)/networks
90778c7b1cSBill PaulPROTOCOLS = $(YPSRCDIR)/protocols
91778c7b1cSBill PaulRPC 	  = $(YPSRCDIR)/rpc
92778c7b1cSBill PaulSERVICES  = $(YPSRCDIR)/services
93778c7b1cSBill PaulGROUP     = $(YPSRCDIR)/group
94b2264be8SBill PaulALIASES   = $(YPSRCDIR)/aliases
95b2264be8SBill PaulNETGROUP  = $(YPDIR)/netgroup
96778c7b1cSBill PaulPASSWD    = $(YPDIR)/passwd
97778c7b1cSBill Paul.if !defined(MASTER_PASSWD)
98778c7b1cSBill PaulMASTER    = $(YPDIR)/master.passwd
99778c7b1cSBill Paul.else
100778c7b1cSBill PaulMASTER	  = $(MASTER_PASSWD)
101778c7b1cSBill Paul.endif
102778c7b1cSBill PaulYPSERVERS = $(YPDIR)/ypservers	# List of all NIS servers for a domain
103778c7b1cSBill PaulPUBLICKEY = $(YPSRCDIR)/publickey
1041fe3e67aSBill PaulNETID     = $(YPSRCDIR)/netid
105778c7b1cSBill Paul
106778c7b1cSBill Paultarget:
107b2264be8SBill Paul	@$(RM) $(NFILE)
108778c7b1cSBill Paul	@if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \
109920491cfSBill Paul	cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \
110778c7b1cSBill Paul	make -f ../Makefile all; echo "NIS Map update completed."
111778c7b1cSBill Paul
112778c7b1cSBill Paul# If you don't want some of these maps built, feel free to comment
113778c7b1cSBill Paul# them out from this list.
114778c7b1cSBill Paul# Note that we don't build the ethers or boorparams maps by default
115778c7b1cSBill Paul# since /etc/ethers and /etc/bootparams are not likely to be present
116778c7b1cSBill Paul# on all systems.
117778c7b1cSBill Paul#
118778c7b1cSBill Paul
119b2264be8SBill Paulall:  master.passwd passwd hosts group networks protocols rpc \
120de88f160SAdam David      services servers netid # aliases publickey netgrp ethers bootparam
121778c7b1cSBill Paul
122778c7b1cSBill Paulethers:	   ethers.byname ethers.byaddr
123778c7b1cSBill Paulbootparam: bootparams
124778c7b1cSBill Paulhosts:	   hosts.byname hosts.byaddr
125778c7b1cSBill Paulnetworks:  networks.byaddr networks.byname
126778c7b1cSBill Paulprotocols: protocols.bynumber protocols.byname
127778c7b1cSBill Paulrpc:	   rpc.byname rpc.bynumber
128778c7b1cSBill Paulservices:  services.byname
129778c7b1cSBill Paulpasswd:    passwd.byname passwd.byuid
130778c7b1cSBill Paulgroup:     group.byname group.bygid
131778c7b1cSBill Paulnetgrp:    netgroup
132778c7b1cSBill Paulnetid:	   netid.byname
133778c7b1cSBill Paulservers:   ypservers
134778c7b1cSBill Paulpublickey: publickey.byname
135b2264be8SBill Paulaliases:   mail.aliases
136778c7b1cSBill Paul
137778c7b1cSBill Paulmaster.passwd:	master.passwd.byname master.passwd.byuid
138778c7b1cSBill Paul
139b3e93234SBill Paul#
140b3e93234SBill Paul# This is a special target used only when doing in-place updates with
141b3e93234SBill Paul# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd
142b3e93234SBill Paul# server and won't need to be remade. They will have to be pushed to the
143b3e93234SBill Paul# slaves however. Calling this target implicitly insures that this will
144b3e93234SBill Paul# happen.
145b3e93234SBill Paul#
146b3e93234SBill Paulpushpw:
147b3e93234SBill Paul	@$(DBLOAD) -c
148b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi
149b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi
150b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi
151b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi
152b3e93234SBill Paul
153b2264be8SBill Paulmail.aliases: $(ALIASES)
154b2264be8SBill Paul	@echo "Updating $@..."
155b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
156de88f160SAdam David	@$(NEWALIASES) -oA$(ALIASES)
157de88f160SAdam David	$(MKDB) -u $(ALIASES).db \
158b2264be8SBill Paul		| $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP)
159b2264be8SBill Paul	@$(MV) $(TMP) $@
160b2264be8SBill Paul	@$(DBLOAD) -c
161b2264be8SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
162b2264be8SBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
163b2264be8SBill Paul
164778c7b1cSBill Paul
165778c7b1cSBill Paulypservers: $(YPSERVERS)
166778c7b1cSBill Paul	@echo "Updating $@..."
167b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
168778c7b1cSBill Paul	$(CAT) $(YPSERVERS) | \
169778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#") print $$0"\t"$$0 }' $^ \
170b2264be8SBill Paul		| $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP)
171b2264be8SBill Paul	@$(MV) $(TMP) $@
172b2264be8SBill Paul	@$(DBLOAD) -c
173778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
174778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
175778c7b1cSBill Paul
176b2264be8SBill Paul
177778c7b1cSBill Paulethers.byname: $(ETHERS)
178778c7b1cSBill Paul	@echo "Updating $@..."
179b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
180778c7b1cSBill Paul	$(CAT) $(ETHERS) | \
181778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
182778c7b1cSBill Paul		print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \
183b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
184b2264be8SBill Paul	@$(MV) $(TMP) $@
185b2264be8SBill Paul	@$(DBLOAD) -c
186778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) -i $(ETHERS) $@; fi
187778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
188778c7b1cSBill Paul
189778c7b1cSBill Paul
190778c7b1cSBill Paulethers.byaddr: $(ETHERS)
191778c7b1cSBill Paul	@echo "Updating $@..."
192b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
193778c7b1cSBill Paul	$(CAT) $(ETHERS) | \
194778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
195778c7b1cSBill Paul		print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \
196b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
197b2264be8SBill Paul	@$(MV) $(TMP) $@
198b2264be8SBill Paul	@$(DBLOAD) -c
199778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
200778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
201778c7b1cSBill Paul
202778c7b1cSBill Paul
203778c7b1cSBill Paulbootparams: $(BOOTPARAMS)
204778c7b1cSBill Paul	@echo "Updating $@..."
205b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
206778c7b1cSBill Paul	$(CAT) $(BOOTPARAMS) | \
207778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
208778c7b1cSBill Paul		print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \
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 Paulnetgroup: $(NETGROUP) netgroup.byhost netgroup.byuser
217778c7b1cSBill Paul	@echo "Updating $@..."
218b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
219778c7b1cSBill Paul	$(CAT) $(NETGROUP) | \
220778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
221778c7b1cSBill Paul		print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
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	@$(MAKE) -f ../Makefile netid
228778c7b1cSBill Paul
229778c7b1cSBill Paul
230778c7b1cSBill Paulnetgroup.byhost: $(NETGROUP)
231778c7b1cSBill Paul	@echo "Updating $@..."
232b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
233778c7b1cSBill Paul	$(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \
234778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
235778c7b1cSBill Paul		print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
236b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
237b2264be8SBill Paul	@$(MV) $(TMP) $@
238b2264be8SBill Paul	@$(DBLOAD) -c
239778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
240778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
241778c7b1cSBill Paul
242778c7b1cSBill Paul
243778c7b1cSBill Paulnetgroup.byuser: $(NETGROUP)
244778c7b1cSBill Paul	@echo "Updating $@..."
245b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
246778c7b1cSBill Paul	$(CAT) $(NETGROUP) | $(REVNETGROUP) -u -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 Paulhosts.byname: $(HOSTS)
257778c7b1cSBill Paul	@echo "Updating $@..."
258b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
259778c7b1cSBill Paul	$(CAT) $(HOSTS) | \
260778c7b1cSBill Paul	$(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "#"; n++) \
261778c7b1cSBill Paul		print $$n"\t"$$0 }' $^ | $(DBLOAD) -i $(HOSTS)  \
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	@$(MAKE) -f ../Makefile netid
268778c7b1cSBill Paul
269b2264be8SBill Paul
270778c7b1cSBill Paulhosts.byaddr: $(HOSTS)
271778c7b1cSBill Paul	@echo "Updating $@..."
272b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
273778c7b1cSBill Paul	$(CAT) $(HOSTS) | \
274778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$1"\t"$$0 }' $^ \
275b2264be8SBill Paul		| $(DBLOAD) -i $(HOSTS) -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
282778c7b1cSBill Paul
283778c7b1cSBill Paulnetworks.byname: $(NETWORKS)
284778c7b1cSBill Paul	@echo "Updating $@..."
285b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
286778c7b1cSBill Paul	$(CAT) $(NETWORKS) | \
287778c7b1cSBill Paul	$(AWK) \
288778c7b1cSBill Paul	   '$$1 !~ "#"  { print $$1"\t"$$0; \
289778c7b1cSBill Paul			  for (n=3; n<=NF && $$n !~ "#"; n++) \
290778c7b1cSBill Paul			      print $$n"\t"$$0 \
291b2264be8SBill Paul		}' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP)
292b2264be8SBill Paul	@$(MV) $(TMP) $@
293b2264be8SBill Paul	@$(DBLOAD) -c
294778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
295778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
296778c7b1cSBill Paul
297778c7b1cSBill Paul
298778c7b1cSBill Paulnetworks.byaddr: $(NETWORKS)
299778c7b1cSBill Paul	@echo "Updating $@..."
300b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
301778c7b1cSBill Paul	$(CAT) $(NETWORKS) | \
302778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \
303b2264be8SBill Paul		| $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP)
304b2264be8SBill Paul	@$(MV) $(TMP) $@
305b2264be8SBill Paul	@$(DBLOAD) -c
306778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
307778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
308778c7b1cSBill Paul
309778c7b1cSBill Paul
310778c7b1cSBill Paulprotocols.byname: $(PROTOCOLS)
311778c7b1cSBill Paul	@echo "Updating $@..."
312b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
313778c7b1cSBill Paul	$(CAT) $(PROTOCOLS) | \
314778c7b1cSBill Paul	$(AWK) \
315778c7b1cSBill Paul	   '$$1 !~ "#"	{ print $$1"\t"$$0; \
316778c7b1cSBill Paul			  for (n=3; n<=NF && $$n !~ "#"; n++) \
317778c7b1cSBill Paul			      print $$n"\t"$$0 \
318778c7b1cSBill Paul			}' $^ | $(DBLOAD) -i $(PROTOCOLS) \
319b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
320b2264be8SBill Paul	@$(MV) $(TMP) $@
321b2264be8SBill Paul	@$(DBLOAD) -c
322778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
323778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
324778c7b1cSBill Paul
325778c7b1cSBill Paul
326778c7b1cSBill Paulprotocols.bynumber: $(PROTOCOLS)
327778c7b1cSBill Paul	@echo "Updating $@..."
328b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
329778c7b1cSBill Paul	$(CAT) $(PROTOCOLS) | \
330778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \
331b2264be8SBill Paul		| $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP)
332b2264be8SBill Paul	@$(MV) $(TMP) $@
333b2264be8SBill Paul	@$(DBLOAD) -c
334778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
335778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
336778c7b1cSBill Paul
337778c7b1cSBill Paul
338778c7b1cSBill Paulrpc.byname: $(RPC)
339778c7b1cSBill Paul	@echo "Updating $@..."
340b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
341778c7b1cSBill Paul	$(CAT) $(RPC) | \
342778c7b1cSBill Paul	$(AWK) \
343778c7b1cSBill Paul	   '$$1 !~ "#"  { print $$1"\t"$$0; \
344778c7b1cSBill Paul			  for (n=3; n<=NF && $$n !~ "#"; n++) \
345778c7b1cSBill Paul			      print $$n"\t"$$0 \
346b2264be8SBill Paul		}' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP)
347b2264be8SBill Paul	@$(MV) $(TMP) $@
348b2264be8SBill Paul	@$(DBLOAD) -c
349778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
350778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
351778c7b1cSBill Paul
352778c7b1cSBill Paul
353778c7b1cSBill Paulrpc.bynumber: $(RPC)
354778c7b1cSBill Paul	@echo "Updating $@..."
355b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
356778c7b1cSBill Paul	$(CAT) $(RPC) | \
357778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \
358b2264be8SBill Paul		| $(DBLOAD)  -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP)
359b2264be8SBill Paul	@$(MV) $(TMP) $@
360b2264be8SBill Paul	@$(DBLOAD) -c
361778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
362778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
363778c7b1cSBill Paul
364778c7b1cSBill Paul
365778c7b1cSBill Paulservices.byname: $(SERVICES)
366778c7b1cSBill Paul	@echo "Updating $@..."
367b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
368778c7b1cSBill Paul	$(CAT) $(SERVICES) | \
369778c7b1cSBill Paul	$(AWK) \
370778c7b1cSBill Paul	   '$$1 !~ "#"  { if (index($$2,"udp")) { printf("%s/udp",$$1) } \
371b3e93234SBill Paul			  else { printf("%s/tcp",$$1) }; print "\t"$$0 ; \
372b3e93234SBill Paul			  print $$2"\t"$$0 ; \
373b2264be8SBill Paul		}' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP)
374b2264be8SBill Paul	@$(MV) $(TMP) $@
375b2264be8SBill Paul	@$(DBLOAD) -c
376778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
377778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
378778c7b1cSBill Paul
379778c7b1cSBill Paul
380778c7b1cSBill Paulpublickey.byname: $(PUBLICKEY)
381778c7b1cSBill Paul	@echo "Updating $@..."
382b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
383b2264be8SBill Paul	$(TMP) = `$(RCAT) $(NFILE)`
384778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$1"\t"$$2 }' $^ \
385b2264be8SBill Paul		| $(DBLOAD)  -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP)
386b2264be8SBill Paul	@$(MV) $(TMP) $@
387b2264be8SBill Paul	@$(DBLOAD) -c
388778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
389778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
390778c7b1cSBill Paul
391778c7b1cSBill Paul
392778c7b1cSBill Paul$(PASSWD): $(MASTER)
393778c7b1cSBill Paul	@echo "Creating new $@ file from $(MASTER)..."
394778c7b1cSBill Paul	@if [ ! $(UNSECURE) ]; then \
395778c7b1cSBill Paul	$(RCAT) $(MASTER) | \
396778c7b1cSBill Paul	$(AWK) -F: '{if ($$1 != "+") \
397778c7b1cSBill Paul		print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
398778c7b1cSBill Paul		> $(PASSWD) ; \
399778c7b1cSBill Paul	else $(RCAT) $(MASTER) | \
400778c7b1cSBill Paul	$(AWK) -F: '{if ($$1 != "+") \
401778c7b1cSBill Paul		print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
402778c7b1cSBill Paul		> $(PASSWD) ; fi
403778c7b1cSBill Paul
404778c7b1cSBill Paul
405778c7b1cSBill Paulpasswd.byname: $(PASSWD)
406778c7b1cSBill Paul	@echo "Updating $@..."
407b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
408778c7b1cSBill Paul	$(CAT) $(PASSWD) | \
409778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
410b2264be8SBill Paul		| $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP)
411b2264be8SBill Paul	@$(MV) $(TMP) $@
412b2264be8SBill Paul	@$(DBLOAD) -c
413778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
414778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
415778c7b1cSBill Paul
416b2264be8SBill Paul
417778c7b1cSBill Paulpasswd.byuid: $(PASSWD)
418778c7b1cSBill Paul	@echo "Updating $@..."
419b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
420778c7b1cSBill Paul	$(CAT) $(PASSWD) | \
421778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
422b2264be8SBill Paul		| $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP)
423b2264be8SBill Paul	@$(MV) $(TMP) $@
424b2264be8SBill Paul	@$(DBLOAD) -c
425778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
426778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
427778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
428778c7b1cSBill Paul
429778c7b1cSBill Paul
430778c7b1cSBill Paulgroup.byname: $(GROUP)
431778c7b1cSBill Paul	@echo "Updating $@..."
432b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
433778c7b1cSBill Paul	$(CAT) $(GROUP) | \
434778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
435b2264be8SBill Paul		| $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP)
436b2264be8SBill Paul	@$(MV) $(TMP) $@
437b2264be8SBill Paul	@$(DBLOAD) -c
438778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
439778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
440778c7b1cSBill Paul
441778c7b1cSBill Paul
442778c7b1cSBill Paulgroup.bygid: $(GROUP)
443778c7b1cSBill Paul	@echo "Updating $@..."
444b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
445778c7b1cSBill Paul	$(CAT) $(GROUP) | \
446778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
447b2264be8SBill Paul		| $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP)
448b2264be8SBill Paul	@$(MV) $(TMP) $@
449b2264be8SBill Paul	@$(DBLOAD) -c
450778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
451778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
452778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
453778c7b1cSBill Paul
454778c7b1cSBill Paul
455778c7b1cSBill Paulnetid.byname: $(GROUP) $(PASSWD)
456778c7b1cSBill Paul	@echo "Updating $@..."
457b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
4581fe3e67aSBill Paul	@$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \
4591fe3e67aSBill Paul		-d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP)
460b2264be8SBill Paul	@$(MV) $(TMP) $@
461b2264be8SBill Paul	@$(DBLOAD) -c
462778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
463778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
464778c7b1cSBill Paul
465778c7b1cSBill Paul
466778c7b1cSBill Paulmaster.passwd.byname: $(MASTER)
467778c7b1cSBill Paul	@echo "Updating $@..."
468b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
469778c7b1cSBill Paul	$(CAT) $(MASTER) | \
470778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
471b2264be8SBill Paul		| $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP)
472b2264be8SBill Paul	@$(MV) $(TMP) $@
473b2264be8SBill Paul	@$(DBLOAD) -c
474778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
475778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
476778c7b1cSBill Paul
477778c7b1cSBill Paul
478778c7b1cSBill Paulmaster.passwd.byuid: $(MASTER)
479778c7b1cSBill Paul	@echo "Updating $@..."
480b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
481778c7b1cSBill Paul	$(CAT) $(MASTER) | \
482778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
483b2264be8SBill Paul		| $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP)
484b2264be8SBill Paul	@$(MV) $(TMP) $@
485b2264be8SBill Paul	@$(DBLOAD) -c
486778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
487778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
488