xref: /freebsd/usr.sbin/ypserv/Makefile.yp (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1778c7b1cSBill Paul#
2778c7b1cSBill Paul# Makefile for the NIS databases
3778c7b1cSBill Paul#
4778c7b1cSBill Paul#
5778c7b1cSBill Paul# This Makefile should only be run on the NIS master server of a domain.
6778c7b1cSBill Paul# All updated maps will be pushed to all NIS slave servers listed in the
7778c7b1cSBill Paul# /var/yp/ypservers file. Please make sure that the hostnames of all
8778c7b1cSBill Paul# NIS servers in your domain are listed in /var/yp/ypservers.
9778c7b1cSBill Paul#
10778c7b1cSBill Paul# This Makefile can be modified to support more NIS maps if desired.
11778c7b1cSBill Paul#
12778c7b1cSBill Paul
1353c40578SBrian Somers# If this machine is an NIS master, reset this variable (NOPUSH=)
1453c40578SBrian Somers# in Makefile.local so that changes to the NIS maps can be propagated to
1553c40578SBrian Somers# the slave servers.  (By default we assume that we are only serving a
1653c40578SBrian Somers# small domain with only one server.)
17778c7b1cSBill Paul#
18778c7b1cSBill PaulNOPUSH = "True"
19778c7b1cSBill Paul
2053c40578SBrian Somers# If this machine does not wish to generate a linux-style shadow map
2153c40578SBrian Somers# from the master.passwd file, reset this variable (SHADOW=) in
2253c40578SBrian Somers# Makefile.local.
2353c40578SBrian SomersSHADOW = "True"
2453c40578SBrian Somers
25778c7b1cSBill Paul# If you want to use a FreeBSD NIS server to serve non-FreeBSD clients
26778c7b1cSBill Paul# (i.e. clients who expect the password field in the passwd maps to be
2753c40578SBrian Somers# valid) then set this variable (UNSECURE="True") in Makefile.local.
2853c40578SBrian Somers# This will cause $YPDIR/passwd to be generated with valid password
2953c40578SBrian Somers# fields.  This is insecure: FreeBSD normally only serves the
3053c40578SBrian Somers# master.passwd and shadow maps (which have real encrypted passwords
3153c40578SBrian Somers# in them) to the superuser on other FreeBSD machines, but non-FreeBSD
3253c40578SBrian Somers# clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX, etc...)
3353c40578SBrian Somers# will only work properly in 'unsecure' mode.
34778c7b1cSBill Paul#
35778c7b1cSBill Paul#UNSECURE = "True"
36778c7b1cSBill Paul
3744519760SBill Paul# The following line encodes the YP_INTERDOMAIN key into the hosts.byname
3844519760SBill Paul# and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve
3953c40578SBrian Somers# hosts not in the current domain.  Resetting this variable in
4053c40578SBrian Somers# Makefile.local (B=) will disable the DNS lookups.
4144519760SBill PaulB=-b
4244519760SBill Paul
4353c40578SBrian Somers# Normally, the master.passwd.* and shadow.* maps are guarded against access
4453c40578SBrian Somers# from non-privileged users.  By resetting S in Makefile.local (S=), the
4553c40578SBrian Somers# YP_SECURE key will be removed from these maps, allowing anyone to access
4653c40578SBrian Somers# them.
4744519760SBill PaulS=-s
4844519760SBill Paul
49778c7b1cSBill Paul# These are commands which this Makefile needs to properly rebuild the
50778c7b1cSBill Paul# NIS databases. Don't change these unless you have a good reason. Also
51778c7b1cSBill Paul# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary
52778c7b1cSBill Paul# and it'll break everything in sight.
53778c7b1cSBill Paul#
54778c7b1cSBill PaulAWK = /usr/bin/awk
55778c7b1cSBill PaulRM  = @/bin/rm -f
56b2264be8SBill PaulMV  = @/bin/mv -f
571754677bSBill PaulRMV  = /bin/mv -f
58778c7b1cSBill Paul
59de88f160SAdam DavidMKDB = /usr/sbin/yp_mkdb
60de88f160SAdam DavidDBLOAD = $(MKDB) -m `hostname`
61778c7b1cSBill PaulMKNETID = /usr/libexec/mknetid
62b2264be8SBill PaulNEWALIASES = /usr/bin/newaliases
631fff226dSBill PaulYPPUSH = /usr/sbin/yppush
64920491cfSBill Paul.if !defined(UPDATE_DOMAIN)
65778c7b1cSBill PaulDOMAIN = `/bin/domainname`
66920491cfSBill Paul.else
67920491cfSBill PaulDOMAIN = $(UPDATE_DOMAIN)
68920491cfSBill Paul.endif
69778c7b1cSBill PaulREVNETGROUP = /usr/libexec/revnetgroup
701754677bSBill PaulTMP = `echo $@.$$$$`
71778c7b1cSBill Paul
72de88f160SAdam David# It is advisable to create a separate directory to contain the
73de88f160SAdam David# source files used to generate your NIS maps. If you intend to
74b2264be8SBill Paul# support multiple domains, something like /src/dir/$DOMAIN
75b2264be8SBill Paul# would work well.
76778c7b1cSBill PaulYPSRCDIR = /etc
7713170f18SBill Paul.if !defined(YP_DIR)
78778c7b1cSBill PaulYPDIR = /var/yp
7913170f18SBill Paul.else
8013170f18SBill PaulYPDIR = $(YP_DIR)
8113170f18SBill Paul.endif
82778c7b1cSBill PaulYPMAPDIR = $(YPDIR)/$(DOMAIN)
83778c7b1cSBill Paul
84778c7b1cSBill Paul# These are the files from which the NIS databases are built. You may edit
85778c7b1cSBill Paul# these to taste in the event that you wish to keep your NIS source files
861a6e52d0SJeroen Ruigrok van der Werven# separate from your NIS server's actual configuration files. Note that the
87778c7b1cSBill Paul# NIS passwd and master.passwd files are stored in /var/yp: the server's
88778c7b1cSBill Paul# real password database is not used by default. However, you may use
89778c7b1cSBill Paul# the real /etc/passwd and /etc/master.passwd files by:
90778c7b1cSBill Paul#
91778c7b1cSBill Paul#
923939bb66SPoul-Henning Kamp# - invoking yppasswdd with `-t /etc/master.passwd' (yppasswdd will do a
933939bb66SPoul-Henning Kamp#   'pwd_mkdb' as needed if /etc/master.passwd is thus specified).
94778c7b1cSBill Paul# - Specifying the location of the master.passwd file using the
95778c7b1cSBill Paul#   MASTER_PASSWD variable, i.e.:
96778c7b1cSBill Paul#
97778c7b1cSBill Paul#   # make MASTER_PASSWD=/path/to/some/other/master.passwd
98778c7b1cSBill Paul#
99778c7b1cSBill Paul# - (optionally): editing this Makefile to change the default location.
100778c7b1cSBill Paul#
101778c7b1cSBill Paul# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw
102778c7b1cSBill Paul# passwd file will be generated from the master.passwd file automagically.
103778c7b1cSBill Paul#
104778c7b1cSBill PaulETHERS    = $(YPSRCDIR)/ethers	   # ethernet addresses (for rarpd)
105fac7bc23SAlan SomersEUI64     = $(YPSRCDIR)/eui64	   # eui64 addresses (for firewire)
106778c7b1cSBill PaulBOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd)
107778c7b1cSBill PaulHOSTS     = $(YPSRCDIR)/hosts
108a89e588cSHajimu UMEMOTOIPNODES   = $(YPDIR)/ipnodes
109778c7b1cSBill PaulNETWORKS  = $(YPSRCDIR)/networks
110778c7b1cSBill PaulPROTOCOLS = $(YPSRCDIR)/protocols
111778c7b1cSBill PaulRPC 	  = $(YPSRCDIR)/rpc
112778c7b1cSBill PaulSERVICES  = $(YPSRCDIR)/services
11380fc33c3SRobert DrehmelSHELLS    = $(YPSRCDIR)/shells
114778c7b1cSBill PaulGROUP     = $(YPSRCDIR)/group
115a00856a8SGregory Neil ShapiroALIASES   = $(YPSRCDIR)/mail/aliases
116b2264be8SBill PaulNETGROUP  = $(YPDIR)/netgroup
117778c7b1cSBill PaulPASSWD    = $(YPDIR)/passwd
118778c7b1cSBill Paul.if !defined(MASTER_PASSWD)
119778c7b1cSBill PaulMASTER    = $(YPDIR)/master.passwd
120778c7b1cSBill Paul.else
121778c7b1cSBill PaulMASTER	  = $(MASTER_PASSWD)
122778c7b1cSBill Paul.endif
123778c7b1cSBill PaulYPSERVERS = $(YPDIR)/ypservers	# List of all NIS servers for a domain
124778c7b1cSBill PaulPUBLICKEY = $(YPSRCDIR)/publickey
1251fe3e67aSBill PaulNETID     = $(YPSRCDIR)/netid
1263b056022SMark MurrayAMDHOST   = $(YPSRCDIR)/amd.map
127778c7b1cSBill Paul
12853c40578SBrian Somerstarget:
12953c40578SBrian Somers	@if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \
13053c40578SBrian Somers	cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \
13153c40578SBrian Somers	make -f ../Makefile all; echo "NIS Map update completed."
13253c40578SBrian Somers
13353c40578SBrian Somers# Read overrides.  Note, the current directory will be /var/yp/<domain>
13453c40578SBrian Somers# when 'all' is built.
13553c40578SBrian Somers.if exists(${YPDIR}/Makefile.local)
13653c40578SBrian Somers.include "${YPDIR}/Makefile.local"
13753c40578SBrian Somers.endif
13853c40578SBrian Somers
13913170f18SBill Paul# List of maps that are always built.
14013170f18SBill Paul# If you want to omit some of them, feel free to comment
14113170f18SBill Paul# them out from this list.
14280fc33c3SRobert DrehmelTARGETS= servers hosts networks protocols rpc services shells group
143*00022bd0SHajimu UMEMOTOTARGETS+= ipnodes
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
196*00022bd0SHajimu UMEMOTO.if !exists($(IPNODES))
197*00022bd0SHajimu UMEMOTOIPNODES= $(HOSTS)
198a89e588cSHajimu UMEMOTO.endif
199a89e588cSHajimu UMEMOTO
20013170f18SBill Paulall: $(TARGETS)
201778c7b1cSBill Paul
202778c7b1cSBill Paulethers:	   ethers.byname ethers.byaddr
203fac7bc23SAlan Somerseui64:	   eui64.byname eui64.byid
204778c7b1cSBill Paulbootparam: bootparams
205778c7b1cSBill Paulhosts:	   hosts.byname hosts.byaddr
206a89e588cSHajimu UMEMOTOipnodes:   ipnodes.byname ipnodes.byaddr
207778c7b1cSBill Paulnetworks:  networks.byaddr networks.byname
208778c7b1cSBill Paulprotocols: protocols.bynumber protocols.byname
209778c7b1cSBill Paulrpc:	   rpc.byname rpc.bynumber
210778c7b1cSBill Paulservices:  services.byname
211778c7b1cSBill Paulpasswd:    passwd.byname passwd.byuid
21253c40578SBrian Somersshadow:    shadow.byname shadow.byuid
213778c7b1cSBill Paulgroup:     group.byname group.bygid
214778c7b1cSBill Paulnetgrp:    netgroup
215778c7b1cSBill Paulnetid:	   netid.byname
216778c7b1cSBill Paulservers:   ypservers
217778c7b1cSBill Paulpublickey: publickey.byname
218b2264be8SBill Paulaliases:   mail.aliases
219778c7b1cSBill Paul
220778c7b1cSBill Paulmaster.passwd:	master.passwd.byname master.passwd.byuid
221778c7b1cSBill Paul
222b3e93234SBill Paul#
223b3e93234SBill Paul# This is a special target used only when doing in-place updates with
224b3e93234SBill Paul# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd
225b3e93234SBill Paul# server and won't need to be remade. They will have to be pushed to the
226b3e93234SBill Paul# slaves however. Calling this target implicitly insures that this will
227b3e93234SBill Paul# happen.
228b3e93234SBill Paul#
229b3e93234SBill Paulpushpw:
230b3e93234SBill Paul	@$(DBLOAD) -c
231b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi
232b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi
23353c40578SBrian Somers.if ${SHADOW} == "\"True\""
23453c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byname ; fi
23553c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byuid ; fi
23653c40578SBrian Somers.endif
237b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi
238b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi
239b3e93234SBill Paul
24013170f18SBill Paulpushmap:
24113170f18SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi
24213170f18SBill Paul
24313170f18SBill Paulnopass:
24413170f18SBill Paul	@echo ""
24513170f18SBill Paul	@echo "                ********WARNING********"
24613170f18SBill Paul	@echo "  Couldn't find the master.passwd source file. This file"
24713170f18SBill Paul	@echo "  is needed to generate the master.passwd and passwd maps."
24813170f18SBill Paul	@echo "  The default location is /var/yp/master.passwd. You should"
24913170f18SBill Paul	@echo "  edit /var/yp/Makefile and set the MASTER variable to point"
25013170f18SBill Paul	@echo "  to the source file you wish to use for building the passwd"
25113170f18SBill Paul	@echo "  maps, or else invoke make(1) in the following manner:"
25281d30297SNick Hibma	@echo ""
25313170f18SBill Paul	@echo "        make MASTER_PASSWD=/path/to/master.passwd"
25413170f18SBill Paul	@echo ""
25513170f18SBill Paul
256b2264be8SBill Paulmail.aliases: $(ALIASES)
257b2264be8SBill Paul	@echo "Updating $@..."
258de88f160SAdam David	@$(NEWALIASES) -oA$(ALIASES)
259d91013b5SAdam David	@$(MKDB) -u $(ALIASES).db \
2601754677bSBill Paul		| $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \
2611754677bSBill Paul		$(RMV) $(TMP) $@
262b2264be8SBill Paul	@$(DBLOAD) -c
263b2264be8SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
264b2264be8SBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
265b2264be8SBill Paul
266778c7b1cSBill Paul
267778c7b1cSBill Paulypservers: $(YPSERVERS)
268778c7b1cSBill Paul	@echo "Updating $@..."
2690d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \
2700d3b8ac4SRuslan Ermilov		$(YPSERVERS) \
2711754677bSBill Paul		| $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \
2721754677bSBill Paul		$(RMV) $(TMP) $@
273b2264be8SBill Paul	@$(DBLOAD) -c
274778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
275778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
276778c7b1cSBill Paul
277778c7b1cSBill Paulethers.byname: $(ETHERS)
278778c7b1cSBill Paul	@echo "Updating $@..."
27913170f18SBill Paul.if ${ETHERS} == "/dev/null"
28013170f18SBill Paul	@echo "Ethers source file not found -- skipping"
28113170f18SBill Paul.else
2820d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
2830d3b8ac4SRuslan Ermilov		print $$2"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \
2841754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
285b2264be8SBill Paul	@$(DBLOAD) -c
286a6dbeb65SPeter Wemm	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
287778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
28813170f18SBill Paul.endif
289778c7b1cSBill Paul
290778c7b1cSBill Paulethers.byaddr: $(ETHERS)
291778c7b1cSBill Paul	@echo "Updating $@..."
29213170f18SBill Paul.if ${ETHERS} == "/dev/null"
29313170f18SBill Paul	@echo "Ethers source file not found -- skipping"
29413170f18SBill Paul.else
2950d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
2960d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \
2971754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
298b2264be8SBill Paul	@$(DBLOAD) -c
299778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
300778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
30113170f18SBill Paul.endif
302778c7b1cSBill Paul
303fac7bc23SAlan Somerseui64.byname: $(EUI64)
304fac7bc23SAlan Somers	@echo "Updating $@..."
305fac7bc23SAlan Somers.if ${EUI64} == "/dev/null"
306fac7bc23SAlan Somers	@echo "EUI64 source file not found -- skipping"
307fac7bc23SAlan Somers.else
308fac7bc23SAlan Somers	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
309fac7bc23SAlan Somers		print $$2"\t"$$0 }' $(EUI64) | $(DBLOAD) -i $(EUI64) \
310fac7bc23SAlan Somers		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
311fac7bc23SAlan Somers	@$(DBLOAD) -c
312fac7bc23SAlan Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
313fac7bc23SAlan Somers	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
314fac7bc23SAlan Somers.endif
315fac7bc23SAlan Somers
316fac7bc23SAlan Somerseui64.byid: $(EUI64)
317fac7bc23SAlan Somers	@echo "Updating $@..."
318fac7bc23SAlan Somers.if ${EUI64} == "/dev/null"
319fac7bc23SAlan Somers	@echo "EUI64 source file not found -- skipping"
320fac7bc23SAlan Somers.else
321fac7bc23SAlan Somers	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
322fac7bc23SAlan Somers		print $$1"\t"$$0 }' $(EUI64) | $(DBLOAD) -i $(EUI64) \
323fac7bc23SAlan Somers		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
324fac7bc23SAlan Somers	@$(DBLOAD) -c
325fac7bc23SAlan Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
326fac7bc23SAlan Somers	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
327fac7bc23SAlan Somers.endif
328fac7bc23SAlan Somers
329778c7b1cSBill Paul
330778c7b1cSBill Paulbootparams: $(BOOTPARAMS)
331778c7b1cSBill Paul	@echo "Updating $@..."
33213170f18SBill Paul.if ${BOOTPARAMS} == "/dev/null"
33313170f18SBill Paul	@echo "Bootparams source file not found -- skipping"
33413170f18SBill Paul.else
3350d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3360d3b8ac4SRuslan Ermilov		print $$0 }' $(BOOTPARAMS) | $(DBLOAD) -i $(BOOTPARAMS) \
3371754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
338b2264be8SBill Paul	@$(DBLOAD) -c
339778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
340778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
34113170f18SBill Paul.endif
342778c7b1cSBill Paul
343778c7b1cSBill Paul
344778c7b1cSBill Paulnetgroup: $(NETGROUP) netgroup.byhost netgroup.byuser
345778c7b1cSBill Paul	@echo "Updating $@..."
34613170f18SBill Paul.if ${NETGROUP} == "/dev/null"
34713170f18SBill Paul	@echo "Netgroup source file not found -- skipping"
34813170f18SBill Paul.else
3490d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3500d3b8ac4SRuslan Ermilov		print $$0 }' $(NETGROUP) | $(DBLOAD) -i $(NETGROUP) \
3511754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
352b2264be8SBill Paul	@$(DBLOAD) -c
353778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
354778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
35513170f18SBill Paul.endif
356778c7b1cSBill Paul
357778c7b1cSBill Paul
358778c7b1cSBill Paulnetgroup.byhost: $(NETGROUP)
359778c7b1cSBill Paul	@echo "Updating $@..."
36013170f18SBill Paul.if ${NETGROUP} == "/dev/null"
36113170f18SBill Paul	@echo "Netgroup source file not found -- skipping"
36213170f18SBill Paul.else
3630d3b8ac4SRuslan Ermilov	@$(REVNETGROUP) -h -f $(NETGROUP) | \
3640f87b00dSSteve Price	$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3650d3b8ac4SRuslan Ermilov		print $$0 }' | $(DBLOAD) -i $(NETGROUP) \
3661754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
367b2264be8SBill Paul	@$(DBLOAD) -c
368778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
369778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
37013170f18SBill Paul.endif
371778c7b1cSBill Paul
372778c7b1cSBill Paul
373778c7b1cSBill Paulnetgroup.byuser: $(NETGROUP)
374778c7b1cSBill Paul	@echo "Updating $@..."
37513170f18SBill Paul.if ${NETGROUP} == "/dev/null"
37613170f18SBill Paul	@echo "Netgroup source file not found -- skipping"
37713170f18SBill Paul.else
3780d3b8ac4SRuslan Ermilov	@$(REVNETGROUP) -u -f $(NETGROUP) | \
3790f87b00dSSteve Price	$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3800d3b8ac4SRuslan Ermilov		print $$0 }' | $(DBLOAD) -i $(NETGROUP) \
3811754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
382b2264be8SBill Paul	@$(DBLOAD) -c
383778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
384778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
38513170f18SBill Paul.endif
386778c7b1cSBill Paul
387778c7b1cSBill Paul
3884ba79bb4SHajimu UMEMOTO# Solaris 8 does the following:
3894ba79bb4SHajimu UMEMOTO# - /etc/hosts and hosts.{byname,byaddr} are IPv4 only.
3904ba79bb4SHajimu UMEMOTO# - /etc/inet/ipnodes and ipnodes.{byname,byaddr} are used for protocol
3914ba79bb4SHajimu UMEMOTO#   independent name-to-address mapping.
3924ba79bb4SHajimu UMEMOTO#
3934ba79bb4SHajimu UMEMOTO# For local name resolution, we made /etc/hosts protocol independent.
3944ba79bb4SHajimu UMEMOTO# For NIS name resolution, we obey Solaris 8 practice.
3954ba79bb4SHajimu UMEMOTO# - We keep hosts.{byname,byaddr} IPv4 only, to be friendly with Solaris 8
3964ba79bb4SHajimu UMEMOTO#   clients.
3974ba79bb4SHajimu UMEMOTO# - ipnodes.{byname,byaddr} is used for protocol independent mapping.
398*00022bd0SHajimu UMEMOTO# We generate all the mappings from /etc/hosts unless /var/yp/ipnodes
399*00022bd0SHajimu UMEMOTO# exists, for compatibility with FreeBSD local name resolution.
4004ba79bb4SHajimu UMEMOTO#
401778c7b1cSBill Paulhosts.byname: $(HOSTS)
402778c7b1cSBill Paul	@echo "Updating $@..."
4034ba79bb4SHajimu 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 $@..."
4134ba79bb4SHajimu 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	@$(AWK) '/^[0-9a-fA-F:]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \
424a89e588cSHajimu UMEMOTO		print $$n"\t"$$0 }' $(IPNODES) | $(DBLOAD) ${B} -i $(IPNODES)  \
425a89e588cSHajimu UMEMOTO		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
426a89e588cSHajimu UMEMOTO	@$(DBLOAD) -c
427a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
428a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
429a89e588cSHajimu UMEMOTO
430a89e588cSHajimu UMEMOTO
431a89e588cSHajimu UMEMOTOipnodes.byaddr: $(IPNODES)
432a89e588cSHajimu UMEMOTO	@echo "Updating $@..."
433a89e588cSHajimu UMEMOTO	@$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $(IPNODES) \
434a89e588cSHajimu UMEMOTO		| $(DBLOAD) ${B} -i $(IPNODES) -o $(YPMAPDIR)/$@ - $(TMP); \
435a89e588cSHajimu UMEMOTO		$(RMV) $(TMP) $@
436a89e588cSHajimu UMEMOTO	@$(DBLOAD) -c
437a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
438a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
439a89e588cSHajimu UMEMOTO
440a89e588cSHajimu UMEMOTO
441778c7b1cSBill Paulnetworks.byname: $(NETWORKS)
442778c7b1cSBill Paul	@echo "Updating $@..."
4430d3b8ac4SRuslan Ermilov	@$(AWK) \
4440f87b00dSSteve Price	   '$$1 !~ "^#.*"  { print $$1"\t"$$0; \
4450f87b00dSSteve Price			  for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
446778c7b1cSBill Paul			      print $$n"\t"$$0 \
4470d3b8ac4SRuslan Ermilov		}' $(NETWORKS) \
4480d3b8ac4SRuslan Ermilov		| $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \
4491754677bSBill Paul		$(RMV) $(TMP) $@
450b2264be8SBill Paul	@$(DBLOAD) -c
451778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
452778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
453778c7b1cSBill Paul
454778c7b1cSBill Paul
455778c7b1cSBill Paulnetworks.byaddr: $(NETWORKS)
456778c7b1cSBill Paul	@echo "Updating $@..."
4570d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(NETWORKS) \
4581754677bSBill Paul		| $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \
4591754677bSBill Paul		$(RMV) $(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 Paulprotocols.byname: $(PROTOCOLS)
466778c7b1cSBill Paul	@echo "Updating $@..."
4670d3b8ac4SRuslan Ermilov	@$(AWK) \
4680f87b00dSSteve Price	   '$$1 !~ "^#.*"	{ print $$1"\t"$$0; \
4690f87b00dSSteve Price			  for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
470778c7b1cSBill Paul			      print $$n"\t"$$0 \
4710d3b8ac4SRuslan Ermilov			}' $(PROTOCOLS) | $(DBLOAD) -i $(PROTOCOLS) \
4721754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(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 Paulprotocols.bynumber: $(PROTOCOLS)
479778c7b1cSBill Paul	@echo "Updating $@..."
4800d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(PROTOCOLS) \
4811754677bSBill Paul		| $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP); \
4821754677bSBill Paul		$(RMV) $(TMP) $@
483b2264be8SBill Paul	@$(DBLOAD) -c
484778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
485778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
486778c7b1cSBill Paul
487778c7b1cSBill Paul
488778c7b1cSBill Paulrpc.byname: $(RPC)
489778c7b1cSBill Paul	@echo "Updating $@..."
4900d3b8ac4SRuslan Ermilov	@$(AWK) \
4910f87b00dSSteve Price	   '$$1 !~ "^#.*"  { print $$1"\t"$$0; \
4920f87b00dSSteve Price			  for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
493778c7b1cSBill Paul			      print $$n"\t"$$0 \
4940d3b8ac4SRuslan Ermilov		}' $(RPC) | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \
4951754677bSBill Paul		$(RMV) $(TMP) $@
496b2264be8SBill Paul	@$(DBLOAD) -c
497778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
498778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
499778c7b1cSBill Paul
500778c7b1cSBill Paul
501778c7b1cSBill Paulrpc.bynumber: $(RPC)
502778c7b1cSBill Paul	@echo "Updating $@..."
5030d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(RPC) \
5041754677bSBill Paul		| $(DBLOAD)  -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \
5051754677bSBill Paul		$(RMV) $(TMP) $@
506b2264be8SBill Paul	@$(DBLOAD) -c
507778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
508778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
509778c7b1cSBill Paul
510778c7b1cSBill Paul
511778c7b1cSBill Paulservices.byname: $(SERVICES)
512778c7b1cSBill Paul	@echo "Updating $@..."
5130d3b8ac4SRuslan Ermilov	@$(AWK) \
5140f87b00dSSteve Price	   '$$1 !~ "^#.*"  { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \
515f44298dfSBill Paul				if (split($$2, t, "/")) { \
516f44298dfSBill Paul					printf("%s/%s", $$n, t[2]) }; \
5179ac2a83aSBill Paul					print "\t"$$0;	\
51888b4ff3cSPeter Wemm					if (n == 1) n = 2; \
51988b4ff3cSPeter Wemm			   } ; print $$2"\t"$$0 ; \
5200d3b8ac4SRuslan Ermilov		}' $(SERVICES) \
5210d3b8ac4SRuslan Ermilov		| $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \
5221754677bSBill Paul		$(RMV) $(TMP) $@
523b2264be8SBill Paul	@$(DBLOAD) -c
524778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
525778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
526778c7b1cSBill Paul
5277d2155f0SMaxim Konovalovshells: $(SHELLS)
52880fc33c3SRobert Drehmel	@echo "Updating $@..."
5290d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \
5300d3b8ac4SRuslan Ermilov		$(SHELLS) \
5310d3b8ac4SRuslan Ermilov		| $(DBLOAD) -i $(SHELLS) -o $(YPMAPDIR)/$@ - $(TMP); \
53280fc33c3SRobert Drehmel	 $(RMV) $(TMP) $@
53380fc33c3SRobert Drehmel	@$(DBLOAD) -c
53480fc33c3SRobert Drehmel	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
53580fc33c3SRobert Drehmel	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
536778c7b1cSBill Paul
537778c7b1cSBill Paulpublickey.byname: $(PUBLICKEY)
538778c7b1cSBill Paul	@echo "Updating $@..."
53913170f18SBill Paul.if ${PUBLICKEY} == "/dev/null"
54013170f18SBill Paul	@echo "Publickey source file not found -- skipping"
54113170f18SBill Paul.else
5420d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $(PUBLICKEY) \
5431754677bSBill Paul		| $(DBLOAD)  -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \
5441754677bSBill Paul		$(RMV) $(TMP) $@
545b2264be8SBill Paul	@$(DBLOAD) -c
546778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
547778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
54813170f18SBill Paul.endif
549778c7b1cSBill Paul
550778c7b1cSBill Paul
551778c7b1cSBill Paul$(PASSWD): $(MASTER)
552778c7b1cSBill Paul	@echo "Creating new $@ file from $(MASTER)..."
553778c7b1cSBill Paul	@if [ ! $(UNSECURE) ]; then \
55403806e0dSBrian Somers	$(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5550d3b8ac4SRuslan Ermilov		print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \
556778c7b1cSBill Paul		> $(PASSWD) ; \
5570d3b8ac4SRuslan Ermilov	else \
55803806e0dSBrian Somers	$(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5590d3b8ac4SRuslan Ermilov		print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \
560778c7b1cSBill Paul		> $(PASSWD) ; fi
561778c7b1cSBill Paul
562778c7b1cSBill Paul
563778c7b1cSBill Paulpasswd.byname: $(PASSWD)
564778c7b1cSBill Paul	@echo "Updating $@..."
5650d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5660d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(PASSWD) \
567b22e036eSBill Paul		| $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
5681754677bSBill Paul		$(RMV) $(TMP) $@
569b2264be8SBill Paul	@$(DBLOAD) -c
570778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
571778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
572778c7b1cSBill Paul
573b2264be8SBill Paul
574778c7b1cSBill Paulpasswd.byuid: $(PASSWD)
575778c7b1cSBill Paul	@echo "Updating $@..."
5760d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5770d3b8ac4SRuslan Ermilov		print $$3"\t"$$0 }' $(PASSWD) \
578b22e036eSBill Paul		| $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
5791754677bSBill Paul		$(RMV) $(TMP) $@
580b2264be8SBill Paul	@$(DBLOAD) -c
581778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
582778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
583778c7b1cSBill Paul
584778c7b1cSBill Paul
585778c7b1cSBill Paulgroup.byname: $(GROUP)
586778c7b1cSBill Paul	@echo "Updating $@..."
5870d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5880d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(GROUP) \
589b22e036eSBill Paul		| $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
5901754677bSBill Paul		$(RMV) $(TMP) $@
591b2264be8SBill Paul	@$(DBLOAD) -c
592778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
593778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
594778c7b1cSBill Paul
595778c7b1cSBill Paul
596778c7b1cSBill Paulgroup.bygid: $(GROUP)
597778c7b1cSBill Paul	@echo "Updating $@..."
5980d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5990d3b8ac4SRuslan Ermilov		print $$3"\t"$$0 }' $(GROUP) \
600b22e036eSBill Paul		| $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
6011754677bSBill Paul		$(RMV) $(TMP) $@
602b2264be8SBill Paul	@$(DBLOAD) -c
603778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
604778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
605778c7b1cSBill Paul
606778c7b1cSBill Paul
607f2a3dfe5SRuslan Ermilovnetid.byname: $(GROUP) $(PASSWD) $(HOSTS)
608778c7b1cSBill Paul	@echo "Updating $@..."
6091fe3e67aSBill Paul	@$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \
6101754677bSBill Paul		-d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \
6111754677bSBill Paul		$(RMV) $(TMP) $@
612b2264be8SBill Paul	@$(DBLOAD) -c
613778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
614778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
615778c7b1cSBill Paul
616778c7b1cSBill Paul
617778c7b1cSBill Paulmaster.passwd.byname: $(MASTER)
618778c7b1cSBill Paul	@echo "Updating $@..."
61913170f18SBill Paul.if ${MASTER} == "/dev/null"
62013170f18SBill Paul	@echo "Master.passwd source file not found -- skipping"
62113170f18SBill Paul.else
6220d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
6230d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(MASTER) \
624b22e036eSBill Paul		| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
6251754677bSBill Paul		$(RMV) $(TMP) $@
626b2264be8SBill Paul	@$(DBLOAD) -c
627778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
628778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
62913170f18SBill Paul.endif
630778c7b1cSBill Paul
631778c7b1cSBill Paul
632778c7b1cSBill Paulmaster.passwd.byuid: $(MASTER)
633778c7b1cSBill Paul	@echo "Updating $@..."
63413170f18SBill Paul.if ${MASTER} == "/dev/null"
63513170f18SBill Paul	@echo "Master.passwd source file not found -- skipping"
63613170f18SBill Paul.else
6370d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
6380d3b8ac4SRuslan Ermilov		print $$3"\t"$$0 }' $(MASTER) \
639b22e036eSBill Paul		| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
6401754677bSBill Paul		$(RMV) $(TMP) $@
641b2264be8SBill Paul	@$(DBLOAD) -c
642778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
643778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
64413170f18SBill Paul.endif
64513170f18SBill Paul
64657948c0bSPeter Wemm
64753c40578SBrian Somersshadow.byname: $(MASTER)
64853c40578SBrian Somers	@echo "Updating $@..."
64953c40578SBrian Somers.if ${MASTER} == "/dev/null"
65053c40578SBrian Somers	@echo "Master.passwd source file not found -- skipping"
65153c40578SBrian Somers.else
65253c40578SBrian Somers	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
65353c40578SBrian Somers		print $$1"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \
65453c40578SBrian Somers		| sed 's/\(	[^:]*:\)\*:/\1!:/' \
65553c40578SBrian Somers		| $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
65653c40578SBrian Somers		$(RMV) $(TMP) $@
65753c40578SBrian Somers	@$(DBLOAD) -c
65853c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
65953c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
66053c40578SBrian Somers.endif
66153c40578SBrian Somers
66253c40578SBrian Somersshadow.byuid: $(MASTER)
66353c40578SBrian Somers	@echo "Updating $@..."
66453c40578SBrian Somers.if ${MASTER} == "/dev/null"
66553c40578SBrian Somers	@echo "Master.passwd source file not found -- skipping"
66653c40578SBrian Somers.else
66753c40578SBrian Somers	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
66853c40578SBrian Somers		print $$3"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \
66953c40578SBrian Somers		| sed 's/\(	[^:]*:\)\*:/\1!:/' \
67053c40578SBrian Somers		| $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
67153c40578SBrian Somers		$(RMV) $(TMP) $@
67253c40578SBrian Somers	@$(DBLOAD) -c
67353c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
67453c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
67553c40578SBrian Somers.endif
67653c40578SBrian Somers
6773b056022SMark Murrayamd.map: $(AMDHOST)
67857948c0bSPeter Wemm	@echo "Updating $@..."
6790d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*"  { \
68057948c0bSPeter Wemm	  for (i = 1; i <= NF; i++) \
68157948c0bSPeter Wemm	  if (i == NF) { \
68257948c0bSPeter Wemm	    if (substr($$i, length($$i), 1) == "\\") \
68357948c0bSPeter Wemm	      printf("%s", substr($$i, 1, length($$i) - 1)); \
68457948c0bSPeter Wemm	    else \
68557948c0bSPeter Wemm	      printf("%s\n", $$i); \
68657948c0bSPeter Wemm	  } \
68757948c0bSPeter Wemm	  else \
68857948c0bSPeter Wemm	    printf("%s ", $$i); \
6890d3b8ac4SRuslan Ermilov	}' $(AMDHOST) | \
6901754677bSBill Paul	$(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP); \
6911754677bSBill Paul		$(RMV) $(TMP) $@
69257948c0bSPeter Wemm	@$(DBLOAD) -c
69357948c0bSPeter Wemm	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
69457948c0bSPeter Wemm	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
695