1778c7b1cSBill Paul# 2778c7b1cSBill Paul# Makefile for the NIS databases 3778c7b1cSBill Paul# 49ac2a83aSBill Paul# $Id: Makefile.yp,v 1.21 1998/02/13 03:38:41 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# 88778c7b1cSBill Paul# - invoking yppasswdd without the -m option (yppasswdd will use 89778c7b1cSBill Paul# /etc/master.passwd if no alternate master.passwd file is specified 90778c7b1cSBill Paul# and do a 'pwd_mkdb' as needed). 91778c7b1cSBill Paul# - Specifying the location of the master.passwd file using the 92778c7b1cSBill Paul# MASTER_PASSWD variable, i.e.: 93778c7b1cSBill Paul# 94778c7b1cSBill Paul# # make MASTER_PASSWD=/path/to/some/other/master.passwd 95778c7b1cSBill Paul# 96778c7b1cSBill Paul# - (optionally): editing this Makefile to change the default location. 97778c7b1cSBill Paul# 98778c7b1cSBill Paul# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw 99778c7b1cSBill Paul# passwd file will be generated from the master.passwd file automagically. 100778c7b1cSBill Paul# 101778c7b1cSBill PaulETHERS = $(YPSRCDIR)/ethers # ethernet addresses (for rarpd) 102778c7b1cSBill PaulBOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd) 103778c7b1cSBill PaulHOSTS = $(YPSRCDIR)/hosts 104778c7b1cSBill PaulNETWORKS = $(YPSRCDIR)/networks 105778c7b1cSBill PaulPROTOCOLS = $(YPSRCDIR)/protocols 106778c7b1cSBill PaulRPC = $(YPSRCDIR)/rpc 107778c7b1cSBill PaulSERVICES = $(YPSRCDIR)/services 108778c7b1cSBill PaulGROUP = $(YPSRCDIR)/group 109b2264be8SBill PaulALIASES = $(YPSRCDIR)/aliases 110b2264be8SBill PaulNETGROUP = $(YPDIR)/netgroup 111778c7b1cSBill PaulPASSWD = $(YPDIR)/passwd 112778c7b1cSBill Paul.if !defined(MASTER_PASSWD) 113778c7b1cSBill PaulMASTER = $(YPDIR)/master.passwd 114778c7b1cSBill Paul.else 115778c7b1cSBill PaulMASTER = $(MASTER_PASSWD) 116778c7b1cSBill Paul.endif 117778c7b1cSBill PaulYPSERVERS = $(YPDIR)/ypservers # List of all NIS servers for a domain 118778c7b1cSBill PaulPUBLICKEY = $(YPSRCDIR)/publickey 1191fe3e67aSBill PaulNETID = $(YPSRCDIR)/netid 12057948c0bSPeter WemmAMDHOST = $(YPSRCDIR)/amd.host 121778c7b1cSBill Paul 12213170f18SBill Paul# List of maps that are always built. 12313170f18SBill Paul# If you want to omit some of them, feel free to comment 12413170f18SBill Paul# them out from this list. 12513170f18SBill PaulTARGETS= servers hosts networks protocols rpc services group 12613170f18SBill Paul#TARGETS+= aliases 12713170f18SBill Paul 12813170f18SBill Paul# Sanity checks: filter out targets we can't build 12913170f18SBill Paul# Note that we don't build the ethers or boorparams maps by default 13013170f18SBill Paul# since /etc/ethers and /etc/bootparams are not likely to be present 13113170f18SBill Paul# on all systems. 13213170f18SBill Paul.if exists($(ETHERS)) 13313170f18SBill PaulTARGETS+= ethers 13413170f18SBill Paul.else 13513170f18SBill PaulETHERS= /dev/null 13613170f18SBill Paul.endif 13713170f18SBill Paul 13813170f18SBill Paul.if exists($(BOOTPARAMS)) 13913170f18SBill PaulTARGETS+= bootparams 14013170f18SBill Paul.else 14113170f18SBill PaulBOOTPARAMS= /dev/null 14213170f18SBill Paul.endif 14313170f18SBill Paul 14413170f18SBill Paul.if exists($(NETGROUP)) 14513170f18SBill PaulTARGETS+= netgrp 14613170f18SBill Paul.else 14713170f18SBill PaulNETGROUP= /dev/null 14813170f18SBill Paul.endif 14913170f18SBill Paul 15013170f18SBill Paul.if exists($(MASTER)) 15113170f18SBill PaulTARGETS+= passwd master.passwd netid 15213170f18SBill Paul.else 15313170f18SBill PaulMASTER= /dev/null 15413170f18SBill PaulTARGETS+= nopass 15513170f18SBill Paul.endif 15613170f18SBill Paul 15713170f18SBill Paul.if exists($(PUBLICKEY)) 15813170f18SBill PaulTARGETS+= publickey 15913170f18SBill Paul.else 16013170f18SBill PaulPUBLICKEY= /dev/null 16113170f18SBill Paul.endif 16213170f18SBill Paul 16313170f18SBill Paul.if exists($(AMDHOST)) 16413170f18SBill PaulTARGETS+= amd.host 16513170f18SBill Paul.else 16613170f18SBill PaulAMDHOST= /dev/null 16713170f18SBill Paul.endif 16813170f18SBill Paul 169778c7b1cSBill Paultarget: 170778c7b1cSBill Paul @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ 171920491cfSBill Paul cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ 172778c7b1cSBill Paul make -f ../Makefile all; echo "NIS Map update completed." 173778c7b1cSBill Paul 17413170f18SBill Paulall: $(TARGETS) 175778c7b1cSBill Paul 176778c7b1cSBill Paulethers: ethers.byname ethers.byaddr 177778c7b1cSBill Paulbootparam: bootparams 178778c7b1cSBill Paulhosts: hosts.byname hosts.byaddr 179778c7b1cSBill Paulnetworks: networks.byaddr networks.byname 180778c7b1cSBill Paulprotocols: protocols.bynumber protocols.byname 181778c7b1cSBill Paulrpc: rpc.byname rpc.bynumber 182778c7b1cSBill Paulservices: services.byname 183778c7b1cSBill Paulpasswd: passwd.byname passwd.byuid 184778c7b1cSBill Paulgroup: group.byname group.bygid 185778c7b1cSBill Paulnetgrp: netgroup 186778c7b1cSBill Paulnetid: netid.byname 187778c7b1cSBill Paulservers: ypservers 188778c7b1cSBill Paulpublickey: publickey.byname 189b2264be8SBill Paulaliases: mail.aliases 190778c7b1cSBill Paul 191778c7b1cSBill Paulmaster.passwd: master.passwd.byname master.passwd.byuid 192778c7b1cSBill Paul 193b3e93234SBill Paul# 194b3e93234SBill Paul# This is a special target used only when doing in-place updates with 195b3e93234SBill Paul# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd 196b3e93234SBill Paul# server and won't need to be remade. They will have to be pushed to the 197b3e93234SBill Paul# slaves however. Calling this target implicitly insures that this will 198b3e93234SBill Paul# happen. 199b3e93234SBill Paul# 200b3e93234SBill Paulpushpw: 201b3e93234SBill Paul @$(DBLOAD) -c 202b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi 203b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi 204b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi 205b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi 206b3e93234SBill Paul 20713170f18SBill Paulpushmap: 20813170f18SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi 20913170f18SBill Paul 21013170f18SBill Paulnopass: 21113170f18SBill Paul @echo "" 21213170f18SBill Paul @echo " ********WARNING********" 21313170f18SBill Paul @echo " Couldn't find the master.passwd source file. This file" 21413170f18SBill Paul @echo " is needed to generate the master.passwd and passwd maps." 21513170f18SBill Paul @echo " The default location is /var/yp/master.passwd. You should" 21613170f18SBill Paul @echo " edit /var/yp/Makefile and set the MASTER variable to point" 21713170f18SBill Paul @echo " to the source file you wish to use for building the passwd" 21813170f18SBill Paul @echo " maps, or else invoke make(1) in the following manner:" 21913170f18SBill Paul @echo " 22013170f18SBill Paul @echo " make MASTER_PASSWD=/path/to/master.passwd" 22113170f18SBill Paul @echo "" 22213170f18SBill Paul 223b2264be8SBill Paulmail.aliases: $(ALIASES) 224b2264be8SBill Paul @echo "Updating $@..." 225de88f160SAdam David @$(NEWALIASES) -oA$(ALIASES) 226d91013b5SAdam David @$(MKDB) -u $(ALIASES).db \ 2271754677bSBill Paul | $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \ 2281754677bSBill Paul $(RMV) $(TMP) $@ 229b2264be8SBill Paul @$(DBLOAD) -c 230b2264be8SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 231b2264be8SBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 232b2264be8SBill Paul 233778c7b1cSBill Paul 234778c7b1cSBill Paulypservers: $(YPSERVERS) 235778c7b1cSBill Paul @echo "Updating $@..." 236778c7b1cSBill Paul $(CAT) $(YPSERVERS) | \ 2370f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' $^ \ 2381754677bSBill Paul | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \ 2391754677bSBill Paul $(RMV) $(TMP) $@ 240b2264be8SBill Paul @$(DBLOAD) -c 241778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 242778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 243778c7b1cSBill Paul 244b2264be8SBill Paul 245778c7b1cSBill Paulethers.byname: $(ETHERS) 246778c7b1cSBill Paul @echo "Updating $@..." 24713170f18SBill Paul.if ${ETHERS} == "/dev/null" 24813170f18SBill Paul @echo "Ethers source file not found -- skipping" 24913170f18SBill Paul.else 250778c7b1cSBill Paul $(CAT) $(ETHERS) | \ 2510f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 252778c7b1cSBill Paul print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 2531754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 254b2264be8SBill Paul @$(DBLOAD) -c 255a6dbeb65SPeter Wemm @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 256778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 25713170f18SBill Paul.endif 258778c7b1cSBill Paul 259778c7b1cSBill Paulethers.byaddr: $(ETHERS) 260778c7b1cSBill Paul @echo "Updating $@..." 26113170f18SBill Paul.if ${ETHERS} == "/dev/null" 26213170f18SBill Paul @echo "Ethers source file not found -- skipping" 26313170f18SBill Paul.else 264778c7b1cSBill Paul $(CAT) $(ETHERS) | \ 2650f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 266778c7b1cSBill Paul print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 2671754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 268b2264be8SBill Paul @$(DBLOAD) -c 269778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 270778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 27113170f18SBill Paul.endif 272778c7b1cSBill Paul 273778c7b1cSBill Paul 274778c7b1cSBill Paulbootparams: $(BOOTPARAMS) 275778c7b1cSBill Paul @echo "Updating $@..." 27613170f18SBill Paul.if ${BOOTPARAMS} == "/dev/null" 27713170f18SBill Paul @echo "Bootparams source file not found -- skipping" 27813170f18SBill Paul.else 279778c7b1cSBill Paul $(CAT) $(BOOTPARAMS) | \ 2800f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 281778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \ 2821754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 283b2264be8SBill Paul @$(DBLOAD) -c 284778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 285778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 28613170f18SBill Paul.endif 287778c7b1cSBill Paul 288778c7b1cSBill Paul 289778c7b1cSBill Paulnetgroup: $(NETGROUP) netgroup.byhost netgroup.byuser 290778c7b1cSBill Paul @echo "Updating $@..." 29113170f18SBill Paul.if ${NETGROUP} == "/dev/null" 29213170f18SBill Paul @echo "Netgroup source file not found -- skipping" 29313170f18SBill Paul.else 294778c7b1cSBill Paul $(CAT) $(NETGROUP) | \ 2950f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 296778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 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 301778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 30213170f18SBill Paul.endif 303778c7b1cSBill Paul 304778c7b1cSBill Paul 305778c7b1cSBill Paulnetgroup.byhost: $(NETGROUP) 306778c7b1cSBill Paul @echo "Updating $@..." 30713170f18SBill Paul.if ${NETGROUP} == "/dev/null" 30813170f18SBill Paul @echo "Netgroup source file not found -- skipping" 30913170f18SBill Paul.else 310778c7b1cSBill Paul $(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \ 3110f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 312778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 3131754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 314b2264be8SBill Paul @$(DBLOAD) -c 315778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 316778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 31713170f18SBill Paul.endif 318778c7b1cSBill Paul 319778c7b1cSBill Paul 320778c7b1cSBill Paulnetgroup.byuser: $(NETGROUP) 321778c7b1cSBill Paul @echo "Updating $@..." 32213170f18SBill Paul.if ${NETGROUP} == "/dev/null" 32313170f18SBill Paul @echo "Netgroup source file not found -- skipping" 32413170f18SBill Paul.else 325778c7b1cSBill Paul $(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \ 3260f87b00dSSteve Price $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 327778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 3281754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 329b2264be8SBill Paul @$(DBLOAD) -c 330778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 331778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 33213170f18SBill Paul.endif 333778c7b1cSBill Paul 334778c7b1cSBill Paul 335778c7b1cSBill Paulhosts.byname: $(HOSTS) 336778c7b1cSBill Paul @echo "Updating $@..." 337778c7b1cSBill Paul $(CAT) $(HOSTS) | \ 3380f87b00dSSteve Price $(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ 33958dc1574SBill Paul print $$n"\t"$$0 }' $^ | $(DBLOAD) ${B} -i $(HOSTS) \ 3401754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 341b2264be8SBill Paul @$(DBLOAD) -c 342778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 343778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 344778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 345778c7b1cSBill Paul 346b2264be8SBill Paul 347778c7b1cSBill Paulhosts.byaddr: $(HOSTS) 348778c7b1cSBill Paul @echo "Updating $@..." 349778c7b1cSBill Paul $(CAT) $(HOSTS) | \ 3500f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $^ \ 3511754677bSBill Paul | $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP); \ 3521754677bSBill Paul $(RMV) $(TMP) $@ 353b2264be8SBill Paul @$(DBLOAD) -c 354778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 355778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 356778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 357778c7b1cSBill Paul 358778c7b1cSBill Paul 359778c7b1cSBill Paulnetworks.byname: $(NETWORKS) 360778c7b1cSBill Paul @echo "Updating $@..." 361778c7b1cSBill Paul $(CAT) $(NETWORKS) | \ 362778c7b1cSBill Paul $(AWK) \ 3630f87b00dSSteve Price '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 3640f87b00dSSteve Price for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 365778c7b1cSBill Paul print $$n"\t"$$0 \ 3661754677bSBill Paul }' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 3671754677bSBill Paul $(RMV) $(TMP) $@ 368b2264be8SBill Paul @$(DBLOAD) -c 369778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 370778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 371778c7b1cSBill Paul 372778c7b1cSBill Paul 373778c7b1cSBill Paulnetworks.byaddr: $(NETWORKS) 374778c7b1cSBill Paul @echo "Updating $@..." 375778c7b1cSBill Paul $(CAT) $(NETWORKS) | \ 3760f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 3771754677bSBill Paul | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 3781754677bSBill Paul $(RMV) $(TMP) $@ 379b2264be8SBill Paul @$(DBLOAD) -c 380778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 381778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 382778c7b1cSBill Paul 383778c7b1cSBill Paul 384778c7b1cSBill Paulprotocols.byname: $(PROTOCOLS) 385778c7b1cSBill Paul @echo "Updating $@..." 386778c7b1cSBill Paul $(CAT) $(PROTOCOLS) | \ 387778c7b1cSBill Paul $(AWK) \ 3880f87b00dSSteve Price '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 3890f87b00dSSteve Price for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 390778c7b1cSBill Paul print $$n"\t"$$0 \ 391778c7b1cSBill Paul }' $^ | $(DBLOAD) -i $(PROTOCOLS) \ 3921754677bSBill Paul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 393b2264be8SBill Paul @$(DBLOAD) -c 394778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 395778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 396778c7b1cSBill Paul 397778c7b1cSBill Paul 398778c7b1cSBill Paulprotocols.bynumber: $(PROTOCOLS) 399778c7b1cSBill Paul @echo "Updating $@..." 400778c7b1cSBill Paul $(CAT) $(PROTOCOLS) | \ 4010f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 4021754677bSBill Paul | $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP); \ 4031754677bSBill Paul $(RMV) $(TMP) $@ 404b2264be8SBill Paul @$(DBLOAD) -c 405778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 406778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 407778c7b1cSBill Paul 408778c7b1cSBill Paul 409778c7b1cSBill Paulrpc.byname: $(RPC) 410778c7b1cSBill Paul @echo "Updating $@..." 411778c7b1cSBill Paul $(CAT) $(RPC) | \ 412778c7b1cSBill Paul $(AWK) \ 4130f87b00dSSteve Price '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 4140f87b00dSSteve Price for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 415778c7b1cSBill Paul print $$n"\t"$$0 \ 4161754677bSBill Paul }' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 4171754677bSBill Paul $(RMV) $(TMP) $@ 418b2264be8SBill Paul @$(DBLOAD) -c 419778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 420778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 421778c7b1cSBill Paul 422778c7b1cSBill Paul 423778c7b1cSBill Paulrpc.bynumber: $(RPC) 424778c7b1cSBill Paul @echo "Updating $@..." 425778c7b1cSBill Paul $(CAT) $(RPC) | \ 4260f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 4271754677bSBill Paul | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 4281754677bSBill Paul $(RMV) $(TMP) $@ 429b2264be8SBill Paul @$(DBLOAD) -c 430778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 431778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 432778c7b1cSBill Paul 433778c7b1cSBill Paul 434778c7b1cSBill Paulservices.byname: $(SERVICES) 435778c7b1cSBill Paul @echo "Updating $@..." 436778c7b1cSBill Paul $(CAT) $(SERVICES) | \ 437778c7b1cSBill Paul $(AWK) \ 4380f87b00dSSteve Price '$$1 !~ "^#.*" { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \ 439f44298dfSBill Paul if (split($$2, t, "/")) { \ 440f44298dfSBill Paul printf("%s/%s", $$n, t[2]) }; \ 4419ac2a83aSBill Paul print "\t"$$0; \ 44288b4ff3cSPeter Wemm if (n == 1) n = 2; \ 443f44298dfSBill Paul } 44488b4ff3cSPeter Wemm } ; print $$2"\t"$$0 ; \ 4451754677bSBill Paul }' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \ 4461754677bSBill Paul $(RMV) $(TMP) $@ 447b2264be8SBill Paul @$(DBLOAD) -c 448778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 449778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 450778c7b1cSBill Paul 451778c7b1cSBill Paul 452778c7b1cSBill Paulpublickey.byname: $(PUBLICKEY) 453778c7b1cSBill Paul @echo "Updating $@..." 45413170f18SBill Paul.if ${PUBLICKEY} == "/dev/null" 45513170f18SBill Paul @echo "Publickey source file not found -- skipping" 45613170f18SBill Paul.else 457aca49be3SBill Paul $(CAT) $(PUBLICKEY) | \ 4580f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $^ \ 4591754677bSBill Paul | $(DBLOAD) -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \ 4601754677bSBill Paul $(RMV) $(TMP) $@ 461b2264be8SBill Paul @$(DBLOAD) -c 462778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 463778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 46413170f18SBill Paul.endif 465778c7b1cSBill Paul 466778c7b1cSBill Paul 467778c7b1cSBill Paul$(PASSWD): $(MASTER) 468778c7b1cSBill Paul @echo "Creating new $@ file from $(MASTER)..." 469778c7b1cSBill Paul @if [ ! $(UNSECURE) ]; then \ 470778c7b1cSBill Paul $(RCAT) $(MASTER) | \ 471778c7b1cSBill Paul $(AWK) -F: '{if ($$1 != "+") \ 472778c7b1cSBill Paul print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 473778c7b1cSBill Paul > $(PASSWD) ; \ 474778c7b1cSBill Paul else $(RCAT) $(MASTER) | \ 475778c7b1cSBill Paul $(AWK) -F: '{if ($$1 != "+") \ 476778c7b1cSBill Paul print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 477778c7b1cSBill Paul > $(PASSWD) ; fi 478778c7b1cSBill Paul 479778c7b1cSBill Paul 480778c7b1cSBill Paulpasswd.byname: $(PASSWD) 481778c7b1cSBill Paul @echo "Updating $@..." 482778c7b1cSBill Paul $(CAT) $(PASSWD) | \ 483778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 4841754677bSBill Paul | $(DBLOAD) -i $(PASSWD) -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 490b2264be8SBill Paul 491778c7b1cSBill Paulpasswd.byuid: $(PASSWD) 492778c7b1cSBill Paul @echo "Updating $@..." 493778c7b1cSBill Paul $(CAT) $(PASSWD) | \ 494778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 4951754677bSBill Paul | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 4961754677bSBill Paul $(RMV) $(TMP) $@ 497b2264be8SBill Paul @$(DBLOAD) -c 498778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 499778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 500778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 501778c7b1cSBill Paul 502778c7b1cSBill Paul 503778c7b1cSBill Paulgroup.byname: $(GROUP) 504778c7b1cSBill Paul @echo "Updating $@..." 505778c7b1cSBill Paul $(CAT) $(GROUP) | \ 506778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 5071754677bSBill Paul | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 5081754677bSBill Paul $(RMV) $(TMP) $@ 509b2264be8SBill Paul @$(DBLOAD) -c 510778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 511778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 512778c7b1cSBill Paul 513778c7b1cSBill Paul 514778c7b1cSBill Paulgroup.bygid: $(GROUP) 515778c7b1cSBill Paul @echo "Updating $@..." 516778c7b1cSBill Paul $(CAT) $(GROUP) | \ 517778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 5181754677bSBill Paul | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 5191754677bSBill Paul $(RMV) $(TMP) $@ 520b2264be8SBill Paul @$(DBLOAD) -c 521778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 522778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 523778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 524778c7b1cSBill Paul 525778c7b1cSBill Paul 526778c7b1cSBill Paulnetid.byname: $(GROUP) $(PASSWD) 527778c7b1cSBill Paul @echo "Updating $@..." 5281fe3e67aSBill Paul @$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \ 5291754677bSBill Paul -d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \ 5301754677bSBill Paul $(RMV) $(TMP) $@ 531b2264be8SBill Paul @$(DBLOAD) -c 532778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 533778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 534778c7b1cSBill Paul 535778c7b1cSBill Paul 536778c7b1cSBill Paulmaster.passwd.byname: $(MASTER) 537778c7b1cSBill Paul @echo "Updating $@..." 53813170f18SBill Paul.if ${MASTER} == "/dev/null" 53913170f18SBill Paul @echo "Master.passwd source file not found -- skipping" 54013170f18SBill Paul.else 541778c7b1cSBill Paul $(CAT) $(MASTER) | \ 542778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 5431754677bSBill Paul | $(DBLOAD) ${S} -i $(MASTER) -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 Paulmaster.passwd.byuid: $(MASTER) 552778c7b1cSBill Paul @echo "Updating $@..." 55313170f18SBill Paul.if ${MASTER} == "/dev/null" 55413170f18SBill Paul @echo "Master.passwd source file not found -- skipping" 55513170f18SBill Paul.else 556778c7b1cSBill Paul $(CAT) $(MASTER) | \ 557778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 5581754677bSBill Paul | $(DBLOAD) ${S} -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 5591754677bSBill Paul $(RMV) $(TMP) $@ 560b2264be8SBill Paul @$(DBLOAD) -c 561778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 562778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 56313170f18SBill Paul.endif 56413170f18SBill Paul 56557948c0bSPeter Wemm 56657948c0bSPeter Wemmamd.host: $(AMDHOST) 56757948c0bSPeter Wemm @echo "Updating $@..." 56857948c0bSPeter Wemm $(CAT) $(AMDHOST) | \ 5690f87b00dSSteve Price $(AWK) '$$1 !~ "^#.*" { \ 57057948c0bSPeter Wemm for (i = 1; i <= NF; i++) \ 57157948c0bSPeter Wemm if (i == NF) { \ 57257948c0bSPeter Wemm if (substr($$i, length($$i), 1) == "\\") \ 57357948c0bSPeter Wemm printf("%s", substr($$i, 1, length($$i) - 1)); \ 57457948c0bSPeter Wemm else \ 57557948c0bSPeter Wemm printf("%s\n", $$i); \ 57657948c0bSPeter Wemm } \ 57757948c0bSPeter Wemm else \ 57857948c0bSPeter Wemm printf("%s ", $$i); \ 57957948c0bSPeter Wemm }' | \ 5801754677bSBill Paul $(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP); \ 5811754677bSBill Paul $(RMV) $(TMP) $@ 58257948c0bSPeter Wemm @$(DBLOAD) -c 58357948c0bSPeter Wemm @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 58457948c0bSPeter Wemm @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 58557948c0bSPeter Wemm 586