1778c7b1cSBill Paul# 2778c7b1cSBill Paul# Makefile for the NIS databases 3778c7b1cSBill Paul# 41fe3e67aSBill Paul# $Id: Makefile.yp,v 1.6 1996/06/05 02:01:27 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 32778c7b1cSBill Paul# These are commands which this Makefile needs to properly rebuild the 33778c7b1cSBill Paul# NIS databases. Don't change these unless you have a good reason. Also 34778c7b1cSBill Paul# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary 35778c7b1cSBill Paul# and it'll break everything in sight. 36778c7b1cSBill Paul# 37778c7b1cSBill PaulAWK = /usr/bin/awk 38778c7b1cSBill PaulRM = @/bin/rm -f 39b2264be8SBill PaulMV = @/bin/mv -f 40778c7b1cSBill PaulRCAT = /bin/cat 41778c7b1cSBill PaulCAT = @$(RCAT) 42b2264be8SBill PaulSED = /usr/bin/sed 43778c7b1cSBill Paul 44778c7b1cSBill PaulDBLOAD = /usr/sbin/yp_mkdb -m `hostname` 45778c7b1cSBill PaulMKNETID = /usr/libexec/mknetid 46b2264be8SBill PaulMKALIASES = /usr/libexec/mkaliases 47b2264be8SBill PaulNEWALIASES = /usr/bin/newaliases 481fff226dSBill PaulYPPUSH = /usr/sbin/yppush 49920491cfSBill Paul.if !defined(UPDATE_DOMAIN) 50778c7b1cSBill PaulDOMAIN = `/bin/domainname` 51920491cfSBill Paul.else 52920491cfSBill PaulDOMAIN = $(UPDATE_DOMAIN) 53920491cfSBill Paul.endif 54778c7b1cSBill PaulREVNETGROUP = /usr/libexec/revnetgroup 55b2264be8SBill PaulNFILE = /tmp/ypmake 56b2264be8SBill PaulTMP = `$(RCAT) $(NFILE)` 57778c7b1cSBill Paul 58b2264be8SBill Paul# It is advisable to create a seperate directory to contain the 59b2264be8SBill Paul# source files used to generate your NIS maps. If you intent to 60b2264be8SBill Paul# support multiple domains, something like /src/dir/$DOMAIN 61b2264be8SBill Paul# would work well. 62778c7b1cSBill PaulYPSRCDIR = /etc 63778c7b1cSBill PaulYPDIR = /var/yp 64778c7b1cSBill PaulYPMAPDIR = $(YPDIR)/$(DOMAIN) 65778c7b1cSBill Paul 66778c7b1cSBill Paul# These are the files from which the NIS databases are built. You may edit 67778c7b1cSBill Paul# these to taste in the event that you wish to keep your NIS source files 68778c7b1cSBill Paul# seperate from your NIS server's actual configuration files. Note that the 69778c7b1cSBill Paul# NIS passwd and master.passwd files are stored in /var/yp: the server's 70778c7b1cSBill Paul# real password database is not used by default. However, you may use 71778c7b1cSBill Paul# the real /etc/passwd and /etc/master.passwd files by: 72778c7b1cSBill Paul# 73778c7b1cSBill Paul# 74778c7b1cSBill Paul# - invoking yppasswdd without the -m option (yppasswdd will use 75778c7b1cSBill Paul# /etc/master.passwd if no alternate master.passwd file is specified 76778c7b1cSBill Paul# and do a 'pwd_mkdb' as needed). 77778c7b1cSBill Paul# - Specifying the location of the master.passwd file using the 78778c7b1cSBill Paul# MASTER_PASSWD variable, i.e.: 79778c7b1cSBill Paul# 80778c7b1cSBill Paul# # make MASTER_PASSWD=/path/to/some/other/master.passwd 81778c7b1cSBill Paul# 82778c7b1cSBill Paul# - (optionally): editing this Makefile to change the default location. 83778c7b1cSBill Paul# 84778c7b1cSBill Paul# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw 85778c7b1cSBill Paul# passwd file will be generated from the master.passwd file automagically. 86778c7b1cSBill Paul# 87778c7b1cSBill PaulETHERS = $(YPSRCDIR)/ethers # ethernet addresses (for rarpd) 88778c7b1cSBill PaulBOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd) 89778c7b1cSBill PaulHOSTS = $(YPSRCDIR)/hosts 90778c7b1cSBill PaulNETWORKS = $(YPSRCDIR)/networks 91778c7b1cSBill PaulPROTOCOLS = $(YPSRCDIR)/protocols 92778c7b1cSBill PaulRPC = $(YPSRCDIR)/rpc 93778c7b1cSBill PaulSERVICES = $(YPSRCDIR)/services 94778c7b1cSBill PaulGROUP = $(YPSRCDIR)/group 95b2264be8SBill PaulALIASES = $(YPSRCDIR)/aliases 96b2264be8SBill PaulNETGROUP = $(YPDIR)/netgroup 97778c7b1cSBill PaulPASSWD = $(YPDIR)/passwd 98778c7b1cSBill Paul.if !defined(MASTER_PASSWD) 99778c7b1cSBill PaulMASTER = $(YPDIR)/master.passwd 100778c7b1cSBill Paul.else 101778c7b1cSBill PaulMASTER = $(MASTER_PASSWD) 102778c7b1cSBill Paul.endif 103778c7b1cSBill PaulYPSERVERS = $(YPDIR)/ypservers # List of all NIS servers for a domain 104778c7b1cSBill PaulPUBLICKEY = $(YPSRCDIR)/publickey 1051fe3e67aSBill PaulNETID = $(YPSRCDIR)/netid 106778c7b1cSBill Paul 107778c7b1cSBill Paultarget: 108b2264be8SBill Paul @$(RM) $(NFILE) 109778c7b1cSBill Paul @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ 110920491cfSBill Paul cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ 111778c7b1cSBill Paul make -f ../Makefile all; echo "NIS Map update completed." 112778c7b1cSBill Paul 113778c7b1cSBill Paul# If you don't want some of these maps built, feel free to comment 114778c7b1cSBill Paul# them out from this list. 115778c7b1cSBill Paul# Note that we don't build the ethers or boorparams maps by default 116778c7b1cSBill Paul# since /etc/ethers and /etc/bootparams are not likely to be present 117778c7b1cSBill Paul# on all systems. 118778c7b1cSBill Paul# 119778c7b1cSBill Paul 120b2264be8SBill Paulall: master.passwd passwd hosts group networks protocols rpc \ 121b2264be8SBill Paul services servers netid # aliases publickey netgroup ethers bootparam 122778c7b1cSBill Paul 123778c7b1cSBill Paulethers: ethers.byname ethers.byaddr 124778c7b1cSBill Paulbootparam: bootparams 125778c7b1cSBill Paulhosts: hosts.byname hosts.byaddr 126778c7b1cSBill Paulnetworks: networks.byaddr networks.byname 127778c7b1cSBill Paulprotocols: protocols.bynumber protocols.byname 128778c7b1cSBill Paulrpc: rpc.byname rpc.bynumber 129778c7b1cSBill Paulservices: services.byname 130778c7b1cSBill Paulpasswd: passwd.byname passwd.byuid 131778c7b1cSBill Paulgroup: group.byname group.bygid 132778c7b1cSBill Paulnetgrp: netgroup 133778c7b1cSBill Paulnetid: netid.byname 134778c7b1cSBill Paulservers: ypservers 135778c7b1cSBill Paulpublickey: publickey.byname 136b2264be8SBill Paulaliases: mail.aliases 137778c7b1cSBill Paul 138778c7b1cSBill Paulmaster.passwd: master.passwd.byname master.passwd.byuid 139778c7b1cSBill Paul 140b3e93234SBill Paul# 141b3e93234SBill Paul# This is a special target used only when doing in-place updates with 142b3e93234SBill Paul# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd 143b3e93234SBill Paul# server and won't need to be remade. They will have to be pushed to the 144b3e93234SBill Paul# slaves however. Calling this target implicitly insures that this will 145b3e93234SBill Paul# happen. 146b3e93234SBill Paul# 147b3e93234SBill Paulpushpw: 148b3e93234SBill Paul @$(DBLOAD) -c 149b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi 150b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi 151b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi 152b3e93234SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi 153b3e93234SBill Paul 154b2264be8SBill Paulmail.aliases: $(ALIASES) 155b2264be8SBill Paul @echo "Updating $@..." 156b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 157b2264be8SBill Paul $(CAT) $(ALIASES) | \ 158b2264be8SBill Paul $(SED) -e "/^#/d" -e s/#.*$$// -e "/^ *$$/d" |\ 159b2264be8SBill Paul $(MKALIASES) \ 160b2264be8SBill Paul | $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP) 161b2264be8SBill Paul @$(MV) $(TMP) $@ 162b2264be8SBill Paul @$(DBLOAD) -c 163b2264be8SBill Paul @$(NEWALIASES) 164b2264be8SBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 165b2264be8SBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 166b2264be8SBill Paul 167778c7b1cSBill Paul 168778c7b1cSBill Paulypservers: $(YPSERVERS) 169778c7b1cSBill Paul @echo "Updating $@..." 170b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 171778c7b1cSBill Paul $(CAT) $(YPSERVERS) | \ 172778c7b1cSBill Paul $(AWK) '{ if ($$1 != "" && $$1 != "#") print $$0"\t"$$0 }' $^ \ 173b2264be8SBill Paul | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP) 174b2264be8SBill Paul @$(MV) $(TMP) $@ 175b2264be8SBill Paul @$(DBLOAD) -c 176778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 177778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 178778c7b1cSBill Paul 179b2264be8SBill Paul 180778c7b1cSBill Paulethers.byname: $(ETHERS) 181778c7b1cSBill Paul @echo "Updating $@..." 182b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 183778c7b1cSBill Paul $(CAT) $(ETHERS) | \ 184778c7b1cSBill Paul $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 185778c7b1cSBill Paul print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 186b2264be8SBill Paul -o $(YPMAPDIR)/$@ - $(TMP) 187b2264be8SBill Paul @$(MV) $(TMP) $@ 188b2264be8SBill Paul @$(DBLOAD) -c 189778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) -i $(ETHERS) $@; fi 190778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 191778c7b1cSBill Paul 192778c7b1cSBill Paul 193778c7b1cSBill Paulethers.byaddr: $(ETHERS) 194778c7b1cSBill Paul @echo "Updating $@..." 195b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 196778c7b1cSBill Paul $(CAT) $(ETHERS) | \ 197778c7b1cSBill Paul $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 198778c7b1cSBill Paul print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 199b2264be8SBill Paul -o $(YPMAPDIR)/$@ - $(TMP) 200b2264be8SBill Paul @$(MV) $(TMP) $@ 201b2264be8SBill Paul @$(DBLOAD) -c 202778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 203778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 204778c7b1cSBill Paul 205778c7b1cSBill Paul 206778c7b1cSBill Paulbootparams: $(BOOTPARAMS) 207778c7b1cSBill Paul @echo "Updating $@..." 208b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 209778c7b1cSBill Paul $(CAT) $(BOOTPARAMS) | \ 210778c7b1cSBill Paul $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 211778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \ 212b2264be8SBill Paul -o $(YPMAPDIR)/$@ - $(TMP) 213b2264be8SBill Paul @$(MV) $(TMP) $@ 214b2264be8SBill Paul @$(DBLOAD) -c 215778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 216778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 217778c7b1cSBill Paul 218778c7b1cSBill Paul 219778c7b1cSBill Paulnetgroup: $(NETGROUP) netgroup.byhost netgroup.byuser 220778c7b1cSBill Paul @echo "Updating $@..." 221b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 222778c7b1cSBill Paul $(CAT) $(NETGROUP) | \ 223778c7b1cSBill Paul $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 224778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 225b2264be8SBill Paul -o $(YPMAPDIR)/$@ - $(TMP) 226b2264be8SBill Paul @$(MV) $(TMP) $@ 227b2264be8SBill Paul @$(DBLOAD) -c 228778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 229778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 230778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 231778c7b1cSBill Paul 232778c7b1cSBill Paul 233778c7b1cSBill Paulnetgroup.byhost: $(NETGROUP) 234778c7b1cSBill Paul @echo "Updating $@..." 235b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 236778c7b1cSBill Paul $(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \ 237778c7b1cSBill Paul $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 238778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 239b2264be8SBill Paul -o $(YPMAPDIR)/$@ - $(TMP) 240b2264be8SBill Paul @$(MV) $(TMP) $@ 241b2264be8SBill Paul @$(DBLOAD) -c 242778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 243778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 244778c7b1cSBill Paul 245778c7b1cSBill Paul 246778c7b1cSBill Paulnetgroup.byuser: $(NETGROUP) 247778c7b1cSBill Paul @echo "Updating $@..." 248b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 249778c7b1cSBill Paul $(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \ 250778c7b1cSBill Paul $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 251778c7b1cSBill Paul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 252b2264be8SBill Paul -o $(YPMAPDIR)/$@ - $(TMP) 253b2264be8SBill Paul @$(MV) $(TMP) $@ 254b2264be8SBill Paul @$(DBLOAD) -c 255778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 256778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 257778c7b1cSBill Paul 258778c7b1cSBill Paul 259778c7b1cSBill Paulhosts.byname: $(HOSTS) 260778c7b1cSBill Paul @echo "Updating $@..." 261b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 262778c7b1cSBill Paul $(CAT) $(HOSTS) | \ 263778c7b1cSBill Paul $(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "#"; n++) \ 264778c7b1cSBill Paul print $$n"\t"$$0 }' $^ | $(DBLOAD) -i $(HOSTS) \ 265b2264be8SBill Paul -o $(YPMAPDIR)/$@ - $(TMP) 266b2264be8SBill Paul @$(MV) $(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 @$(MAKE) -f ../Makefile netid 271778c7b1cSBill Paul 272b2264be8SBill Paul 273778c7b1cSBill Paulhosts.byaddr: $(HOSTS) 274778c7b1cSBill Paul @echo "Updating $@..." 275b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 276778c7b1cSBill Paul $(CAT) $(HOSTS) | \ 277778c7b1cSBill Paul $(AWK) '$$1 !~ "#" { print $$1"\t"$$0 }' $^ \ 278b2264be8SBill Paul | $(DBLOAD) -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP) 279b2264be8SBill Paul @$(MV) $(TMP) $@ 280b2264be8SBill Paul @$(DBLOAD) -c 281778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 282778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 283778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 284778c7b1cSBill Paul 285778c7b1cSBill Paul 286778c7b1cSBill Paulnetworks.byname: $(NETWORKS) 287778c7b1cSBill Paul @echo "Updating $@..." 288b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 289778c7b1cSBill Paul $(CAT) $(NETWORKS) | \ 290778c7b1cSBill Paul $(AWK) \ 291778c7b1cSBill Paul '$$1 !~ "#" { print $$1"\t"$$0; \ 292778c7b1cSBill Paul for (n=3; n<=NF && $$n !~ "#"; n++) \ 293778c7b1cSBill Paul print $$n"\t"$$0 \ 294b2264be8SBill Paul }' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP) 295b2264be8SBill Paul @$(MV) $(TMP) $@ 296b2264be8SBill Paul @$(DBLOAD) -c 297778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 298778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 299778c7b1cSBill Paul 300778c7b1cSBill Paul 301778c7b1cSBill Paulnetworks.byaddr: $(NETWORKS) 302778c7b1cSBill Paul @echo "Updating $@..." 303b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 304778c7b1cSBill Paul $(CAT) $(NETWORKS) | \ 305778c7b1cSBill Paul $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \ 306b2264be8SBill Paul | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP) 307b2264be8SBill Paul @$(MV) $(TMP) $@ 308b2264be8SBill Paul @$(DBLOAD) -c 309778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 310778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 311778c7b1cSBill Paul 312778c7b1cSBill Paul 313778c7b1cSBill Paulprotocols.byname: $(PROTOCOLS) 314778c7b1cSBill Paul @echo "Updating $@..." 315b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 316778c7b1cSBill Paul $(CAT) $(PROTOCOLS) | \ 317778c7b1cSBill Paul $(AWK) \ 318778c7b1cSBill Paul '$$1 !~ "#" { print $$1"\t"$$0; \ 319778c7b1cSBill Paul for (n=3; n<=NF && $$n !~ "#"; n++) \ 320778c7b1cSBill Paul print $$n"\t"$$0 \ 321778c7b1cSBill Paul }' $^ | $(DBLOAD) -i $(PROTOCOLS) \ 322b2264be8SBill Paul -o $(YPMAPDIR)/$@ - $(TMP) 323b2264be8SBill Paul @$(MV) $(TMP) $@ 324b2264be8SBill Paul @$(DBLOAD) -c 325778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 326778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 327778c7b1cSBill Paul 328778c7b1cSBill Paul 329778c7b1cSBill Paulprotocols.bynumber: $(PROTOCOLS) 330778c7b1cSBill Paul @echo "Updating $@..." 331b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 332778c7b1cSBill Paul $(CAT) $(PROTOCOLS) | \ 333778c7b1cSBill Paul $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \ 334b2264be8SBill Paul | $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP) 335b2264be8SBill Paul @$(MV) $(TMP) $@ 336b2264be8SBill Paul @$(DBLOAD) -c 337778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 338778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 339778c7b1cSBill Paul 340778c7b1cSBill Paul 341778c7b1cSBill Paulrpc.byname: $(RPC) 342778c7b1cSBill Paul @echo "Updating $@..." 343b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 344778c7b1cSBill Paul $(CAT) $(RPC) | \ 345778c7b1cSBill Paul $(AWK) \ 346778c7b1cSBill Paul '$$1 !~ "#" { print $$1"\t"$$0; \ 347778c7b1cSBill Paul for (n=3; n<=NF && $$n !~ "#"; n++) \ 348778c7b1cSBill Paul print $$n"\t"$$0 \ 349b2264be8SBill Paul }' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP) 350b2264be8SBill Paul @$(MV) $(TMP) $@ 351b2264be8SBill Paul @$(DBLOAD) -c 352778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 353778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 354778c7b1cSBill Paul 355778c7b1cSBill Paul 356778c7b1cSBill Paulrpc.bynumber: $(RPC) 357778c7b1cSBill Paul @echo "Updating $@..." 358b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 359778c7b1cSBill Paul $(CAT) $(RPC) | \ 360778c7b1cSBill Paul $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \ 361b2264be8SBill Paul | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP) 362b2264be8SBill Paul @$(MV) $(TMP) $@ 363b2264be8SBill Paul @$(DBLOAD) -c 364778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 365778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 366778c7b1cSBill Paul 367778c7b1cSBill Paul 368778c7b1cSBill Paulservices.byname: $(SERVICES) 369778c7b1cSBill Paul @echo "Updating $@..." 370b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 371778c7b1cSBill Paul $(CAT) $(SERVICES) | \ 372778c7b1cSBill Paul $(AWK) \ 373778c7b1cSBill Paul '$$1 !~ "#" { if (index($$2,"udp")) { printf("%s/udp",$$1) } \ 374b3e93234SBill Paul else { printf("%s/tcp",$$1) }; print "\t"$$0 ; \ 375b3e93234SBill Paul print $$2"\t"$$0 ; \ 376b2264be8SBill Paul }' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP) 377b2264be8SBill Paul @$(MV) $(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 Paulpublickey.byname: $(PUBLICKEY) 384778c7b1cSBill Paul @echo "Updating $@..." 385b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 386b2264be8SBill Paul $(TMP) = `$(RCAT) $(NFILE)` 387778c7b1cSBill Paul $(AWK) '$$1 !~ "#" { print $$1"\t"$$2 }' $^ \ 388b2264be8SBill Paul | $(DBLOAD) -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP) 389b2264be8SBill Paul @$(MV) $(TMP) $@ 390b2264be8SBill Paul @$(DBLOAD) -c 391778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 392778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 393778c7b1cSBill Paul 394778c7b1cSBill Paul 395778c7b1cSBill Paul$(PASSWD): $(MASTER) 396778c7b1cSBill Paul @echo "Creating new $@ file from $(MASTER)..." 397778c7b1cSBill Paul @if [ ! $(UNSECURE) ]; then \ 398778c7b1cSBill Paul $(RCAT) $(MASTER) | \ 399778c7b1cSBill Paul $(AWK) -F: '{if ($$1 != "+") \ 400778c7b1cSBill Paul print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 401778c7b1cSBill Paul > $(PASSWD) ; \ 402778c7b1cSBill Paul else $(RCAT) $(MASTER) | \ 403778c7b1cSBill Paul $(AWK) -F: '{if ($$1 != "+") \ 404778c7b1cSBill Paul print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 405778c7b1cSBill Paul > $(PASSWD) ; fi 406778c7b1cSBill Paul 407778c7b1cSBill Paul 408778c7b1cSBill Paulpasswd.byname: $(PASSWD) 409778c7b1cSBill Paul @echo "Updating $@..." 410b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 411778c7b1cSBill Paul $(CAT) $(PASSWD) | \ 412778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 413b2264be8SBill Paul | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP) 414b2264be8SBill Paul @$(MV) $(TMP) $@ 415b2264be8SBill Paul @$(DBLOAD) -c 416778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 417778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 418778c7b1cSBill Paul 419b2264be8SBill Paul 420778c7b1cSBill Paulpasswd.byuid: $(PASSWD) 421778c7b1cSBill Paul @echo "Updating $@..." 422b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 423778c7b1cSBill Paul $(CAT) $(PASSWD) | \ 424778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 425b2264be8SBill Paul | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP) 426b2264be8SBill Paul @$(MV) $(TMP) $@ 427b2264be8SBill Paul @$(DBLOAD) -c 428778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 429778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 430778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 431778c7b1cSBill Paul 432778c7b1cSBill Paul 433778c7b1cSBill Paulgroup.byname: $(GROUP) 434778c7b1cSBill Paul @echo "Updating $@..." 435b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 436778c7b1cSBill Paul $(CAT) $(GROUP) | \ 437778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 438b2264be8SBill Paul | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP) 439b2264be8SBill Paul @$(MV) $(TMP) $@ 440b2264be8SBill Paul @$(DBLOAD) -c 441778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 442778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 443778c7b1cSBill Paul 444778c7b1cSBill Paul 445778c7b1cSBill Paulgroup.bygid: $(GROUP) 446778c7b1cSBill Paul @echo "Updating $@..." 447b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 448778c7b1cSBill Paul $(CAT) $(GROUP) | \ 449778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 450b2264be8SBill Paul | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP) 451b2264be8SBill Paul @$(MV) $(TMP) $@ 452b2264be8SBill Paul @$(DBLOAD) -c 453778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 454778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 455778c7b1cSBill Paul @$(MAKE) -f ../Makefile netid 456778c7b1cSBill Paul 457778c7b1cSBill Paul 458778c7b1cSBill Paulnetid.byname: $(GROUP) $(PASSWD) 459778c7b1cSBill Paul @echo "Updating $@..." 460b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 4611fe3e67aSBill Paul @$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \ 4621fe3e67aSBill Paul -d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP) 463b2264be8SBill Paul @$(MV) $(TMP) $@ 464b2264be8SBill Paul @$(DBLOAD) -c 465778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 466778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 467778c7b1cSBill Paul 468778c7b1cSBill Paul 469778c7b1cSBill Paulmaster.passwd.byname: $(MASTER) 470778c7b1cSBill Paul @echo "Updating $@..." 471b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 472778c7b1cSBill Paul $(CAT) $(MASTER) | \ 473778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 474b2264be8SBill Paul | $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP) 475b2264be8SBill Paul @$(MV) $(TMP) $@ 476b2264be8SBill Paul @$(DBLOAD) -c 477778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 478778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 479778c7b1cSBill Paul 480778c7b1cSBill Paul 481778c7b1cSBill Paulmaster.passwd.byuid: $(MASTER) 482778c7b1cSBill Paul @echo "Updating $@..." 483b2264be8SBill Paul @echo $@.$$$$ > $(NFILE) 484778c7b1cSBill Paul $(CAT) $(MASTER) | \ 485778c7b1cSBill Paul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 486b2264be8SBill Paul | $(DBLOAD) -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP) 487b2264be8SBill Paul @$(MV) $(TMP) $@ 488b2264be8SBill Paul @$(DBLOAD) -c 489778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 490778c7b1cSBill Paul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 491