xref: /freebsd/usr.sbin/ypserv/Makefile.yp (revision 4ba79bb43371ac99795d37a1b11984fb2aef65b6)
1778c7b1cSBill Paul#
2778c7b1cSBill Paul# Makefile for the NIS databases
3778c7b1cSBill Paul#
497d92980SPeter Wemm# $FreeBSD$
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
1453c40578SBrian Somers# If this machine is an NIS master, reset this variable (NOPUSH=)
1553c40578SBrian Somers# in Makefile.local so that changes to the NIS maps can be propagated to
1653c40578SBrian Somers# the slave servers.  (By default we assume that we are only serving a
1753c40578SBrian Somers# small domain with only one server.)
18778c7b1cSBill Paul#
19778c7b1cSBill PaulNOPUSH = "True"
20778c7b1cSBill Paul
2153c40578SBrian Somers# If this machine does not wish to generate a linux-style shadow map
2253c40578SBrian Somers# from the master.passwd file, reset this variable (SHADOW=) in
2353c40578SBrian Somers# Makefile.local.
2453c40578SBrian SomersSHADOW = "True"
2553c40578SBrian Somers
26778c7b1cSBill Paul# If you want to use a FreeBSD NIS server to serve non-FreeBSD clients
27778c7b1cSBill Paul# (i.e. clients who expect the password field in the passwd maps to be
2853c40578SBrian Somers# valid) then set this variable (UNSECURE="True") in Makefile.local.
2953c40578SBrian Somers# This will cause $YPDIR/passwd to be generated with valid password
3053c40578SBrian Somers# fields.  This is insecure: FreeBSD normally only serves the
3153c40578SBrian Somers# master.passwd and shadow maps (which have real encrypted passwords
3253c40578SBrian Somers# in them) to the superuser on other FreeBSD machines, but non-FreeBSD
3353c40578SBrian Somers# clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX, etc...)
3453c40578SBrian Somers# will only work properly in 'unsecure' mode.
35778c7b1cSBill Paul#
36778c7b1cSBill Paul#UNSECURE = "True"
37778c7b1cSBill Paul
3844519760SBill Paul# The following line encodes the YP_INTERDOMAIN key into the hosts.byname
3944519760SBill Paul# and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve
4053c40578SBrian Somers# hosts not in the current domain.  Resetting this variable in
4153c40578SBrian Somers# Makefile.local (B=) will disable the DNS lookups.
4244519760SBill PaulB=-b
4344519760SBill Paul
4453c40578SBrian Somers# Normally, the master.passwd.* and shadow.* maps are guarded against access
4553c40578SBrian Somers# from non-privileged users.  By resetting S in Makefile.local (S=), the
4653c40578SBrian Somers# YP_SECURE key will be removed from these maps, allowing anyone to access
4753c40578SBrian Somers# them.
4844519760SBill PaulS=-s
4944519760SBill Paul
50778c7b1cSBill Paul# These are commands which this Makefile needs to properly rebuild the
51778c7b1cSBill Paul# NIS databases. Don't change these unless you have a good reason. Also
52778c7b1cSBill Paul# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary
53778c7b1cSBill Paul# and it'll break everything in sight.
54778c7b1cSBill Paul#
55778c7b1cSBill PaulAWK = /usr/bin/awk
56778c7b1cSBill PaulRM  = @/bin/rm -f
57b2264be8SBill PaulMV  = @/bin/mv -f
581754677bSBill PaulRMV  = /bin/mv -f
59778c7b1cSBill Paul
60de88f160SAdam DavidMKDB = /usr/sbin/yp_mkdb
61de88f160SAdam DavidDBLOAD = $(MKDB) -m `hostname`
62778c7b1cSBill PaulMKNETID = /usr/libexec/mknetid
63b2264be8SBill PaulNEWALIASES = /usr/bin/newaliases
641fff226dSBill PaulYPPUSH = /usr/sbin/yppush
65920491cfSBill Paul.if !defined(UPDATE_DOMAIN)
66778c7b1cSBill PaulDOMAIN = `/bin/domainname`
67920491cfSBill Paul.else
68920491cfSBill PaulDOMAIN = $(UPDATE_DOMAIN)
69920491cfSBill Paul.endif
70778c7b1cSBill PaulREVNETGROUP = /usr/libexec/revnetgroup
711754677bSBill PaulTMP = `echo $@.$$$$`
72778c7b1cSBill Paul
73de88f160SAdam David# It is advisable to create a separate directory to contain the
74de88f160SAdam David# source files used to generate your NIS maps. If you intend to
75b2264be8SBill Paul# support multiple domains, something like /src/dir/$DOMAIN
76b2264be8SBill Paul# would work well.
77778c7b1cSBill PaulYPSRCDIR = /etc
7813170f18SBill Paul.if !defined(YP_DIR)
79778c7b1cSBill PaulYPDIR = /var/yp
8013170f18SBill Paul.else
8113170f18SBill PaulYPDIR = $(YP_DIR)
8213170f18SBill Paul.endif
83778c7b1cSBill PaulYPMAPDIR = $(YPDIR)/$(DOMAIN)
84778c7b1cSBill Paul
85778c7b1cSBill Paul# These are the files from which the NIS databases are built. You may edit
86778c7b1cSBill Paul# these to taste in the event that you wish to keep your NIS source files
871a6e52d0SJeroen Ruigrok van der Werven# separate from your NIS server's actual configuration files. Note that the
88778c7b1cSBill Paul# NIS passwd and master.passwd files are stored in /var/yp: the server's
89778c7b1cSBill Paul# real password database is not used by default. However, you may use
90778c7b1cSBill Paul# the real /etc/passwd and /etc/master.passwd files by:
91778c7b1cSBill Paul#
92778c7b1cSBill Paul#
933939bb66SPoul-Henning Kamp# - invoking yppasswdd with `-t /etc/master.passwd' (yppasswdd will do a
943939bb66SPoul-Henning Kamp#   'pwd_mkdb' as needed if /etc/master.passwd is thus specified).
95778c7b1cSBill Paul# - Specifying the location of the master.passwd file using the
96778c7b1cSBill Paul#   MASTER_PASSWD variable, i.e.:
97778c7b1cSBill Paul#
98778c7b1cSBill Paul#   # make MASTER_PASSWD=/path/to/some/other/master.passwd
99778c7b1cSBill Paul#
100778c7b1cSBill Paul# - (optionally): editing this Makefile to change the default location.
101778c7b1cSBill Paul#
102778c7b1cSBill Paul# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw
103778c7b1cSBill Paul# passwd file will be generated from the master.passwd file automagically.
104778c7b1cSBill Paul#
105778c7b1cSBill PaulETHERS    = $(YPSRCDIR)/ethers	   # ethernet addresses (for rarpd)
106fac7bc23SAlan SomersEUI64     = $(YPSRCDIR)/eui64	   # eui64 addresses (for firewire)
107778c7b1cSBill PaulBOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd)
108778c7b1cSBill PaulHOSTS     = $(YPSRCDIR)/hosts
109a89e588cSHajimu UMEMOTOIPNODES   = $(YPDIR)/ipnodes
110778c7b1cSBill PaulNETWORKS  = $(YPSRCDIR)/networks
111778c7b1cSBill PaulPROTOCOLS = $(YPSRCDIR)/protocols
112778c7b1cSBill PaulRPC 	  = $(YPSRCDIR)/rpc
113778c7b1cSBill PaulSERVICES  = $(YPSRCDIR)/services
11480fc33c3SRobert DrehmelSHELLS    = $(YPSRCDIR)/shells
115778c7b1cSBill PaulGROUP     = $(YPSRCDIR)/group
116a00856a8SGregory Neil ShapiroALIASES   = $(YPSRCDIR)/mail/aliases
117b2264be8SBill PaulNETGROUP  = $(YPDIR)/netgroup
118778c7b1cSBill PaulPASSWD    = $(YPDIR)/passwd
119778c7b1cSBill Paul.if !defined(MASTER_PASSWD)
120778c7b1cSBill PaulMASTER    = $(YPDIR)/master.passwd
121778c7b1cSBill Paul.else
122778c7b1cSBill PaulMASTER	  = $(MASTER_PASSWD)
123778c7b1cSBill Paul.endif
124778c7b1cSBill PaulYPSERVERS = $(YPDIR)/ypservers	# List of all NIS servers for a domain
125778c7b1cSBill PaulPUBLICKEY = $(YPSRCDIR)/publickey
1261fe3e67aSBill PaulNETID     = $(YPSRCDIR)/netid
1273b056022SMark MurrayAMDHOST   = $(YPSRCDIR)/amd.map
128778c7b1cSBill Paul
12953c40578SBrian Somerstarget:
13053c40578SBrian Somers	@if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \
13153c40578SBrian Somers	cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \
13253c40578SBrian Somers	make -f ../Makefile all; echo "NIS Map update completed."
13353c40578SBrian Somers
13453c40578SBrian Somers# Read overrides.  Note, the current directory will be /var/yp/<domain>
13553c40578SBrian Somers# when 'all' is built.
13653c40578SBrian Somers.if exists(${YPDIR}/Makefile.local)
13753c40578SBrian Somers.include "${YPDIR}/Makefile.local"
13853c40578SBrian Somers.endif
13953c40578SBrian Somers
14013170f18SBill Paul# List of maps that are always built.
14113170f18SBill Paul# If you want to omit some of them, feel free to comment
14213170f18SBill Paul# them out from this list.
14380fc33c3SRobert DrehmelTARGETS= servers hosts networks protocols rpc services shells group
14413170f18SBill Paul#TARGETS+= aliases
14513170f18SBill Paul
14613170f18SBill Paul# Sanity checks: filter out targets we can't build
147fac7bc23SAlan Somers# Note that we don't build the ethers, eui64, or boorparams maps by default
148fac7bc23SAlan Somers# since /etc/ethers, /etc/eui64 and /etc/bootparams are not likely to be present
14913170f18SBill Paul# on all systems.
15013170f18SBill Paul.if exists($(ETHERS))
15113170f18SBill PaulTARGETS+= ethers
15213170f18SBill Paul.else
15313170f18SBill PaulETHERS= /dev/null
15413170f18SBill Paul.endif
15513170f18SBill Paul
156fac7bc23SAlan Somers.if exists($(EUI64))
157fac7bc23SAlan SomersTARGETS+= eui64
158fac7bc23SAlan Somers.else
159fac7bc23SAlan SomersEUI64= /dev/null
160fac7bc23SAlan Somers.endif
161fac7bc23SAlan Somers
16213170f18SBill Paul.if exists($(BOOTPARAMS))
16313170f18SBill PaulTARGETS+= bootparams
16413170f18SBill Paul.else
16513170f18SBill PaulBOOTPARAMS= /dev/null
16613170f18SBill Paul.endif
16713170f18SBill Paul
16813170f18SBill Paul.if exists($(NETGROUP))
16913170f18SBill PaulTARGETS+= netgrp
17013170f18SBill Paul.else
17113170f18SBill PaulNETGROUP= /dev/null
17213170f18SBill Paul.endif
17313170f18SBill Paul
17413170f18SBill Paul.if exists($(MASTER))
17513170f18SBill PaulTARGETS+= passwd master.passwd netid
17653c40578SBrian Somers.if ${SHADOW} == "\"True\""
17753c40578SBrian SomersTARGETS+= shadow
17853c40578SBrian Somers.endif
17913170f18SBill Paul.else
18013170f18SBill PaulMASTER= /dev/null
18113170f18SBill PaulTARGETS+= nopass
18213170f18SBill Paul.endif
18313170f18SBill Paul
18413170f18SBill Paul.if exists($(PUBLICKEY))
18513170f18SBill PaulTARGETS+= publickey
18613170f18SBill Paul.else
18713170f18SBill PaulPUBLICKEY= /dev/null
18813170f18SBill Paul.endif
18913170f18SBill Paul
19013170f18SBill Paul.if exists($(AMDHOST))
1913b056022SMark MurrayTARGETS+= amd.map
19213170f18SBill Paul.else
19313170f18SBill PaulAMDHOST= /dev/null
19413170f18SBill Paul.endif
19513170f18SBill Paul
196a89e588cSHajimu UMEMOTO.if exists($(IPNODES))
197a89e588cSHajimu UMEMOTOTARGETS+= ipnodes
198a89e588cSHajimu UMEMOTO.else
199a89e588cSHajimu UMEMOTOIPNODES= /dev/null
200a89e588cSHajimu UMEMOTO.endif
201a89e588cSHajimu UMEMOTO
20213170f18SBill Paulall: $(TARGETS)
203778c7b1cSBill Paul
204778c7b1cSBill Paulethers:	   ethers.byname ethers.byaddr
205fac7bc23SAlan Somerseui64:	   eui64.byname eui64.byid
206778c7b1cSBill Paulbootparam: bootparams
207778c7b1cSBill Paulhosts:	   hosts.byname hosts.byaddr
208a89e588cSHajimu UMEMOTOipnodes:   ipnodes.byname ipnodes.byaddr
209778c7b1cSBill Paulnetworks:  networks.byaddr networks.byname
210778c7b1cSBill Paulprotocols: protocols.bynumber protocols.byname
211778c7b1cSBill Paulrpc:	   rpc.byname rpc.bynumber
212778c7b1cSBill Paulservices:  services.byname
213778c7b1cSBill Paulpasswd:    passwd.byname passwd.byuid
21453c40578SBrian Somersshadow:    shadow.byname shadow.byuid
215778c7b1cSBill Paulgroup:     group.byname group.bygid
216778c7b1cSBill Paulnetgrp:    netgroup
217778c7b1cSBill Paulnetid:	   netid.byname
218778c7b1cSBill Paulservers:   ypservers
219778c7b1cSBill Paulpublickey: publickey.byname
220b2264be8SBill Paulaliases:   mail.aliases
221778c7b1cSBill Paul
222778c7b1cSBill Paulmaster.passwd:	master.passwd.byname master.passwd.byuid
223778c7b1cSBill Paul
224b3e93234SBill Paul#
225b3e93234SBill Paul# This is a special target used only when doing in-place updates with
226b3e93234SBill Paul# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd
227b3e93234SBill Paul# server and won't need to be remade. They will have to be pushed to the
228b3e93234SBill Paul# slaves however. Calling this target implicitly insures that this will
229b3e93234SBill Paul# happen.
230b3e93234SBill Paul#
231b3e93234SBill Paulpushpw:
232b3e93234SBill Paul	@$(DBLOAD) -c
233b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi
234b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi
23553c40578SBrian Somers.if ${SHADOW} == "\"True\""
23653c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byname ; fi
23753c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byuid ; fi
23853c40578SBrian Somers.endif
239b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi
240b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi
241b3e93234SBill Paul
24213170f18SBill Paulpushmap:
24313170f18SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi
24413170f18SBill Paul
24513170f18SBill Paulnopass:
24613170f18SBill Paul	@echo ""
24713170f18SBill Paul	@echo "                ********WARNING********"
24813170f18SBill Paul	@echo "  Couldn't find the master.passwd source file. This file"
24913170f18SBill Paul	@echo "  is needed to generate the master.passwd and passwd maps."
25013170f18SBill Paul	@echo "  The default location is /var/yp/master.passwd. You should"
25113170f18SBill Paul	@echo "  edit /var/yp/Makefile and set the MASTER variable to point"
25213170f18SBill Paul	@echo "  to the source file you wish to use for building the passwd"
25313170f18SBill Paul	@echo "  maps, or else invoke make(1) in the following manner:"
25481d30297SNick Hibma	@echo ""
25513170f18SBill Paul	@echo "        make MASTER_PASSWD=/path/to/master.passwd"
25613170f18SBill Paul	@echo ""
25713170f18SBill Paul
258b2264be8SBill Paulmail.aliases: $(ALIASES)
259b2264be8SBill Paul	@echo "Updating $@..."
260de88f160SAdam David	@$(NEWALIASES) -oA$(ALIASES)
261d91013b5SAdam David	@$(MKDB) -u $(ALIASES).db \
2621754677bSBill Paul		| $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \
2631754677bSBill Paul		$(RMV) $(TMP) $@
264b2264be8SBill Paul	@$(DBLOAD) -c
265b2264be8SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
266b2264be8SBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
267b2264be8SBill Paul
268778c7b1cSBill Paul
269778c7b1cSBill Paulypservers: $(YPSERVERS)
270778c7b1cSBill Paul	@echo "Updating $@..."
2710d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \
2720d3b8ac4SRuslan Ermilov		$(YPSERVERS) \
2731754677bSBill Paul		| $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \
2741754677bSBill Paul		$(RMV) $(TMP) $@
275b2264be8SBill Paul	@$(DBLOAD) -c
276778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
277778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
278778c7b1cSBill Paul
279778c7b1cSBill Paulethers.byname: $(ETHERS)
280778c7b1cSBill Paul	@echo "Updating $@..."
28113170f18SBill Paul.if ${ETHERS} == "/dev/null"
28213170f18SBill Paul	@echo "Ethers source file not found -- skipping"
28313170f18SBill Paul.else
2840d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
2850d3b8ac4SRuslan Ermilov		print $$2"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \
2861754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
287b2264be8SBill Paul	@$(DBLOAD) -c
288a6dbeb65SPeter Wemm	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
289778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
29013170f18SBill Paul.endif
291778c7b1cSBill Paul
292778c7b1cSBill Paulethers.byaddr: $(ETHERS)
293778c7b1cSBill Paul	@echo "Updating $@..."
29413170f18SBill Paul.if ${ETHERS} == "/dev/null"
29513170f18SBill Paul	@echo "Ethers source file not found -- skipping"
29613170f18SBill Paul.else
2970d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
2980d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \
2991754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
300b2264be8SBill Paul	@$(DBLOAD) -c
301778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
302778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
30313170f18SBill Paul.endif
304778c7b1cSBill Paul
305fac7bc23SAlan Somerseui64.byname: $(EUI64)
306fac7bc23SAlan Somers	@echo "Updating $@..."
307fac7bc23SAlan Somers.if ${EUI64} == "/dev/null"
308fac7bc23SAlan Somers	@echo "EUI64 source file not found -- skipping"
309fac7bc23SAlan Somers.else
310fac7bc23SAlan Somers	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
311fac7bc23SAlan Somers		print $$2"\t"$$0 }' $(EUI64) | $(DBLOAD) -i $(EUI64) \
312fac7bc23SAlan Somers		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
313fac7bc23SAlan Somers	@$(DBLOAD) -c
314fac7bc23SAlan Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
315fac7bc23SAlan Somers	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
316fac7bc23SAlan Somers.endif
317fac7bc23SAlan Somers
318fac7bc23SAlan Somerseui64.byid: $(EUI64)
319fac7bc23SAlan Somers	@echo "Updating $@..."
320fac7bc23SAlan Somers.if ${EUI64} == "/dev/null"
321fac7bc23SAlan Somers	@echo "EUI64 source file not found -- skipping"
322fac7bc23SAlan Somers.else
323fac7bc23SAlan Somers	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
324fac7bc23SAlan Somers		print $$1"\t"$$0 }' $(EUI64) | $(DBLOAD) -i $(EUI64) \
325fac7bc23SAlan Somers		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
326fac7bc23SAlan Somers	@$(DBLOAD) -c
327fac7bc23SAlan Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
328fac7bc23SAlan Somers	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
329fac7bc23SAlan Somers.endif
330fac7bc23SAlan Somers
331778c7b1cSBill Paul
332778c7b1cSBill Paulbootparams: $(BOOTPARAMS)
333778c7b1cSBill Paul	@echo "Updating $@..."
33413170f18SBill Paul.if ${BOOTPARAMS} == "/dev/null"
33513170f18SBill Paul	@echo "Bootparams source file not found -- skipping"
33613170f18SBill Paul.else
3370d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3380d3b8ac4SRuslan Ermilov		print $$0 }' $(BOOTPARAMS) | $(DBLOAD) -i $(BOOTPARAMS) \
3391754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
340b2264be8SBill Paul	@$(DBLOAD) -c
341778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
342778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
34313170f18SBill Paul.endif
344778c7b1cSBill Paul
345778c7b1cSBill Paul
346778c7b1cSBill Paulnetgroup: $(NETGROUP) netgroup.byhost netgroup.byuser
347778c7b1cSBill Paul	@echo "Updating $@..."
34813170f18SBill Paul.if ${NETGROUP} == "/dev/null"
34913170f18SBill Paul	@echo "Netgroup source file not found -- skipping"
35013170f18SBill Paul.else
3510d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3520d3b8ac4SRuslan Ermilov		print $$0 }' $(NETGROUP) | $(DBLOAD) -i $(NETGROUP) \
3531754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
354b2264be8SBill Paul	@$(DBLOAD) -c
355778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
356778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
35713170f18SBill Paul.endif
358778c7b1cSBill Paul
359778c7b1cSBill Paul
360778c7b1cSBill Paulnetgroup.byhost: $(NETGROUP)
361778c7b1cSBill Paul	@echo "Updating $@..."
36213170f18SBill Paul.if ${NETGROUP} == "/dev/null"
36313170f18SBill Paul	@echo "Netgroup source file not found -- skipping"
36413170f18SBill Paul.else
3650d3b8ac4SRuslan Ermilov	@$(REVNETGROUP) -h -f $(NETGROUP) | \
3660f87b00dSSteve Price	$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3670d3b8ac4SRuslan Ermilov		print $$0 }' | $(DBLOAD) -i $(NETGROUP) \
3681754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
369b2264be8SBill Paul	@$(DBLOAD) -c
370778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
371778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
37213170f18SBill Paul.endif
373778c7b1cSBill Paul
374778c7b1cSBill Paul
375778c7b1cSBill Paulnetgroup.byuser: $(NETGROUP)
376778c7b1cSBill Paul	@echo "Updating $@..."
37713170f18SBill Paul.if ${NETGROUP} == "/dev/null"
37813170f18SBill Paul	@echo "Netgroup source file not found -- skipping"
37913170f18SBill Paul.else
3800d3b8ac4SRuslan Ermilov	@$(REVNETGROUP) -u -f $(NETGROUP) | \
3810f87b00dSSteve Price	$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3820d3b8ac4SRuslan Ermilov		print $$0 }' | $(DBLOAD) -i $(NETGROUP) \
3831754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
384b2264be8SBill Paul	@$(DBLOAD) -c
385778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
386778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
38713170f18SBill Paul.endif
388778c7b1cSBill Paul
389778c7b1cSBill Paul
390*4ba79bb4SHajimu UMEMOTO# Solaris 8 does the following:
391*4ba79bb4SHajimu UMEMOTO# - /etc/hosts and hosts.{byname,byaddr} are IPv4 only.
392*4ba79bb4SHajimu UMEMOTO# - /etc/inet/ipnodes and ipnodes.{byname,byaddr} are used for protocol
393*4ba79bb4SHajimu UMEMOTO#   independent name-to-address mapping.
394*4ba79bb4SHajimu UMEMOTO#
395*4ba79bb4SHajimu UMEMOTO# For local name resolution, we made /etc/hosts protocol independent.
396*4ba79bb4SHajimu UMEMOTO# For NIS name resolution, we obey Solaris 8 practice.
397*4ba79bb4SHajimu UMEMOTO# - We keep hosts.{byname,byaddr} IPv4 only, to be friendly with Solaris 8
398*4ba79bb4SHajimu UMEMOTO#   clients.
399*4ba79bb4SHajimu UMEMOTO# - ipnodes.{byname,byaddr} is used for protocol independent mapping.
400*4ba79bb4SHajimu UMEMOTO#
401778c7b1cSBill Paulhosts.byname: $(HOSTS)
402778c7b1cSBill Paul	@echo "Updating $@..."
403*4ba79bb4SHajimu UMEMOTO	@$(AWK) '/^[0-9.]+[\t ]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \
4040d3b8ac4SRuslan Ermilov		print $$n"\t"$$0 }' $(HOSTS) | $(DBLOAD) ${B} -i $(HOSTS)  \
4051754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
406b2264be8SBill Paul	@$(DBLOAD) -c
407778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
408778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
409778c7b1cSBill Paul
410b2264be8SBill Paul
411778c7b1cSBill Paulhosts.byaddr: $(HOSTS)
412778c7b1cSBill Paul	@echo "Updating $@..."
413*4ba79bb4SHajimu UMEMOTO	@$(AWK) '/^[0-9.]+[\t ]/ { print $$1"\t"$$0 }' $(HOSTS) \
4141754677bSBill Paul		| $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP); \
4151754677bSBill Paul		$(RMV) $(TMP) $@
416b2264be8SBill Paul	@$(DBLOAD) -c
417778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
418778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
419778c7b1cSBill Paul
420778c7b1cSBill Paul
421a89e588cSHajimu UMEMOTOipnodes.byname: $(IPNODES)
422a89e588cSHajimu UMEMOTO	@echo "Updating $@..."
423a89e588cSHajimu UMEMOTO.if ${IPNODES} == "/dev/null"
424a89e588cSHajimu UMEMOTO	@echo "Ipnodes source file not found -- skipping"
425a89e588cSHajimu UMEMOTO.else
426a89e588cSHajimu UMEMOTO	@$(AWK) '/^[0-9a-fA-F:]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \
427a89e588cSHajimu UMEMOTO		print $$n"\t"$$0 }' $(IPNODES) | $(DBLOAD) ${B} -i $(IPNODES)  \
428a89e588cSHajimu UMEMOTO		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
429a89e588cSHajimu UMEMOTO	@$(DBLOAD) -c
430a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
431a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
432a89e588cSHajimu UMEMOTO.endif
433a89e588cSHajimu UMEMOTO
434a89e588cSHajimu UMEMOTO
435a89e588cSHajimu UMEMOTOipnodes.byaddr: $(IPNODES)
436a89e588cSHajimu UMEMOTO	@echo "Updating $@..."
437a89e588cSHajimu UMEMOTO.if ${IPNODES} == "/dev/null"
438a89e588cSHajimu UMEMOTO	@echo "Ipnodes source file not found -- skipping"
439a89e588cSHajimu UMEMOTO.else
440a89e588cSHajimu UMEMOTO	@$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $(IPNODES) \
441a89e588cSHajimu UMEMOTO		| $(DBLOAD) ${B} -i $(IPNODES) -o $(YPMAPDIR)/$@ - $(TMP); \
442a89e588cSHajimu UMEMOTO		$(RMV) $(TMP) $@
443a89e588cSHajimu UMEMOTO	@$(DBLOAD) -c
444a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
445a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
446a89e588cSHajimu UMEMOTO.endif
447a89e588cSHajimu UMEMOTO
448a89e588cSHajimu UMEMOTO
449778c7b1cSBill Paulnetworks.byname: $(NETWORKS)
450778c7b1cSBill Paul	@echo "Updating $@..."
4510d3b8ac4SRuslan Ermilov	@$(AWK) \
4520f87b00dSSteve Price	   '$$1 !~ "^#.*"  { print $$1"\t"$$0; \
4530f87b00dSSteve Price			  for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
454778c7b1cSBill Paul			      print $$n"\t"$$0 \
4550d3b8ac4SRuslan Ermilov		}' $(NETWORKS) \
4560d3b8ac4SRuslan Ermilov		| $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \
4571754677bSBill Paul		$(RMV) $(TMP) $@
458b2264be8SBill Paul	@$(DBLOAD) -c
459778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
460778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
461778c7b1cSBill Paul
462778c7b1cSBill Paul
463778c7b1cSBill Paulnetworks.byaddr: $(NETWORKS)
464778c7b1cSBill Paul	@echo "Updating $@..."
4650d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(NETWORKS) \
4661754677bSBill Paul		| $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \
4671754677bSBill Paul		$(RMV) $(TMP) $@
468b2264be8SBill Paul	@$(DBLOAD) -c
469778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
470778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
471778c7b1cSBill Paul
472778c7b1cSBill Paul
473778c7b1cSBill Paulprotocols.byname: $(PROTOCOLS)
474778c7b1cSBill Paul	@echo "Updating $@..."
4750d3b8ac4SRuslan Ermilov	@$(AWK) \
4760f87b00dSSteve Price	   '$$1 !~ "^#.*"	{ print $$1"\t"$$0; \
4770f87b00dSSteve Price			  for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
478778c7b1cSBill Paul			      print $$n"\t"$$0 \
4790d3b8ac4SRuslan Ermilov			}' $(PROTOCOLS) | $(DBLOAD) -i $(PROTOCOLS) \
4801754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
481b2264be8SBill Paul	@$(DBLOAD) -c
482778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
483778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
484778c7b1cSBill Paul
485778c7b1cSBill Paul
486778c7b1cSBill Paulprotocols.bynumber: $(PROTOCOLS)
487778c7b1cSBill Paul	@echo "Updating $@..."
4880d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(PROTOCOLS) \
4891754677bSBill Paul		| $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP); \
4901754677bSBill Paul		$(RMV) $(TMP) $@
491b2264be8SBill Paul	@$(DBLOAD) -c
492778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
493778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
494778c7b1cSBill Paul
495778c7b1cSBill Paul
496778c7b1cSBill Paulrpc.byname: $(RPC)
497778c7b1cSBill Paul	@echo "Updating $@..."
4980d3b8ac4SRuslan Ermilov	@$(AWK) \
4990f87b00dSSteve Price	   '$$1 !~ "^#.*"  { print $$1"\t"$$0; \
5000f87b00dSSteve Price			  for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
501778c7b1cSBill Paul			      print $$n"\t"$$0 \
5020d3b8ac4SRuslan Ermilov		}' $(RPC) | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \
5031754677bSBill Paul		$(RMV) $(TMP) $@
504b2264be8SBill Paul	@$(DBLOAD) -c
505778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
506778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
507778c7b1cSBill Paul
508778c7b1cSBill Paul
509778c7b1cSBill Paulrpc.bynumber: $(RPC)
510778c7b1cSBill Paul	@echo "Updating $@..."
5110d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(RPC) \
5121754677bSBill Paul		| $(DBLOAD)  -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \
5131754677bSBill Paul		$(RMV) $(TMP) $@
514b2264be8SBill Paul	@$(DBLOAD) -c
515778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
516778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
517778c7b1cSBill Paul
518778c7b1cSBill Paul
519778c7b1cSBill Paulservices.byname: $(SERVICES)
520778c7b1cSBill Paul	@echo "Updating $@..."
5210d3b8ac4SRuslan Ermilov	@$(AWK) \
5220f87b00dSSteve Price	   '$$1 !~ "^#.*"  { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \
523f44298dfSBill Paul				if (split($$2, t, "/")) { \
524f44298dfSBill Paul					printf("%s/%s", $$n, t[2]) }; \
5259ac2a83aSBill Paul					print "\t"$$0;	\
52688b4ff3cSPeter Wemm					if (n == 1) n = 2; \
52788b4ff3cSPeter Wemm			   } ; print $$2"\t"$$0 ; \
5280d3b8ac4SRuslan Ermilov		}' $(SERVICES) \
5290d3b8ac4SRuslan Ermilov		| $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \
5301754677bSBill Paul		$(RMV) $(TMP) $@
531b2264be8SBill Paul	@$(DBLOAD) -c
532778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
533778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
534778c7b1cSBill Paul
5357d2155f0SMaxim Konovalovshells: $(SHELLS)
53680fc33c3SRobert Drehmel	@echo "Updating $@..."
5370d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \
5380d3b8ac4SRuslan Ermilov		$(SHELLS) \
5390d3b8ac4SRuslan Ermilov		| $(DBLOAD) -i $(SHELLS) -o $(YPMAPDIR)/$@ - $(TMP); \
54080fc33c3SRobert Drehmel	 $(RMV) $(TMP) $@
54180fc33c3SRobert Drehmel	@$(DBLOAD) -c
54280fc33c3SRobert Drehmel	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
54380fc33c3SRobert Drehmel	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
544778c7b1cSBill Paul
545778c7b1cSBill Paulpublickey.byname: $(PUBLICKEY)
546778c7b1cSBill Paul	@echo "Updating $@..."
54713170f18SBill Paul.if ${PUBLICKEY} == "/dev/null"
54813170f18SBill Paul	@echo "Publickey source file not found -- skipping"
54913170f18SBill Paul.else
5500d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $(PUBLICKEY) \
5511754677bSBill Paul		| $(DBLOAD)  -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \
5521754677bSBill Paul		$(RMV) $(TMP) $@
553b2264be8SBill Paul	@$(DBLOAD) -c
554778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
555778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
55613170f18SBill Paul.endif
557778c7b1cSBill Paul
558778c7b1cSBill Paul
559778c7b1cSBill Paul$(PASSWD): $(MASTER)
560778c7b1cSBill Paul	@echo "Creating new $@ file from $(MASTER)..."
561778c7b1cSBill Paul	@if [ ! $(UNSECURE) ]; then \
56203806e0dSBrian Somers	$(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5630d3b8ac4SRuslan Ermilov		print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \
564778c7b1cSBill Paul		> $(PASSWD) ; \
5650d3b8ac4SRuslan Ermilov	else \
56603806e0dSBrian Somers	$(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5670d3b8ac4SRuslan Ermilov		print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \
568778c7b1cSBill Paul		> $(PASSWD) ; fi
569778c7b1cSBill Paul
570778c7b1cSBill Paul
571778c7b1cSBill Paulpasswd.byname: $(PASSWD)
572778c7b1cSBill Paul	@echo "Updating $@..."
5730d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5740d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(PASSWD) \
575b22e036eSBill Paul		| $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
5761754677bSBill Paul		$(RMV) $(TMP) $@
577b2264be8SBill Paul	@$(DBLOAD) -c
578778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
579778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
580778c7b1cSBill Paul
581b2264be8SBill Paul
582778c7b1cSBill Paulpasswd.byuid: $(PASSWD)
583778c7b1cSBill Paul	@echo "Updating $@..."
5840d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5850d3b8ac4SRuslan Ermilov		print $$3"\t"$$0 }' $(PASSWD) \
586b22e036eSBill Paul		| $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
5871754677bSBill Paul		$(RMV) $(TMP) $@
588b2264be8SBill Paul	@$(DBLOAD) -c
589778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
590778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
591778c7b1cSBill Paul
592778c7b1cSBill Paul
593778c7b1cSBill Paulgroup.byname: $(GROUP)
594778c7b1cSBill Paul	@echo "Updating $@..."
5950d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5960d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(GROUP) \
597b22e036eSBill Paul		| $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
5981754677bSBill Paul		$(RMV) $(TMP) $@
599b2264be8SBill Paul	@$(DBLOAD) -c
600778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
601778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
602778c7b1cSBill Paul
603778c7b1cSBill Paul
604778c7b1cSBill Paulgroup.bygid: $(GROUP)
605778c7b1cSBill Paul	@echo "Updating $@..."
6060d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
6070d3b8ac4SRuslan Ermilov		print $$3"\t"$$0 }' $(GROUP) \
608b22e036eSBill Paul		| $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
6091754677bSBill Paul		$(RMV) $(TMP) $@
610b2264be8SBill Paul	@$(DBLOAD) -c
611778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
612778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
613778c7b1cSBill Paul
614778c7b1cSBill Paul
615f2a3dfe5SRuslan Ermilovnetid.byname: $(GROUP) $(PASSWD) $(HOSTS)
616778c7b1cSBill Paul	@echo "Updating $@..."
6171fe3e67aSBill Paul	@$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \
6181754677bSBill Paul		-d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \
6191754677bSBill Paul		$(RMV) $(TMP) $@
620b2264be8SBill Paul	@$(DBLOAD) -c
621778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
622778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
623778c7b1cSBill Paul
624778c7b1cSBill Paul
625778c7b1cSBill Paulmaster.passwd.byname: $(MASTER)
626778c7b1cSBill Paul	@echo "Updating $@..."
62713170f18SBill Paul.if ${MASTER} == "/dev/null"
62813170f18SBill Paul	@echo "Master.passwd source file not found -- skipping"
62913170f18SBill Paul.else
6300d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
6310d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(MASTER) \
632b22e036eSBill Paul		| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
6331754677bSBill Paul		$(RMV) $(TMP) $@
634b2264be8SBill Paul	@$(DBLOAD) -c
635778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
636778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
63713170f18SBill Paul.endif
638778c7b1cSBill Paul
639778c7b1cSBill Paul
640778c7b1cSBill Paulmaster.passwd.byuid: $(MASTER)
641778c7b1cSBill Paul	@echo "Updating $@..."
64213170f18SBill Paul.if ${MASTER} == "/dev/null"
64313170f18SBill Paul	@echo "Master.passwd source file not found -- skipping"
64413170f18SBill Paul.else
6450d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
6460d3b8ac4SRuslan Ermilov		print $$3"\t"$$0 }' $(MASTER) \
647b22e036eSBill Paul		| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
6481754677bSBill Paul		$(RMV) $(TMP) $@
649b2264be8SBill Paul	@$(DBLOAD) -c
650778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
651778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
65213170f18SBill Paul.endif
65313170f18SBill Paul
65457948c0bSPeter Wemm
65553c40578SBrian Somersshadow.byname: $(MASTER)
65653c40578SBrian Somers	@echo "Updating $@..."
65753c40578SBrian Somers.if ${MASTER} == "/dev/null"
65853c40578SBrian Somers	@echo "Master.passwd source file not found -- skipping"
65953c40578SBrian Somers.else
66053c40578SBrian Somers	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
66153c40578SBrian Somers		print $$1"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \
66253c40578SBrian Somers		| sed 's/\(	[^:]*:\)\*:/\1!:/' \
66353c40578SBrian Somers		| $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
66453c40578SBrian Somers		$(RMV) $(TMP) $@
66553c40578SBrian Somers	@$(DBLOAD) -c
66653c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
66753c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
66853c40578SBrian Somers.endif
66953c40578SBrian Somers
67053c40578SBrian Somersshadow.byuid: $(MASTER)
67153c40578SBrian Somers	@echo "Updating $@..."
67253c40578SBrian Somers.if ${MASTER} == "/dev/null"
67353c40578SBrian Somers	@echo "Master.passwd source file not found -- skipping"
67453c40578SBrian Somers.else
67553c40578SBrian Somers	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
67653c40578SBrian Somers		print $$3"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \
67753c40578SBrian Somers		| sed 's/\(	[^:]*:\)\*:/\1!:/' \
67853c40578SBrian Somers		| $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
67953c40578SBrian Somers		$(RMV) $(TMP) $@
68053c40578SBrian Somers	@$(DBLOAD) -c
68153c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
68253c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
68353c40578SBrian Somers.endif
68453c40578SBrian Somers
6853b056022SMark Murrayamd.map: $(AMDHOST)
68657948c0bSPeter Wemm	@echo "Updating $@..."
6870d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*"  { \
68857948c0bSPeter Wemm	  for (i = 1; i <= NF; i++) \
68957948c0bSPeter Wemm	  if (i == NF) { \
69057948c0bSPeter Wemm	    if (substr($$i, length($$i), 1) == "\\") \
69157948c0bSPeter Wemm	      printf("%s", substr($$i, 1, length($$i) - 1)); \
69257948c0bSPeter Wemm	    else \
69357948c0bSPeter Wemm	      printf("%s\n", $$i); \
69457948c0bSPeter Wemm	  } \
69557948c0bSPeter Wemm	  else \
69657948c0bSPeter Wemm	    printf("%s ", $$i); \
6970d3b8ac4SRuslan Ermilov	}' $(AMDHOST) | \
6981754677bSBill Paul	$(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP); \
6991754677bSBill Paul		$(RMV) $(TMP) $@
70057948c0bSPeter Wemm	@$(DBLOAD) -c
70157948c0bSPeter Wemm	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
70257948c0bSPeter Wemm	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
703