xref: /freebsd/usr.sbin/ypserv/Makefile.yp (revision 53c405786b1cdc318bb35b9cf1e2fe6e4bcdee57)
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)
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
14313170f18SBill Paul#TARGETS+= aliases
14413170f18SBill Paul
14513170f18SBill Paul# Sanity checks: filter out targets we can't build
14613170f18SBill Paul# Note that we don't build the ethers or boorparams maps by default
14713170f18SBill Paul# since /etc/ethers and /etc/bootparams are not likely to be present
14813170f18SBill Paul# on all systems.
14913170f18SBill Paul.if exists($(ETHERS))
15013170f18SBill PaulTARGETS+= ethers
15113170f18SBill Paul.else
15213170f18SBill PaulETHERS= /dev/null
15313170f18SBill Paul.endif
15413170f18SBill Paul
15513170f18SBill Paul.if exists($(BOOTPARAMS))
15613170f18SBill PaulTARGETS+= bootparams
15713170f18SBill Paul.else
15813170f18SBill PaulBOOTPARAMS= /dev/null
15913170f18SBill Paul.endif
16013170f18SBill Paul
16113170f18SBill Paul.if exists($(NETGROUP))
16213170f18SBill PaulTARGETS+= netgrp
16313170f18SBill Paul.else
16413170f18SBill PaulNETGROUP= /dev/null
16513170f18SBill Paul.endif
16613170f18SBill Paul
16713170f18SBill Paul.if exists($(MASTER))
16813170f18SBill PaulTARGETS+= passwd master.passwd netid
16953c40578SBrian Somers.if ${SHADOW} == "\"True\""
17053c40578SBrian SomersTARGETS+= shadow
17153c40578SBrian Somers.endif
17213170f18SBill Paul.else
17313170f18SBill PaulMASTER= /dev/null
17413170f18SBill PaulTARGETS+= nopass
17513170f18SBill Paul.endif
17613170f18SBill Paul
17713170f18SBill Paul.if exists($(PUBLICKEY))
17813170f18SBill PaulTARGETS+= publickey
17913170f18SBill Paul.else
18013170f18SBill PaulPUBLICKEY= /dev/null
18113170f18SBill Paul.endif
18213170f18SBill Paul
18313170f18SBill Paul.if exists($(AMDHOST))
1843b056022SMark MurrayTARGETS+= amd.map
18513170f18SBill Paul.else
18613170f18SBill PaulAMDHOST= /dev/null
18713170f18SBill Paul.endif
18813170f18SBill Paul
189a89e588cSHajimu UMEMOTO.if exists($(IPNODES))
190a89e588cSHajimu UMEMOTOTARGETS+= ipnodes
191a89e588cSHajimu UMEMOTO.else
192a89e588cSHajimu UMEMOTOIPNODES= /dev/null
193a89e588cSHajimu UMEMOTO.endif
194a89e588cSHajimu UMEMOTO
19513170f18SBill Paulall: $(TARGETS)
196778c7b1cSBill Paul
197778c7b1cSBill Paulethers:	   ethers.byname ethers.byaddr
198778c7b1cSBill Paulbootparam: bootparams
199778c7b1cSBill Paulhosts:	   hosts.byname hosts.byaddr
200a89e588cSHajimu UMEMOTOipnodes:   ipnodes.byname ipnodes.byaddr
201778c7b1cSBill Paulnetworks:  networks.byaddr networks.byname
202778c7b1cSBill Paulprotocols: protocols.bynumber protocols.byname
203778c7b1cSBill Paulrpc:	   rpc.byname rpc.bynumber
204778c7b1cSBill Paulservices:  services.byname
205778c7b1cSBill Paulpasswd:    passwd.byname passwd.byuid
20653c40578SBrian Somersshadow:    shadow.byname shadow.byuid
207778c7b1cSBill Paulgroup:     group.byname group.bygid
208778c7b1cSBill Paulnetgrp:    netgroup
209778c7b1cSBill Paulnetid:	   netid.byname
210778c7b1cSBill Paulservers:   ypservers
211778c7b1cSBill Paulpublickey: publickey.byname
212b2264be8SBill Paulaliases:   mail.aliases
213778c7b1cSBill Paul
214778c7b1cSBill Paulmaster.passwd:	master.passwd.byname master.passwd.byuid
215778c7b1cSBill Paul
216b3e93234SBill Paul#
217b3e93234SBill Paul# This is a special target used only when doing in-place updates with
218b3e93234SBill Paul# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd
219b3e93234SBill Paul# server and won't need to be remade. They will have to be pushed to the
220b3e93234SBill Paul# slaves however. Calling this target implicitly insures that this will
221b3e93234SBill Paul# happen.
222b3e93234SBill Paul#
223b3e93234SBill Paulpushpw:
224b3e93234SBill Paul	@$(DBLOAD) -c
225b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi
226b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi
22753c40578SBrian Somers.if ${SHADOW} == "\"True\""
22853c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byname ; fi
22953c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byuid ; fi
23053c40578SBrian Somers.endif
231b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi
232b3e93234SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi
233b3e93234SBill Paul
23413170f18SBill Paulpushmap:
23513170f18SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi
23613170f18SBill Paul
23713170f18SBill Paulnopass:
23813170f18SBill Paul	@echo ""
23913170f18SBill Paul	@echo "                ********WARNING********"
24013170f18SBill Paul	@echo "  Couldn't find the master.passwd source file. This file"
24113170f18SBill Paul	@echo "  is needed to generate the master.passwd and passwd maps."
24213170f18SBill Paul	@echo "  The default location is /var/yp/master.passwd. You should"
24313170f18SBill Paul	@echo "  edit /var/yp/Makefile and set the MASTER variable to point"
24413170f18SBill Paul	@echo "  to the source file you wish to use for building the passwd"
24513170f18SBill Paul	@echo "  maps, or else invoke make(1) in the following manner:"
24681d30297SNick Hibma	@echo ""
24713170f18SBill Paul	@echo "        make MASTER_PASSWD=/path/to/master.passwd"
24813170f18SBill Paul	@echo ""
24913170f18SBill Paul
250b2264be8SBill Paulmail.aliases: $(ALIASES)
251b2264be8SBill Paul	@echo "Updating $@..."
252de88f160SAdam David	@$(NEWALIASES) -oA$(ALIASES)
253d91013b5SAdam David	@$(MKDB) -u $(ALIASES).db \
2541754677bSBill Paul		| $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \
2551754677bSBill Paul		$(RMV) $(TMP) $@
256b2264be8SBill Paul	@$(DBLOAD) -c
257b2264be8SBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
258b2264be8SBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
259b2264be8SBill Paul
260778c7b1cSBill Paul
261778c7b1cSBill Paulypservers: $(YPSERVERS)
262778c7b1cSBill Paul	@echo "Updating $@..."
2630d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \
2640d3b8ac4SRuslan Ermilov		$(YPSERVERS) \
2651754677bSBill Paul		| $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \
2661754677bSBill Paul		$(RMV) $(TMP) $@
267b2264be8SBill Paul	@$(DBLOAD) -c
268778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
269778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
270778c7b1cSBill Paul
271778c7b1cSBill Paulethers.byname: $(ETHERS)
272778c7b1cSBill Paul	@echo "Updating $@..."
27313170f18SBill Paul.if ${ETHERS} == "/dev/null"
27413170f18SBill Paul	@echo "Ethers source file not found -- skipping"
27513170f18SBill Paul.else
2760d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
2770d3b8ac4SRuslan Ermilov		print $$2"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \
2781754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
279b2264be8SBill Paul	@$(DBLOAD) -c
280a6dbeb65SPeter Wemm	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
281778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
28213170f18SBill Paul.endif
283778c7b1cSBill Paul
284778c7b1cSBill Paulethers.byaddr: $(ETHERS)
285778c7b1cSBill Paul	@echo "Updating $@..."
28613170f18SBill Paul.if ${ETHERS} == "/dev/null"
28713170f18SBill Paul	@echo "Ethers source file not found -- skipping"
28813170f18SBill Paul.else
2890d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
2900d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \
2911754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
292b2264be8SBill Paul	@$(DBLOAD) -c
293778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
294778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
29513170f18SBill Paul.endif
296778c7b1cSBill Paul
297778c7b1cSBill Paul
298778c7b1cSBill Paulbootparams: $(BOOTPARAMS)
299778c7b1cSBill Paul	@echo "Updating $@..."
30013170f18SBill Paul.if ${BOOTPARAMS} == "/dev/null"
30113170f18SBill Paul	@echo "Bootparams source file not found -- skipping"
30213170f18SBill Paul.else
3030d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3040d3b8ac4SRuslan Ermilov		print $$0 }' $(BOOTPARAMS) | $(DBLOAD) -i $(BOOTPARAMS) \
3051754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
306b2264be8SBill Paul	@$(DBLOAD) -c
307778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
308778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
30913170f18SBill Paul.endif
310778c7b1cSBill Paul
311778c7b1cSBill Paul
312778c7b1cSBill Paulnetgroup: $(NETGROUP) netgroup.byhost netgroup.byuser
313778c7b1cSBill Paul	@echo "Updating $@..."
31413170f18SBill Paul.if ${NETGROUP} == "/dev/null"
31513170f18SBill Paul	@echo "Netgroup source file not found -- skipping"
31613170f18SBill Paul.else
3170d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3180d3b8ac4SRuslan Ermilov		print $$0 }' $(NETGROUP) | $(DBLOAD) -i $(NETGROUP) \
3191754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
320b2264be8SBill Paul	@$(DBLOAD) -c
321778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
322778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
32313170f18SBill Paul.endif
324778c7b1cSBill Paul
325778c7b1cSBill Paul
326778c7b1cSBill Paulnetgroup.byhost: $(NETGROUP)
327778c7b1cSBill Paul	@echo "Updating $@..."
32813170f18SBill Paul.if ${NETGROUP} == "/dev/null"
32913170f18SBill Paul	@echo "Netgroup source file not found -- skipping"
33013170f18SBill Paul.else
3310d3b8ac4SRuslan Ermilov	@$(REVNETGROUP) -h -f $(NETGROUP) | \
3320f87b00dSSteve Price	$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3330d3b8ac4SRuslan Ermilov		print $$0 }' | $(DBLOAD) -i $(NETGROUP) \
3341754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
335b2264be8SBill Paul	@$(DBLOAD) -c
336778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
337778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
33813170f18SBill Paul.endif
339778c7b1cSBill Paul
340778c7b1cSBill Paul
341778c7b1cSBill Paulnetgroup.byuser: $(NETGROUP)
342778c7b1cSBill Paul	@echo "Updating $@..."
34313170f18SBill Paul.if ${NETGROUP} == "/dev/null"
34413170f18SBill Paul	@echo "Netgroup source file not found -- skipping"
34513170f18SBill Paul.else
3460d3b8ac4SRuslan Ermilov	@$(REVNETGROUP) -u -f $(NETGROUP) | \
3470f87b00dSSteve Price	$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
3480d3b8ac4SRuslan Ermilov		print $$0 }' | $(DBLOAD) -i $(NETGROUP) \
3491754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
350b2264be8SBill Paul	@$(DBLOAD) -c
351778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
352778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
35313170f18SBill Paul.endif
354778c7b1cSBill Paul
355778c7b1cSBill Paul
356778c7b1cSBill Paulhosts.byname: $(HOSTS)
357778c7b1cSBill Paul	@echo "Updating $@..."
3580d3b8ac4SRuslan Ermilov	@$(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \
3590d3b8ac4SRuslan Ermilov		print $$n"\t"$$0 }' $(HOSTS) | $(DBLOAD) ${B} -i $(HOSTS)  \
3601754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
361b2264be8SBill Paul	@$(DBLOAD) -c
362778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
363778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
364778c7b1cSBill Paul
365b2264be8SBill Paul
366778c7b1cSBill Paulhosts.byaddr: $(HOSTS)
367778c7b1cSBill Paul	@echo "Updating $@..."
3680d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $(HOSTS) \
3691754677bSBill Paul		| $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP); \
3701754677bSBill Paul		$(RMV) $(TMP) $@
371b2264be8SBill Paul	@$(DBLOAD) -c
372778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
373778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
374778c7b1cSBill Paul
375778c7b1cSBill Paul
376a89e588cSHajimu UMEMOTOipnodes.byname: $(IPNODES)
377a89e588cSHajimu UMEMOTO	@echo "Updating $@..."
378a89e588cSHajimu UMEMOTO.if ${IPNODES} == "/dev/null"
379a89e588cSHajimu UMEMOTO	@echo "Ipnodes source file not found -- skipping"
380a89e588cSHajimu UMEMOTO.else
381a89e588cSHajimu UMEMOTO	@$(AWK) '/^[0-9a-fA-F:]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \
382a89e588cSHajimu UMEMOTO		print $$n"\t"$$0 }' $(IPNODES) | $(DBLOAD) ${B} -i $(IPNODES)  \
383a89e588cSHajimu UMEMOTO		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
384a89e588cSHajimu UMEMOTO	@$(DBLOAD) -c
385a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
386a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
387a89e588cSHajimu UMEMOTO.endif
388a89e588cSHajimu UMEMOTO
389a89e588cSHajimu UMEMOTO
390a89e588cSHajimu UMEMOTOipnodes.byaddr: $(IPNODES)
391a89e588cSHajimu UMEMOTO	@echo "Updating $@..."
392a89e588cSHajimu UMEMOTO.if ${IPNODES} == "/dev/null"
393a89e588cSHajimu UMEMOTO	@echo "Ipnodes source file not found -- skipping"
394a89e588cSHajimu UMEMOTO.else
395a89e588cSHajimu UMEMOTO	@$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $(IPNODES) \
396a89e588cSHajimu UMEMOTO		| $(DBLOAD) ${B} -i $(IPNODES) -o $(YPMAPDIR)/$@ - $(TMP); \
397a89e588cSHajimu UMEMOTO		$(RMV) $(TMP) $@
398a89e588cSHajimu UMEMOTO	@$(DBLOAD) -c
399a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
400a89e588cSHajimu UMEMOTO	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
401a89e588cSHajimu UMEMOTO.endif
402a89e588cSHajimu UMEMOTO
403a89e588cSHajimu UMEMOTO
404778c7b1cSBill Paulnetworks.byname: $(NETWORKS)
405778c7b1cSBill Paul	@echo "Updating $@..."
4060d3b8ac4SRuslan Ermilov	@$(AWK) \
4070f87b00dSSteve Price	   '$$1 !~ "^#.*"  { print $$1"\t"$$0; \
4080f87b00dSSteve Price			  for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
409778c7b1cSBill Paul			      print $$n"\t"$$0 \
4100d3b8ac4SRuslan Ermilov		}' $(NETWORKS) \
4110d3b8ac4SRuslan Ermilov		| $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \
4121754677bSBill Paul		$(RMV) $(TMP) $@
413b2264be8SBill Paul	@$(DBLOAD) -c
414778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
415778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
416778c7b1cSBill Paul
417778c7b1cSBill Paul
418778c7b1cSBill Paulnetworks.byaddr: $(NETWORKS)
419778c7b1cSBill Paul	@echo "Updating $@..."
4200d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(NETWORKS) \
4211754677bSBill Paul		| $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \
4221754677bSBill Paul		$(RMV) $(TMP) $@
423b2264be8SBill Paul	@$(DBLOAD) -c
424778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
425778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
426778c7b1cSBill Paul
427778c7b1cSBill Paul
428778c7b1cSBill Paulprotocols.byname: $(PROTOCOLS)
429778c7b1cSBill Paul	@echo "Updating $@..."
4300d3b8ac4SRuslan Ermilov	@$(AWK) \
4310f87b00dSSteve Price	   '$$1 !~ "^#.*"	{ print $$1"\t"$$0; \
4320f87b00dSSteve Price			  for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
433778c7b1cSBill Paul			      print $$n"\t"$$0 \
4340d3b8ac4SRuslan Ermilov			}' $(PROTOCOLS) | $(DBLOAD) -i $(PROTOCOLS) \
4351754677bSBill Paul		-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(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
440778c7b1cSBill Paul
441778c7b1cSBill Paulprotocols.bynumber: $(PROTOCOLS)
442778c7b1cSBill Paul	@echo "Updating $@..."
4430d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(PROTOCOLS) \
4441754677bSBill Paul		| $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP); \
4451754677bSBill Paul		$(RMV) $(TMP) $@
446b2264be8SBill Paul	@$(DBLOAD) -c
447778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
448778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
449778c7b1cSBill Paul
450778c7b1cSBill Paul
451778c7b1cSBill Paulrpc.byname: $(RPC)
452778c7b1cSBill Paul	@echo "Updating $@..."
4530d3b8ac4SRuslan Ermilov	@$(AWK) \
4540f87b00dSSteve Price	   '$$1 !~ "^#.*"  { print $$1"\t"$$0; \
4550f87b00dSSteve Price			  for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
456778c7b1cSBill Paul			      print $$n"\t"$$0 \
4570d3b8ac4SRuslan Ermilov		}' $(RPC) | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \
4581754677bSBill Paul		$(RMV) $(TMP) $@
459b2264be8SBill Paul	@$(DBLOAD) -c
460778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
461778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
462778c7b1cSBill Paul
463778c7b1cSBill Paul
464778c7b1cSBill Paulrpc.bynumber: $(RPC)
465778c7b1cSBill Paul	@echo "Updating $@..."
4660d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(RPC) \
4671754677bSBill Paul		| $(DBLOAD)  -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \
4681754677bSBill Paul		$(RMV) $(TMP) $@
469b2264be8SBill Paul	@$(DBLOAD) -c
470778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
471778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
472778c7b1cSBill Paul
473778c7b1cSBill Paul
474778c7b1cSBill Paulservices.byname: $(SERVICES)
475778c7b1cSBill Paul	@echo "Updating $@..."
4760d3b8ac4SRuslan Ermilov	@$(AWK) \
4770f87b00dSSteve Price	   '$$1 !~ "^#.*"  { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \
478f44298dfSBill Paul				if (split($$2, t, "/")) { \
479f44298dfSBill Paul					printf("%s/%s", $$n, t[2]) }; \
4809ac2a83aSBill Paul					print "\t"$$0;	\
48188b4ff3cSPeter Wemm					if (n == 1) n = 2; \
48288b4ff3cSPeter Wemm			   } ; print $$2"\t"$$0 ; \
4830d3b8ac4SRuslan Ermilov		}' $(SERVICES) \
4840d3b8ac4SRuslan Ermilov		| $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \
4851754677bSBill Paul		$(RMV) $(TMP) $@
486b2264be8SBill Paul	@$(DBLOAD) -c
487778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
488778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
489778c7b1cSBill Paul
4907d2155f0SMaxim Konovalovshells: $(SHELLS)
49180fc33c3SRobert Drehmel	@echo "Updating $@..."
4920d3b8ac4SRuslan Ermilov	@$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \
4930d3b8ac4SRuslan Ermilov		$(SHELLS) \
4940d3b8ac4SRuslan Ermilov		| $(DBLOAD) -i $(SHELLS) -o $(YPMAPDIR)/$@ - $(TMP); \
49580fc33c3SRobert Drehmel	 $(RMV) $(TMP) $@
49680fc33c3SRobert Drehmel	@$(DBLOAD) -c
49780fc33c3SRobert Drehmel	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
49880fc33c3SRobert Drehmel	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
499778c7b1cSBill Paul
500778c7b1cSBill Paulpublickey.byname: $(PUBLICKEY)
501778c7b1cSBill Paul	@echo "Updating $@..."
50213170f18SBill Paul.if ${PUBLICKEY} == "/dev/null"
50313170f18SBill Paul	@echo "Publickey source file not found -- skipping"
50413170f18SBill Paul.else
5050d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $(PUBLICKEY) \
5061754677bSBill Paul		| $(DBLOAD)  -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \
5071754677bSBill Paul		$(RMV) $(TMP) $@
508b2264be8SBill Paul	@$(DBLOAD) -c
509778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
510778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
51113170f18SBill Paul.endif
512778c7b1cSBill Paul
513778c7b1cSBill Paul
514778c7b1cSBill Paul$(PASSWD): $(MASTER)
515778c7b1cSBill Paul	@echo "Creating new $@ file from $(MASTER)..."
516778c7b1cSBill Paul	@if [ ! $(UNSECURE) ]; then \
51703806e0dSBrian Somers	$(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5180d3b8ac4SRuslan Ermilov		print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \
519778c7b1cSBill Paul		> $(PASSWD) ; \
5200d3b8ac4SRuslan Ermilov	else \
52103806e0dSBrian Somers	$(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5220d3b8ac4SRuslan Ermilov		print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \
523778c7b1cSBill Paul		> $(PASSWD) ; fi
524778c7b1cSBill Paul
525778c7b1cSBill Paul
526778c7b1cSBill Paulpasswd.byname: $(PASSWD)
527778c7b1cSBill Paul	@echo "Updating $@..."
5280d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5290d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(PASSWD) \
530b22e036eSBill Paul		| $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
5311754677bSBill Paul		$(RMV) $(TMP) $@
532b2264be8SBill Paul	@$(DBLOAD) -c
533778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
534778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
535778c7b1cSBill Paul
536b2264be8SBill Paul
537778c7b1cSBill Paulpasswd.byuid: $(PASSWD)
538778c7b1cSBill Paul	@echo "Updating $@..."
5390d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5400d3b8ac4SRuslan Ermilov		print $$3"\t"$$0 }' $(PASSWD) \
541b22e036eSBill Paul		| $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
5421754677bSBill Paul		$(RMV) $(TMP) $@
543b2264be8SBill Paul	@$(DBLOAD) -c
544778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
545778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
546778c7b1cSBill Paul
547778c7b1cSBill Paul
548778c7b1cSBill Paulgroup.byname: $(GROUP)
549778c7b1cSBill Paul	@echo "Updating $@..."
5500d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5510d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(GROUP) \
552b22e036eSBill Paul		| $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
5531754677bSBill Paul		$(RMV) $(TMP) $@
554b2264be8SBill Paul	@$(DBLOAD) -c
555778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
556778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
557778c7b1cSBill Paul
558778c7b1cSBill Paul
559778c7b1cSBill Paulgroup.bygid: $(GROUP)
560778c7b1cSBill Paul	@echo "Updating $@..."
5610d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5620d3b8ac4SRuslan Ermilov		print $$3"\t"$$0 }' $(GROUP) \
563b22e036eSBill Paul		| $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
5641754677bSBill Paul		$(RMV) $(TMP) $@
565b2264be8SBill Paul	@$(DBLOAD) -c
566778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
567778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
568778c7b1cSBill Paul
569778c7b1cSBill Paul
570f2a3dfe5SRuslan Ermilovnetid.byname: $(GROUP) $(PASSWD) $(HOSTS)
571778c7b1cSBill Paul	@echo "Updating $@..."
5721fe3e67aSBill Paul	@$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \
5731754677bSBill Paul		-d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \
5741754677bSBill Paul		$(RMV) $(TMP) $@
575b2264be8SBill Paul	@$(DBLOAD) -c
576778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
577778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
578778c7b1cSBill Paul
579778c7b1cSBill Paul
580778c7b1cSBill Paulmaster.passwd.byname: $(MASTER)
581778c7b1cSBill Paul	@echo "Updating $@..."
58213170f18SBill Paul.if ${MASTER} == "/dev/null"
58313170f18SBill Paul	@echo "Master.passwd source file not found -- skipping"
58413170f18SBill Paul.else
5850d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
5860d3b8ac4SRuslan Ermilov		print $$1"\t"$$0 }' $(MASTER) \
587b22e036eSBill Paul		| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
5881754677bSBill Paul		$(RMV) $(TMP) $@
589b2264be8SBill Paul	@$(DBLOAD) -c
590778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
591778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
59213170f18SBill Paul.endif
593778c7b1cSBill Paul
594778c7b1cSBill Paul
595778c7b1cSBill Paulmaster.passwd.byuid: $(MASTER)
596778c7b1cSBill Paul	@echo "Updating $@..."
59713170f18SBill Paul.if ${MASTER} == "/dev/null"
59813170f18SBill Paul	@echo "Master.passwd source file not found -- skipping"
59913170f18SBill Paul.else
6000d3b8ac4SRuslan Ermilov	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
6010d3b8ac4SRuslan Ermilov		print $$3"\t"$$0 }' $(MASTER) \
602b22e036eSBill Paul		| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
6031754677bSBill Paul		$(RMV) $(TMP) $@
604b2264be8SBill Paul	@$(DBLOAD) -c
605778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
606778c7b1cSBill Paul	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
60713170f18SBill Paul.endif
60813170f18SBill Paul
60957948c0bSPeter Wemm
61053c40578SBrian Somersshadow.byname: $(MASTER)
61153c40578SBrian Somers	@echo "Updating $@..."
61253c40578SBrian Somers.if ${MASTER} == "/dev/null"
61353c40578SBrian Somers	@echo "Master.passwd source file not found -- skipping"
61453c40578SBrian Somers.else
61553c40578SBrian Somers	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
61653c40578SBrian Somers		print $$1"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \
61753c40578SBrian Somers		| sed 's/\(	[^:]*:\)\*:/\1!:/' \
61853c40578SBrian Somers		| $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
61953c40578SBrian Somers		$(RMV) $(TMP) $@
62053c40578SBrian Somers	@$(DBLOAD) -c
62153c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
62253c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
62353c40578SBrian Somers.endif
62453c40578SBrian Somers
62553c40578SBrian Somersshadow.byuid: $(MASTER)
62653c40578SBrian Somers	@echo "Updating $@..."
62753c40578SBrian Somers.if ${MASTER} == "/dev/null"
62853c40578SBrian Somers	@echo "Master.passwd source file not found -- skipping"
62953c40578SBrian Somers.else
63053c40578SBrian Somers	@$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
63153c40578SBrian Somers		print $$3"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \
63253c40578SBrian Somers		| sed 's/\(	[^:]*:\)\*:/\1!:/' \
63353c40578SBrian Somers		| $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
63453c40578SBrian Somers		$(RMV) $(TMP) $@
63553c40578SBrian Somers	@$(DBLOAD) -c
63653c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
63753c40578SBrian Somers	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
63853c40578SBrian Somers.endif
63953c40578SBrian Somers
6403b056022SMark Murrayamd.map: $(AMDHOST)
64157948c0bSPeter Wemm	@echo "Updating $@..."
6420d3b8ac4SRuslan Ermilov	@$(AWK) '$$1 !~ "^#.*"  { \
64357948c0bSPeter Wemm	  for (i = 1; i <= NF; i++) \
64457948c0bSPeter Wemm	  if (i == NF) { \
64557948c0bSPeter Wemm	    if (substr($$i, length($$i), 1) == "\\") \
64657948c0bSPeter Wemm	      printf("%s", substr($$i, 1, length($$i) - 1)); \
64757948c0bSPeter Wemm	    else \
64857948c0bSPeter Wemm	      printf("%s\n", $$i); \
64957948c0bSPeter Wemm	  } \
65057948c0bSPeter Wemm	  else \
65157948c0bSPeter Wemm	    printf("%s ", $$i); \
6520d3b8ac4SRuslan Ermilov	}' $(AMDHOST) | \
6531754677bSBill Paul	$(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP); \
6541754677bSBill Paul		$(RMV) $(TMP) $@
65557948c0bSPeter Wemm	@$(DBLOAD) -c
65657948c0bSPeter Wemm	@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
65757948c0bSPeter Wemm	@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
658