1778c7b1cSBill Paul# 2778c7b1cSBill Paul# Makefile for the NIS databases 3778c7b1cSBill Paul# 43939bb66SPoul-Henning Kamp# $Id: Makefile.yp,v 1.24 1998/02/21 18:14:30 wpaul Exp $ 5778c7b1cSBill Paul# 6778c7b1cSBill Paul# This Makefile should only be run on the NIS master server of a domain. 7778c7b1cSBill Paul# All updated maps will be pushed to all NIS slave servers listed in the 8778c7b1cSBill Paul# /var/yp/ypservers file. Please make sure that the hostnames of all 9778c7b1cSBill Paul# NIS servers in your domain are listed in /var/yp/ypservers. 10778c7b1cSBill Paul# 11778c7b1cSBill Paul# This Makefile can be modified to support more NIS maps if desired. 12778c7b1cSBill Paul# 13778c7b1cSBill Paul 14778c7b1cSBill Paul# If this machine is an NIS master, comment out this next line so 15778c7b1cSBill Paul# that changes to the NIS maps can be propagated to the slave servers. 16778c7b1cSBill Paul# (By default we assume that we are only serving a small domain with 17778c7b1cSBill Paul# only one server.) 18778c7b1cSBill Paul# 19778c7b1cSBill PaulNOPUSH = "True" 20778c7b1cSBill Paul 21778c7b1cSBill Paul# If you want to use a FreeBSD NIS server to serve non-FreeBSD clients 22778c7b1cSBill Paul# (i.e. clients who expect the password field in the passwd maps to be 23778c7b1cSBill Paul# valid) then uncomment this line. This will cause $YPDIR/passwd to 24778c7b1cSBill Paul# be generated with valid password fields. This is insecure: FreeBSD 25778c7b1cSBill Paul# normally only serves the master.passwd maps (which have real encrypted 26778c7b1cSBill Paul# passwords in them) to the superuser on other FreeBSD machines, but 27778c7b1cSBill Paul# non-FreeBSD clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX, 28778c7b1cSBill Paul# etc...) will only work properly in 'unsecure' mode. 29778c7b1cSBill Paul# 30778c7b1cSBill Paul#UNSECURE = "True" 31778c7b1cSBill Paul 3244519760SBill Paul# The following line encodes the YP_INTERDOMAIN key into the hosts.byname 3344519760SBill Paul# and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve 3444519760SBill Paul# hosts not in the current domain. Commenting this line out will disable 3544519760SBill Paul# the DNS lookups. 3644519760SBill PaulB=-b 3744519760SBill Paul 3844519760SBill Paul# Normally, the master.passwd.* maps are guarded against access from 3944519760SBill Paul# non-privileged users. By commenting out the following line, the YP_SECURE 4044519760SBill Paul# key will be removed from these maps, allowing anyone to access them. 4144519760SBill PaulS=-s 4244519760SBill Paul 43778c7b1cSBill Paul# These are commands which this Makefile needs to properly rebuild the 44778c7b1cSBill Paul# NIS databases. Don't change these unless you have a good reason. Also 45778c7b1cSBill Paul# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary 46778c7b1cSBill Paul# and it'll break everything in sight. 47778c7b1cSBill Paul# 48778c7b1cSBill PaulAWK = /usr/bin/awk 49778c7b1cSBill PaulRM = @/bin/rm -f 50b2264be8SBill PaulMV = @/bin/mv -f 511754677bSBill PaulRMV = /bin/mv -f 52778c7b1cSBill PaulRCAT = /bin/cat 53778c7b1cSBill PaulCAT = @$(RCAT) 54778c7b1cSBill Paul 55de88f160SAdam DavidMKDB = /usr/sbin/yp_mkdb 56de88f160SAdam DavidDBLOAD = $(MKDB) -m `hostname` 57778c7b1cSBill PaulMKNETID = /usr/libexec/mknetid 58b2264be8SBill PaulNEWALIASES = /usr/bin/newaliases 591fff226dSBill PaulYPPUSH = /usr/sbin/yppush 60920491cfSBill Paul.if !defined(UPDATE_DOMAIN) 61778c7b1cSBill PaulDOMAIN = `/bin/domainname` 62920491cfSBill Paul.else 63920491cfSBill PaulDOMAIN = $(UPDATE_DOMAIN) 64920491cfSBill Paul.endif 65778c7b1cSBill PaulREVNETGROUP = /usr/libexec/revnetgroup 661754677bSBill PaulTMP = `echo $@.$$$$` 67778c7b1cSBill Paul 68de88f160SAdam David# It is advisable to create a separate directory to contain the 69de88f160SAdam David# source files used to generate your NIS maps. If you intend to 70b2264be8SBill Paul# support multiple domains, something like /src/dir/$DOMAIN 71b2264be8SBill Paul# would work well. 72778c7b1cSBill PaulYPSRCDIR = /etc 7313170f18SBill Paul.if !defined(YP_DIR) 74778c7b1cSBill PaulYPDIR = /var/yp 7513170f18SBill Paul.else 7613170f18SBill PaulYPDIR = $(YP_DIR) 7713170f18SBill Paul.endif 78778c7b1cSBill PaulYPMAPDIR = $(YPDIR)/$(DOMAIN) 79778c7b1cSBill Paul 80778c7b1cSBill Paul# These are the files from which the NIS databases are built. You may edit 81778c7b1cSBill Paul# these to taste in the event that you wish to keep your NIS source files 82778c7b1cSBill Paul# seperate from your NIS server's actual configuration files. Note that the 83778c7b1cSBill Paul# NIS passwd and master.passwd files are stored in /var/yp: the server's 84778c7b1cSBill Paul# real password database is not used by default. However, you may use 85778c7b1cSBill Paul# the real /etc/passwd and /etc/master.passwd files by: 86778c7b1cSBill Paul# 87778c7b1cSBill Paul# 883939bb66SPoul-Henning Kamp# - invoking yppasswdd with `-t /etc/master.passwd' (yppasswdd will do a 893939bb66SPoul-Henning Kamp# 'pwd_mkdb' as needed if /etc/master.passwd is thus specified). 90778c7b1cSBill Paul# - Specifying the location of the master.passwd file using the 91778c7b1cSBill Paul# MASTER_PASSWD variable, i.e.: 92778c7b1cSBill Paul# 93778c7b1cSBill Paul# # make MASTER_PASSWD=/path/to/some/other/master.passwd 94778c7b1cSBill Paul# 95778c7b1cSBill Paul# - (optionally): editing this Makefile to change the default location. 96778c7b1cSBill Paul# 97778c7b1cSBill Paul# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw 98778c7b1cSBill Paul# passwd file will be generated from the master.passwd file automagically. 99778c7b1cSBill Paul# 100778c7b1cSBill PaulETHERS = $(YPSRCDIR)/ethers # ethernet addresses (for rarpd) 101778c7b1cSBill PaulBOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd) 102778c7b1cSBill PaulHOSTS = $(YPSRCDIR)/hosts 103778c7b1cSBill PaulNETWORKS = $(YPSRCDIR)/networks 104778c7b1cSBill PaulPROTOCOLS = $(YPSRCDIR)/protocols 105778c7b1cSBill PaulRPC = $(YPSRCDIR)/rpc 106778c7b1cSBill PaulSERVICES = $(YPSRCDIR)/services 107778c7b1cSBill PaulGROUP = $(YPSRCDIR)/group 108b2264be8SBill PaulALIASES = $(YPSRCDIR)/aliases 109b2264be8SBill PaulNETGROUP = $(YPDIR)/netgroup 110778c7b1cSBill PaulPASSWD = $(YPDIR)/passwd 111778c7b1cSBill Paul.if !defined(MASTER_PASSWD) 112778c7b1cSBill PaulMASTER = $(YPDIR)/master.passwd 113778c7b1cSBill Paul.else 114778c7b1cSBill PaulMASTER = $(MASTER_PASSWD) 115778c7b1cSBill Paul.endif 116778c7b1cSBill PaulYPSERVERS = $(YPDIR)/ypservers # List of all NIS servers for a domain 117778c7b1cSBill PaulPUBLICKEY = $(YPSRCDIR)/publickey 1181fe3e67aSBill PaulNETID = $(YPSRCDIR)/netid 11957948c0bSPeter WemmAMDHOST = $(YPSRCDIR)/amd.host 120778c7b1cSBill Paul 12113170f18SBill Paul# List of maps that are always built. 12213170f18SBill Paul# If you want to omit some of them, feel free to comment 12313170f18SBill Paul# them out from this list. 12413170f18SBill PaulTARGETS= servers hosts networks protocols rpc services group 12513170f18SBill Paul#TARGETS+= aliases 12613170f18SBill Paul 12713170f18SBill Paul# Sanity checks: filter out targets we can't build 12813170f18SBill Paul# Note that we don't build the ethers or boorparams maps by default 12913170f18SBill Paul# since /etc/ethers and /etc/bootparams are not likely to be present 13013170f18SBill Paul# on all systems. 13113170f18SBill Paul.if exists($(ETHERS)) 13213170f18SBill PaulTARGETS+= ethers 13313170f18SBill Paul.else 13413170f18SBill PaulETHERS= /dev/null 13513170f18SBill Paul.endif 13613170f18SBill Paul 13713170f18SBill Paul.if exists($(BOOTPARAMS)) 13813170f18SBill PaulTARGETS+= bootparams 13913170f18SBill Paul.else 14013170f18SBill PaulBOOTPARAMS= /dev/null 14113170f18SBill Paul.endif 14213170f18SBill Paul 14313170f18SBill Paul.if exists($(NETGROUP)) 14413170f18SBill PaulTARGETS+= netgrp 14513170f18SBill Paul.else 14613170f18SBill PaulNETGROUP= /dev/null 14713170f18SBill Paul.endif 14813170f18SBill Paul 14913170f18SBill Paul.if exists($(MASTER)) 15013170f18SBill PaulTARGETS+= passwd master.passwd netid 15113170f18SBill Paul.else 15213170f18SBill PaulMASTER= /dev/null 15313170f18SBill PaulTARGETS+= nopass 15413170f18SBill Paul.endif 15513170f18SBill Paul 15613170f18SBill Paul.if exists($(PUBLICKEY)) 15713170f18SBill PaulTARGETS+= publickey 15813170f18SBill Paul.else 15913170f18SBill PaulPUBLICKEY= /dev/null 16013170f18SBill Paul.endif 16113170f18SBill Paul 16213170f18SBill Paul.if exists($(AMDHOST)) 16313170f18SBill PaulTARGETS+= amd.host 16413170f18SBill Paul.else 16513170f18SBill PaulAMDHOST= /dev/null 16613170f18SBill Paul.endif 16713170f18SBill Paul 168778c7b1cSBill Paultarget: 169778c7b1cSBill Paul @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ 170920491cfSBill Paul cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ 171778c7b1cSBill Paul make -f ../Makefile all; echo "NIS Map update completed." 172778c7b1cSBill Paul 17313170f18SBill Paulall: $(TARGETS) 174778c7b1cSBill Paul 175778c7b1cSBill Paulethers: ethers.byname ethers.byaddr 176778c7b1cSBill Paulbootparam: bootparams 177778c7b1cSBill Paulhosts: hosts.byname hosts.byaddr 178778c7b1cSBill Paulnetworks: networks.byaddr networks.byname 179778c7b1cSBill Paulprotocols: protocols.bynumber protocols.byname 180778c7b1cSBill Paulrpc: rpc.byname rpc.bynumber 181778c7b1cSBill Paulservices: services.byname 182778c7b1cSBill Paulpasswd: passwd.byname passwd.byuid 183778c7b1cSBill Paulgroup: group.byname group.bygid 184778c7b1cSBill Paulnetgrp: netgroup 185778c7b1cSBill Paulnetid: netid.byname 186778c7b1cSBill Paulservers: ypservers 187778c7b1cSBill Paulpublickey: publickey.byname 188b2264be8SBill Paulaliases: mail.aliases 189778c7b1cSBill Paul 190778c7b1cSBill Paulmaster.passwd: master.passwd.byname master.passwd.byuid 191778c7b1cSBill Paul 192b3e93234SBill Paul# 193b3e93234SBill Paul# This is a special target used only when doing in-place updates with 194b3e93234SBill Paul# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd 195b3e93234SBill Paul# server and won't need to be remade. They will have to be pushed to the 196b3e93234SBill Paul# slaves however. Calling this target implicitly insures that this will 197b3e93234SBill Paul# happen. 198b3e93234SBill Paul# 199b3e93234SBill Paulpushpw: 200b3e93234SBill Paul @$(DBLOAD) -c 201b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi 202b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi 203b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi 204b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi 205b3e93234SBill Paul 20613170f18SBill Paulpushmap: 20713170f18SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi 20813170f18SBill Paul 20913170f18SBill Paulnopass: 21013170f18SBill Paul @echo "" 21113170f18SBill Paul @echo " ********WARNING********" 21213170f18SBill Paul @echo " Couldn't find the master.passwd source file. This file" 21313170f18SBill Paul @echo " is needed to generate the master.passwd and passwd maps." 21413170f18SBill Paul @echo " The default location is /var/yp/master.passwd. You should" 21513170f18SBill Paul @echo " edit /var/yp/Makefile and set the MASTER variable to point" 21613170f18SBill Paul @echo " to the source file you wish to use for building the passwd" 21713170f18SBill Paul @echo " maps, or else invoke make(1) in the following manner:" 21813170f18SBill Paul @echo " 21913170f18SBill Paul @echo " make MASTER_PASSWD=/path/to/master.passwd" 22013170f18SBill Paul @echo "" 22113170f18SBill Paul 222b2264be8SBill Paulmail.aliases: $(ALIASES) 223b2264be8SBill Paul @echo "Updating $@..." 224de88f160SAdam David @$(NEWALIASES) -oA$(ALIASES) 225d91013b5SAdam David @$(MKDB) -u $(ALIASES).db \ 2261754677bSBill Paul | $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \ 2271754677bSBill Paul $(RMV) $(TMP) $@ 228b2264be8SBill Paul @$(DBLOAD) -c 229b2264be8SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 230b2264be8SBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 231b2264be8SBill Paul 232778c7b1cSBill Paul 233778c7b1cSBill Paulypservers: $(YPSERVERS) 234778c7b1cSBill Paul @echo "Updating $@..." 235778c7b1cSBill Paul $(CAT) $(YPSERVERS) | \ 2360f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' $^ \ 2371754677bSBill Paul | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \ 2381754677bSBill Paul $(RMV) $(TMP) $@ 239b2264be8SBill Paul @$(DBLOAD) -c 240778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 241778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 242778c7b1cSBill Paul 243b2264be8SBill Paul 244778c7b1cSBill Paulethers.byname: $(ETHERS) 245778c7b1cSBill Paul @echo "Updating $@..." 24613170f18SBill Paul.if ${ETHERS} == "/dev/null" 24713170f18SBill Paul @echo "Ethers source file not found -- skipping" 24813170f18SBill Paul.else 249778c7b1cSBill Paul $(CAT) $(ETHERS) | \ 2500f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 251778c7b1cSBill Paul print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 2521754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 253b2264be8SBill Paul @$(DBLOAD) -c 254a6dbeb65SPeter Wemm @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 255778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 25613170f18SBill Paul.endif 257778c7b1cSBill Paul 258778c7b1cSBill Paulethers.byaddr: $(ETHERS) 259778c7b1cSBill Paul @echo "Updating $@..." 26013170f18SBill Paul.if ${ETHERS} == "/dev/null" 26113170f18SBill Paul @echo "Ethers source file not found -- skipping" 26213170f18SBill Paul.else 263778c7b1cSBill Paul $(CAT) $(ETHERS) | \ 2640f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 265778c7b1cSBill Paul print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 2661754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 267b2264be8SBill Paul @$(DBLOAD) -c 268778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 269778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 27013170f18SBill Paul.endif 271778c7b1cSBill Paul 272778c7b1cSBill Paul 273778c7b1cSBill Paulbootparams: $(BOOTPARAMS) 274778c7b1cSBill Paul @echo "Updating $@..." 27513170f18SBill Paul.if ${BOOTPARAMS} == "/dev/null" 27613170f18SBill Paul @echo "Bootparams source file not found -- skipping" 27713170f18SBill Paul.else 278778c7b1cSBill Paul $(CAT) $(BOOTPARAMS) | \ 2790f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 280778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \ 2811754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 282b2264be8SBill Paul @$(DBLOAD) -c 283778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 284778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 28513170f18SBill Paul.endif 286778c7b1cSBill Paul 287778c7b1cSBill Paul 288778c7b1cSBill Paulnetgroup: $(NETGROUP) netgroup.byhost netgroup.byuser 289778c7b1cSBill Paul @echo "Updating $@..." 29013170f18SBill Paul.if ${NETGROUP} == "/dev/null" 29113170f18SBill Paul @echo "Netgroup source file not found -- skipping" 29213170f18SBill Paul.else 293778c7b1cSBill Paul $(CAT) $(NETGROUP) | \ 2940f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 295778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 2961754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 297b2264be8SBill Paul @$(DBLOAD) -c 298778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 299778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 300778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 30113170f18SBill Paul.endif 302778c7b1cSBill Paul 303778c7b1cSBill Paul 304778c7b1cSBill Paulnetgroup.byhost: $(NETGROUP) 305778c7b1cSBill Paul @echo "Updating $@..." 30613170f18SBill Paul.if ${NETGROUP} == "/dev/null" 30713170f18SBill Paul @echo "Netgroup source file not found -- skipping" 30813170f18SBill Paul.else 309778c7b1cSBill Paul $(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \ 3100f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 311778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 3121754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 313b2264be8SBill Paul @$(DBLOAD) -c 314778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 315778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 31613170f18SBill Paul.endif 317778c7b1cSBill Paul 318778c7b1cSBill Paul 319778c7b1cSBill Paulnetgroup.byuser: $(NETGROUP) 320778c7b1cSBill Paul @echo "Updating $@..." 32113170f18SBill Paul.if ${NETGROUP} == "/dev/null" 32213170f18SBill Paul @echo "Netgroup source file not found -- skipping" 32313170f18SBill Paul.else 324778c7b1cSBill Paul $(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \ 3250f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 326778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 3271754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 328b2264be8SBill Paul @$(DBLOAD) -c 329778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 330778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 33113170f18SBill Paul.endif 332778c7b1cSBill Paul 333778c7b1cSBill Paul 334778c7b1cSBill Paulhosts.byname: $(HOSTS) 335778c7b1cSBill Paul @echo "Updating $@..." 336778c7b1cSBill Paul $(CAT) $(HOSTS) | \ 3370f87b00dSSteve Price $(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ 33858dc1574SBill Paul print $$n"\t"$$0 }' $^ | $(DBLOAD) ${B} -i $(HOSTS) \ 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 343778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 344778c7b1cSBill Paul 345b2264be8SBill Paul 346778c7b1cSBill Paulhosts.byaddr: $(HOSTS) 347778c7b1cSBill Paul @echo "Updating $@..." 348778c7b1cSBill Paul $(CAT) $(HOSTS) | \ 3490f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $^ \ 3501754677bSBill Paul | $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP); \ 3511754677bSBill Paul $(RMV) $(TMP) $@ 352b2264be8SBill Paul @$(DBLOAD) -c 353778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 354778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 355778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 356778c7b1cSBill Paul 357778c7b1cSBill Paul 358778c7b1cSBill Paulnetworks.byname: $(NETWORKS) 359778c7b1cSBill Paul @echo "Updating $@..." 360778c7b1cSBill Paul $(CAT) $(NETWORKS) | \ 361778c7b1cSBill Paul $(AWK) \ 3620f87b00dSSteve Price '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 3630f87b00dSSteve Price for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 364778c7b1cSBill Paul print $$n"\t"$$0 \ 3651754677bSBill Paul }' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 3661754677bSBill Paul $(RMV) $(TMP) $@ 367b2264be8SBill Paul @$(DBLOAD) -c 368778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 369778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 370778c7b1cSBill Paul 371778c7b1cSBill Paul 372778c7b1cSBill Paulnetworks.byaddr: $(NETWORKS) 373778c7b1cSBill Paul @echo "Updating $@..." 374778c7b1cSBill Paul $(CAT) $(NETWORKS) | \ 3750f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 3761754677bSBill Paul | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 3771754677bSBill Paul $(RMV) $(TMP) $@ 378b2264be8SBill Paul @$(DBLOAD) -c 379778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 380778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 381778c7b1cSBill Paul 382778c7b1cSBill Paul 383778c7b1cSBill Paulprotocols.byname: $(PROTOCOLS) 384778c7b1cSBill Paul @echo "Updating $@..." 385778c7b1cSBill Paul $(CAT) $(PROTOCOLS) | \ 386778c7b1cSBill Paul $(AWK) \ 3870f87b00dSSteve Price '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 3880f87b00dSSteve Price for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 389778c7b1cSBill Paul print $$n"\t"$$0 \ 390778c7b1cSBill Paul }' $^ | $(DBLOAD) -i $(PROTOCOLS) \ 3911754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 392b2264be8SBill Paul @$(DBLOAD) -c 393778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 394778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 395778c7b1cSBill Paul 396778c7b1cSBill Paul 397778c7b1cSBill Paulprotocols.bynumber: $(PROTOCOLS) 398778c7b1cSBill Paul @echo "Updating $@..." 399778c7b1cSBill Paul $(CAT) $(PROTOCOLS) | \ 4000f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 4011754677bSBill Paul | $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP); \ 4021754677bSBill Paul $(RMV) $(TMP) $@ 403b2264be8SBill Paul @$(DBLOAD) -c 404778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 405778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 406778c7b1cSBill Paul 407778c7b1cSBill Paul 408778c7b1cSBill Paulrpc.byname: $(RPC) 409778c7b1cSBill Paul @echo "Updating $@..." 410778c7b1cSBill Paul $(CAT) $(RPC) | \ 411778c7b1cSBill Paul $(AWK) \ 4120f87b00dSSteve Price '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 4130f87b00dSSteve Price for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 414778c7b1cSBill Paul print $$n"\t"$$0 \ 4151754677bSBill Paul }' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 4161754677bSBill Paul $(RMV) $(TMP) $@ 417b2264be8SBill Paul @$(DBLOAD) -c 418778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 419778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 420778c7b1cSBill Paul 421778c7b1cSBill Paul 422778c7b1cSBill Paulrpc.bynumber: $(RPC) 423778c7b1cSBill Paul @echo "Updating $@..." 424778c7b1cSBill Paul $(CAT) $(RPC) | \ 4250f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 4261754677bSBill Paul | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 4271754677bSBill Paul $(RMV) $(TMP) $@ 428b2264be8SBill Paul @$(DBLOAD) -c 429778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 430778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 431778c7b1cSBill Paul 432778c7b1cSBill Paul 433778c7b1cSBill Paulservices.byname: $(SERVICES) 434778c7b1cSBill Paul @echo "Updating $@..." 435778c7b1cSBill Paul $(CAT) $(SERVICES) | \ 436778c7b1cSBill Paul $(AWK) \ 4370f87b00dSSteve Price '$$1 !~ "^#.*" { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \ 438f44298dfSBill Paul if (split($$2, t, "/")) { \ 439f44298dfSBill Paul printf("%s/%s", $$n, t[2]) }; \ 4409ac2a83aSBill Paul print "\t"$$0; \ 44188b4ff3cSPeter Wemm if (n == 1) n = 2; \ 44288b4ff3cSPeter Wemm } ; print $$2"\t"$$0 ; \ 4431754677bSBill Paul }' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \ 4441754677bSBill Paul $(RMV) $(TMP) $@ 445b2264be8SBill Paul @$(DBLOAD) -c 446778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 447778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 448778c7b1cSBill Paul 449778c7b1cSBill Paul 450778c7b1cSBill Paulpublickey.byname: $(PUBLICKEY) 451778c7b1cSBill Paul @echo "Updating $@..." 45213170f18SBill Paul.if ${PUBLICKEY} == "/dev/null" 45313170f18SBill Paul @echo "Publickey source file not found -- skipping" 45413170f18SBill Paul.else 455aca49be3SBill Paul $(CAT) $(PUBLICKEY) | \ 4560f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $^ \ 4571754677bSBill Paul | $(DBLOAD) -i $(PUBLICKEY) -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 46213170f18SBill Paul.endif 463778c7b1cSBill Paul 464778c7b1cSBill Paul 465778c7b1cSBill Paul$(PASSWD): $(MASTER) 466778c7b1cSBill Paul @echo "Creating new $@ file from $(MASTER)..." 467778c7b1cSBill Paul @if [ ! $(UNSECURE) ]; then \ 468778c7b1cSBill Paul $(RCAT) $(MASTER) | \ 469778c7b1cSBill Paul $(AWK) -F: '{if ($$1 != "+") \ 470778c7b1cSBill Paul print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 471778c7b1cSBill Paul > $(PASSWD) ; \ 472778c7b1cSBill Paul else $(RCAT) $(MASTER) | \ 473778c7b1cSBill Paul $(AWK) -F: '{if ($$1 != "+") \ 474778c7b1cSBill Paul print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 475778c7b1cSBill Paul > $(PASSWD) ; fi 476778c7b1cSBill Paul 477778c7b1cSBill Paul 478778c7b1cSBill Paulpasswd.byname: $(PASSWD) 479778c7b1cSBill Paul @echo "Updating $@..." 480778c7b1cSBill Paul $(CAT) $(PASSWD) | \ 481778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 4821754677bSBill Paul | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 4831754677bSBill Paul $(RMV) $(TMP) $@ 484b2264be8SBill Paul @$(DBLOAD) -c 485778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 486778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 487778c7b1cSBill Paul 488b2264be8SBill Paul 489778c7b1cSBill Paulpasswd.byuid: $(PASSWD) 490778c7b1cSBill Paul @echo "Updating $@..." 491778c7b1cSBill Paul $(CAT) $(PASSWD) | \ 492778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 4931754677bSBill Paul | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 4941754677bSBill Paul $(RMV) $(TMP) $@ 495b2264be8SBill Paul @$(DBLOAD) -c 496778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 497778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 498778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 499778c7b1cSBill Paul 500778c7b1cSBill Paul 501778c7b1cSBill Paulgroup.byname: $(GROUP) 502778c7b1cSBill Paul @echo "Updating $@..." 503778c7b1cSBill Paul $(CAT) $(GROUP) | \ 504778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 5051754677bSBill Paul | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 5061754677bSBill Paul $(RMV) $(TMP) $@ 507b2264be8SBill Paul @$(DBLOAD) -c 508778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 509778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 510778c7b1cSBill Paul 511778c7b1cSBill Paul 512778c7b1cSBill Paulgroup.bygid: $(GROUP) 513778c7b1cSBill Paul @echo "Updating $@..." 514778c7b1cSBill Paul $(CAT) $(GROUP) | \ 515778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 5161754677bSBill Paul | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 5171754677bSBill Paul $(RMV) $(TMP) $@ 518b2264be8SBill Paul @$(DBLOAD) -c 519778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 520778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 521778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 522778c7b1cSBill Paul 523778c7b1cSBill Paul 524778c7b1cSBill Paulnetid.byname: $(GROUP) $(PASSWD) 525778c7b1cSBill Paul @echo "Updating $@..." 5261fe3e67aSBill Paul @$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \ 5271754677bSBill Paul -d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \ 5281754677bSBill Paul $(RMV) $(TMP) $@ 529b2264be8SBill Paul @$(DBLOAD) -c 530778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 531778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 532778c7b1cSBill Paul 533778c7b1cSBill Paul 534778c7b1cSBill Paulmaster.passwd.byname: $(MASTER) 535778c7b1cSBill Paul @echo "Updating $@..." 53613170f18SBill Paul.if ${MASTER} == "/dev/null" 53713170f18SBill Paul @echo "Master.passwd source file not found -- skipping" 53813170f18SBill Paul.else 539778c7b1cSBill Paul $(CAT) $(MASTER) | \ 540778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 5411754677bSBill Paul | $(DBLOAD) ${S} -i $(MASTER) -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 54613170f18SBill Paul.endif 547778c7b1cSBill Paul 548778c7b1cSBill Paul 549778c7b1cSBill Paulmaster.passwd.byuid: $(MASTER) 550778c7b1cSBill Paul @echo "Updating $@..." 55113170f18SBill Paul.if ${MASTER} == "/dev/null" 55213170f18SBill Paul @echo "Master.passwd source file not found -- skipping" 55313170f18SBill Paul.else 554778c7b1cSBill Paul $(CAT) $(MASTER) | \ 555778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 5561754677bSBill Paul | $(DBLOAD) ${S} -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 5571754677bSBill Paul $(RMV) $(TMP) $@ 558b2264be8SBill Paul @$(DBLOAD) -c 559778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 560778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 56113170f18SBill Paul.endif 56213170f18SBill Paul 56357948c0bSPeter Wemm 56457948c0bSPeter Wemmamd.host: $(AMDHOST) 56557948c0bSPeter Wemm @echo "Updating $@..." 56657948c0bSPeter Wemm $(CAT) $(AMDHOST) | \ 5670f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { \ 56857948c0bSPeter Wemm for (i = 1; i <= NF; i++) \ 56957948c0bSPeter Wemm if (i == NF) { \ 57057948c0bSPeter Wemm if (substr($$i, length($$i), 1) == "\\") \ 57157948c0bSPeter Wemm printf("%s", substr($$i, 1, length($$i) - 1)); \ 57257948c0bSPeter Wemm else \ 57357948c0bSPeter Wemm printf("%s\n", $$i); \ 57457948c0bSPeter Wemm } \ 57557948c0bSPeter Wemm else \ 57657948c0bSPeter Wemm printf("%s ", $$i); \ 57757948c0bSPeter Wemm }' | \ 5781754677bSBill Paul $(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP); \ 5791754677bSBill Paul $(RMV) $(TMP) $@ 58057948c0bSPeter Wemm @$(DBLOAD) -c 58157948c0bSPeter Wemm @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 58257948c0bSPeter Wemm @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 58357948c0bSPeter Wemm 584