xref: /freebsd/usr.sbin/ypserv/Makefile.yp (revision b2264be812244e197925dcdce14cd1b394118ae5)
1778c7b1cSBill Paul#
2778c7b1cSBill Paul# Makefile for the NIS databases
3778c7b1cSBill Paul#
4b2264be8SBill Paul# $Id: Makefile.yp,v 1.2 1996/04/13 21:17:57 wpaul Exp wpaul $
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)
42b2264be8SBill PaulSED = /usr/bin/sed
43778c7b1cSBill Paul
44778c7b1cSBill PaulDBLOAD = /usr/sbin/yp_mkdb -m `hostname`
45778c7b1cSBill PaulMKNETID = /usr/libexec/mknetid
46b2264be8SBill PaulMKALIASES = /usr/libexec/mkaliases
47b2264be8SBill PaulNEWALIASES = /usr/bin/newaliases
481fff226dSBill PaulYPPUSH = /usr/sbin/yppush
49920491cfSBill Paul.if !defined(UPDATE_DOMAIN)
50778c7b1cSBill PaulDOMAIN = `/bin/domainname`
51920491cfSBill Paul.else
52920491cfSBill PaulDOMAIN = $(UPDATE_DOMAIN)
53920491cfSBill Paul.endif
54778c7b1cSBill PaulREVNETGROUP = /usr/libexec/revnetgroup
55b2264be8SBill PaulNFILE = /tmp/ypmake
56b2264be8SBill PaulTMP = `$(RCAT) $(NFILE)`
57778c7b1cSBill Paul
58b2264be8SBill Paul# It is advisable to create a seperate directory to contain the
59b2264be8SBill Paul# source files used to generate your NIS maps. If you intent to
60b2264be8SBill Paul# support multiple domains, something like /src/dir/$DOMAIN
61b2264be8SBill Paul# would work well.
62778c7b1cSBill PaulYPSRCDIR = /etc
63778c7b1cSBill PaulYPDIR = /var/yp
64778c7b1cSBill PaulYPMAPDIR = $(YPDIR)/$(DOMAIN)
65778c7b1cSBill Paul
66778c7b1cSBill Paul# These are the files from which the NIS databases are built. You may edit
67778c7b1cSBill Paul# these to taste in the event that you wish to keep your NIS source files
68778c7b1cSBill Paul# seperate from your NIS server's actual configuration files. Note that the
69778c7b1cSBill Paul# NIS passwd and master.passwd files are stored in /var/yp: the server's
70778c7b1cSBill Paul# real password database is not used by default. However, you may use
71778c7b1cSBill Paul# the real /etc/passwd and /etc/master.passwd files by:
72778c7b1cSBill Paul#
73778c7b1cSBill Paul#
74778c7b1cSBill Paul# - invoking yppasswdd without the -m option (yppasswdd will use
75778c7b1cSBill Paul#   /etc/master.passwd if no alternate master.passwd file is specified
76778c7b1cSBill Paul#   and do a 'pwd_mkdb' as needed).
77778c7b1cSBill Paul# - Specifying the location of the master.passwd file using the
78778c7b1cSBill Paul#   MASTER_PASSWD variable, i.e.:
79778c7b1cSBill Paul#
80778c7b1cSBill Paul#   # make MASTER_PASSWD=/path/to/some/other/master.passwd
81778c7b1cSBill Paul#
82778c7b1cSBill Paul# - (optionally): editing this Makefile to change the default location.
83778c7b1cSBill Paul#
84778c7b1cSBill Paul# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw
85778c7b1cSBill Paul# passwd file will be generated from the master.passwd file automagically.
86778c7b1cSBill Paul#
87778c7b1cSBill PaulETHERS    = $(YPSRCDIR)/ethers	   # ethernet addresses (for rarpd)
88778c7b1cSBill PaulBOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd)
89778c7b1cSBill PaulHOSTS     = $(YPSRCDIR)/hosts
90778c7b1cSBill PaulNETWORKS  = $(YPSRCDIR)/networks
91778c7b1cSBill PaulPROTOCOLS = $(YPSRCDIR)/protocols
92778c7b1cSBill PaulRPC 	  = $(YPSRCDIR)/rpc
93778c7b1cSBill PaulSERVICES  = $(YPSRCDIR)/services
94778c7b1cSBill PaulGROUP     = $(YPSRCDIR)/group
95b2264be8SBill PaulALIASES   = $(YPSRCDIR)/aliases
96b2264be8SBill PaulNETGROUP  = $(YPDIR)/netgroup
97778c7b1cSBill PaulPASSWD    = $(YPDIR)/passwd
98778c7b1cSBill Paul.if !defined(MASTER_PASSWD)
99778c7b1cSBill PaulMASTER    = $(YPDIR)/master.passwd
100778c7b1cSBill Paul.else
101778c7b1cSBill PaulMASTER	  = $(MASTER_PASSWD)
102778c7b1cSBill Paul.endif
103778c7b1cSBill PaulYPSERVERS = $(YPDIR)/ypservers	# List of all NIS servers for a domain
104778c7b1cSBill PaulPUBLICKEY = $(YPSRCDIR)/publickey
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 \
120b2264be8SBill Paul      services servers netid # aliases publickey netgroup 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
139b2264be8SBill Paulmail.aliases: $(ALIASES)
140b2264be8SBill Paul	@echo "Updating $@..."
141b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
142b2264be8SBill Paul	$(CAT) $(ALIASES) | \
143b2264be8SBill Paul	$(SED) -e "/^#/d" -e s/#.*$$// -e "/^ *$$/d" |\
144b2264be8SBill Paul	$(MKALIASES) \
145b2264be8SBill Paul		| $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP)
146b2264be8SBill Paul	@$(MV) $(TMP) $@
147b2264be8SBill Paul	@$(DBLOAD) -c
148b2264be8SBill Paul	@$(NEWALIASES)
149b2264be8SBill Paul        @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
150b2264be8SBill Paul        @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
151b2264be8SBill Paul
152778c7b1cSBill Paul
153778c7b1cSBill Paulypservers: $(YPSERVERS)
154778c7b1cSBill Paul	@echo "Updating $@..."
155b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
156778c7b1cSBill Paul	$(CAT) $(YPSERVERS) | \
157778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#") print $$0"\t"$$0 }' $^ \
158b2264be8SBill Paul		| $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP)
159b2264be8SBill Paul	@$(MV) $(TMP) $@
160b2264be8SBill Paul	@$(DBLOAD) -c
161778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
162778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
163778c7b1cSBill Paul
164b2264be8SBill Paul
165778c7b1cSBill Paulethers.byname: $(ETHERS)
166778c7b1cSBill Paul	@echo "Updating $@..."
167b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
168778c7b1cSBill Paul	$(CAT) $(ETHERS) | \
169778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
170778c7b1cSBill Paul		print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \
171b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
172b2264be8SBill Paul	@$(MV) $(TMP) $@
173b2264be8SBill Paul	@$(DBLOAD) -c
174778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) -i $(ETHERS) $@; fi
175778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
176778c7b1cSBill Paul
177778c7b1cSBill Paul
178778c7b1cSBill Paulethers.byaddr: $(ETHERS)
179778c7b1cSBill Paul	@echo "Updating $@..."
180b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
181778c7b1cSBill Paul	$(CAT) $(ETHERS) | \
182778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
183778c7b1cSBill Paul		print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \
184b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
185b2264be8SBill Paul	@$(MV) $(TMP) $@
186b2264be8SBill Paul	@$(DBLOAD) -c
187778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
188778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
189778c7b1cSBill Paul
190778c7b1cSBill Paul
191778c7b1cSBill Paulbootparams: $(BOOTPARAMS)
192778c7b1cSBill Paul	@echo "Updating $@..."
193b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
194778c7b1cSBill Paul	$(CAT) $(BOOTPARAMS) | \
195778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
196778c7b1cSBill Paul		print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \
197b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
198b2264be8SBill Paul	@$(MV) $(TMP) $@
199b2264be8SBill Paul	@$(DBLOAD) -c
200778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
201778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
202778c7b1cSBill Paul
203778c7b1cSBill Paul
204778c7b1cSBill Paulnetgroup: $(NETGROUP) netgroup.byhost netgroup.byuser
205778c7b1cSBill Paul	@echo "Updating $@..."
206b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
207778c7b1cSBill Paul	$(CAT) $(NETGROUP) | \
208778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
209778c7b1cSBill Paul		print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
210b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
211b2264be8SBill Paul	@$(MV) $(TMP) $@
212b2264be8SBill Paul	@$(DBLOAD) -c
213778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
214778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
215778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
216778c7b1cSBill Paul
217778c7b1cSBill Paul
218778c7b1cSBill Paulnetgroup.byhost: $(NETGROUP)
219778c7b1cSBill Paul	@echo "Updating $@..."
220b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
221778c7b1cSBill Paul	$(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \
222778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
223778c7b1cSBill Paul		print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
224b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
225b2264be8SBill Paul	@$(MV) $(TMP) $@
226b2264be8SBill Paul	@$(DBLOAD) -c
227778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
228778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
229778c7b1cSBill Paul
230778c7b1cSBill Paul
231778c7b1cSBill Paulnetgroup.byuser: $(NETGROUP)
232778c7b1cSBill Paul	@echo "Updating $@..."
233b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
234778c7b1cSBill Paul	$(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \
235778c7b1cSBill Paul	$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
236778c7b1cSBill Paul		print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
237b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
238b2264be8SBill Paul	@$(MV) $(TMP) $@
239b2264be8SBill Paul	@$(DBLOAD) -c
240778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
241778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
242778c7b1cSBill Paul
243778c7b1cSBill Paul
244778c7b1cSBill Paulhosts.byname: $(HOSTS)
245778c7b1cSBill Paul	@echo "Updating $@..."
246b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
247778c7b1cSBill Paul	$(CAT) $(HOSTS) | \
248778c7b1cSBill Paul	$(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "#"; n++) \
249778c7b1cSBill Paul		print $$n"\t"$$0 }' $^ | $(DBLOAD) -i $(HOSTS)  \
250b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
251b2264be8SBill Paul	@$(MV) $(TMP) $@
252b2264be8SBill Paul	@$(DBLOAD) -c
253778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
254778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
255778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
256778c7b1cSBill Paul
257b2264be8SBill Paul
258778c7b1cSBill Paulhosts.byaddr: $(HOSTS)
259778c7b1cSBill Paul	@echo "Updating $@..."
260b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
261778c7b1cSBill Paul	$(CAT) $(HOSTS) | \
262778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$1"\t"$$0 }' $^ \
263b2264be8SBill Paul		| $(DBLOAD) -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP)
264b2264be8SBill Paul	@$(MV) $(TMP) $@
265b2264be8SBill Paul	@$(DBLOAD) -c
266778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
267778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
268778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
269778c7b1cSBill Paul
270778c7b1cSBill Paul
271778c7b1cSBill Paulnetworks.byname: $(NETWORKS)
272778c7b1cSBill Paul	@echo "Updating $@..."
273b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
274778c7b1cSBill Paul	$(CAT) $(NETWORKS) | \
275778c7b1cSBill Paul	$(AWK) \
276778c7b1cSBill Paul	   '$$1 !~ "#"  { print $$1"\t"$$0; \
277778c7b1cSBill Paul			  for (n=3; n<=NF && $$n !~ "#"; n++) \
278778c7b1cSBill Paul			      print $$n"\t"$$0 \
279b2264be8SBill Paul		}' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP)
280b2264be8SBill Paul	@$(MV) $(TMP) $@
281b2264be8SBill Paul	@$(DBLOAD) -c
282778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
283778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
284778c7b1cSBill Paul
285778c7b1cSBill Paul
286778c7b1cSBill Paulnetworks.byaddr: $(NETWORKS)
287778c7b1cSBill Paul	@echo "Updating $@..."
288b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
289778c7b1cSBill Paul	$(CAT) $(NETWORKS) | \
290778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$2"\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 Paulprotocols.byname: $(PROTOCOLS)
299778c7b1cSBill Paul	@echo "Updating $@..."
300b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
301778c7b1cSBill Paul	$(CAT) $(PROTOCOLS) | \
302778c7b1cSBill Paul	$(AWK) \
303778c7b1cSBill Paul	   '$$1 !~ "#"	{ print $$1"\t"$$0; \
304778c7b1cSBill Paul			  for (n=3; n<=NF && $$n !~ "#"; n++) \
305778c7b1cSBill Paul			      print $$n"\t"$$0 \
306778c7b1cSBill Paul			}' $^ | $(DBLOAD) -i $(PROTOCOLS) \
307b2264be8SBill Paul						-o $(YPMAPDIR)/$@ - $(TMP)
308b2264be8SBill Paul	@$(MV) $(TMP) $@
309b2264be8SBill Paul	@$(DBLOAD) -c
310778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
311778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
312778c7b1cSBill Paul
313778c7b1cSBill Paul
314778c7b1cSBill Paulprotocols.bynumber: $(PROTOCOLS)
315778c7b1cSBill Paul	@echo "Updating $@..."
316b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
317778c7b1cSBill Paul	$(CAT) $(PROTOCOLS) | \
318778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \
319b2264be8SBill Paul		| $(DBLOAD) -i $(PROTOCOLS) -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 Paulrpc.byname: $(RPC)
327778c7b1cSBill Paul	@echo "Updating $@..."
328b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
329778c7b1cSBill Paul	$(CAT) $(RPC) | \
330778c7b1cSBill Paul	$(AWK) \
331778c7b1cSBill Paul	   '$$1 !~ "#"  { print $$1"\t"$$0; \
332778c7b1cSBill Paul			  for (n=3; n<=NF && $$n !~ "#"; n++) \
333778c7b1cSBill Paul			      print $$n"\t"$$0 \
334b2264be8SBill Paul		}' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP)
335b2264be8SBill Paul	@$(MV) $(TMP) $@
336b2264be8SBill Paul	@$(DBLOAD) -c
337778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
338778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
339778c7b1cSBill Paul
340778c7b1cSBill Paul
341778c7b1cSBill Paulrpc.bynumber: $(RPC)
342778c7b1cSBill Paul	@echo "Updating $@..."
343b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
344778c7b1cSBill Paul	$(CAT) $(RPC) | \
345778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$2"\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 Paulservices.byname: $(SERVICES)
354778c7b1cSBill Paul	@echo "Updating $@..."
355b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
356778c7b1cSBill Paul	$(CAT) $(SERVICES) | \
357778c7b1cSBill Paul	$(AWK) \
358778c7b1cSBill Paul	   '$$1 !~ "#"  { if (index($$2,"udp")) { printf("%s/udp",$$1) } \
359778c7b1cSBill Paul			  else { printf("%s/tcp",$$1) }; print "\t"$$0 \
360b2264be8SBill Paul		}' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP)
361b2264be8SBill Paul	@$(MV) $(TMP) $@
362b2264be8SBill Paul	@$(DBLOAD) -c
363778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
364778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
365778c7b1cSBill Paul
366778c7b1cSBill Paul
367778c7b1cSBill Paulpublickey.byname: $(PUBLICKEY)
368778c7b1cSBill Paul	@echo "Updating $@..."
369b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
370b2264be8SBill Paul	$(TMP) = `$(RCAT) $(NFILE)`
371778c7b1cSBill Paul	$(AWK) '$$1 !~ "#" { print $$1"\t"$$2 }' $^ \
372b2264be8SBill Paul		| $(DBLOAD)  -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP)
373b2264be8SBill Paul	@$(MV) $(TMP) $@
374b2264be8SBill Paul	@$(DBLOAD) -c
375778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
376778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
377778c7b1cSBill Paul
378778c7b1cSBill Paul
379778c7b1cSBill Paul$(PASSWD): $(MASTER)
380778c7b1cSBill Paul	@echo "Creating new $@ file from $(MASTER)..."
381778c7b1cSBill Paul	@if [ ! $(UNSECURE) ]; then \
382778c7b1cSBill Paul	$(RCAT) $(MASTER) | \
383778c7b1cSBill Paul	$(AWK) -F: '{if ($$1 != "+") \
384778c7b1cSBill Paul		print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
385778c7b1cSBill Paul		> $(PASSWD) ; \
386778c7b1cSBill Paul	else $(RCAT) $(MASTER) | \
387778c7b1cSBill Paul	$(AWK) -F: '{if ($$1 != "+") \
388778c7b1cSBill Paul		print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
389778c7b1cSBill Paul		> $(PASSWD) ; fi
390778c7b1cSBill Paul
391778c7b1cSBill Paul
392778c7b1cSBill Paulpasswd.byname: $(PASSWD)
393778c7b1cSBill Paul	@echo "Updating $@..."
394b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
395778c7b1cSBill Paul	$(CAT) $(PASSWD) | \
396778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
397b2264be8SBill Paul		| $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP)
398b2264be8SBill Paul	@$(MV) $(TMP) $@
399b2264be8SBill Paul	@$(DBLOAD) -c
400778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
401778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
402778c7b1cSBill Paul
403b2264be8SBill Paul
404778c7b1cSBill Paulpasswd.byuid: $(PASSWD)
405778c7b1cSBill Paul	@echo "Updating $@..."
406b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
407778c7b1cSBill Paul	$(CAT) $(PASSWD) | \
408778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
409b2264be8SBill Paul		| $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP)
410b2264be8SBill Paul	@$(MV) $(TMP) $@
411b2264be8SBill Paul	@$(DBLOAD) -c
412778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
413778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
414778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
415778c7b1cSBill Paul
416778c7b1cSBill Paul
417778c7b1cSBill Paulgroup.byname: $(GROUP)
418778c7b1cSBill Paul	@echo "Updating $@..."
419b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
420778c7b1cSBill Paul	$(CAT) $(GROUP) | \
421778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
422b2264be8SBill Paul		| $(DBLOAD) -i $(GROUP) -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
428778c7b1cSBill Paul
429778c7b1cSBill Paulgroup.bygid: $(GROUP)
430778c7b1cSBill Paul	@echo "Updating $@..."
431b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
432778c7b1cSBill Paul	$(CAT) $(GROUP) | \
433778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
434b2264be8SBill Paul		| $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP)
435b2264be8SBill Paul	@$(MV) $(TMP) $@
436b2264be8SBill Paul	@$(DBLOAD) -c
437778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
438778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
439778c7b1cSBill Paul	@$(MAKE) -f ../Makefile netid
440778c7b1cSBill Paul
441778c7b1cSBill Paul
442778c7b1cSBill Paulnetid.byname: $(GROUP) $(PASSWD)
443778c7b1cSBill Paul	@echo "Updating $@..."
444b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
445778c7b1cSBill Paul	@$(MKNETID) $(PASSWD) $(GROUP) `basename \`pwd\`` \
446b2264be8SBill Paul		| $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP)
447b2264be8SBill Paul	@$(MV) $(TMP) $@
448b2264be8SBill Paul	@$(DBLOAD) -c
449778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
450778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
451778c7b1cSBill Paul
452778c7b1cSBill Paul
453778c7b1cSBill Paulmaster.passwd.byname: $(MASTER)
454778c7b1cSBill Paul	@echo "Updating $@..."
455b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
456778c7b1cSBill Paul	$(CAT) $(MASTER) | \
457778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \
458b2264be8SBill Paul		| $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP)
459b2264be8SBill Paul	@$(MV) $(TMP) $@
460b2264be8SBill Paul	@$(DBLOAD) -c
461778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
462778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
463778c7b1cSBill Paul
464778c7b1cSBill Paul
465778c7b1cSBill Paulmaster.passwd.byuid: $(MASTER)
466778c7b1cSBill Paul	@echo "Updating $@..."
467b2264be8SBill Paul	@echo $@.$$$$ > $(NFILE)
468778c7b1cSBill Paul	$(CAT) $(MASTER) | \
469778c7b1cSBill Paul	$(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \
470b2264be8SBill Paul		| $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP)
471b2264be8SBill Paul	@$(MV) $(TMP) $@
472b2264be8SBill Paul	@$(DBLOAD) -c
473778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
474778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
475