Makefile.yp revision 37819
112891Swpaul# 212891Swpaul# Makefile for the NIS databases 312891Swpaul# 437819Sphk# $Id: Makefile.yp,v 1.24 1998/02/21 18:14:30 wpaul Exp $ 512891Swpaul# 612891Swpaul# This Makefile should only be run on the NIS master server of a domain. 712891Swpaul# All updated maps will be pushed to all NIS slave servers listed in the 812891Swpaul# /var/yp/ypservers file. Please make sure that the hostnames of all 912891Swpaul# NIS servers in your domain are listed in /var/yp/ypservers. 1012891Swpaul# 1112891Swpaul# This Makefile can be modified to support more NIS maps if desired. 1212891Swpaul# 1312891Swpaul 1412891Swpaul# If this machine is an NIS master, comment out this next line so 1512891Swpaul# that changes to the NIS maps can be propagated to the slave servers. 1612891Swpaul# (By default we assume that we are only serving a small domain with 1712891Swpaul# only one server.) 1812891Swpaul# 1912891SwpaulNOPUSH = "True" 2012891Swpaul 2112891Swpaul# If you want to use a FreeBSD NIS server to serve non-FreeBSD clients 2212891Swpaul# (i.e. clients who expect the password field in the passwd maps to be 2312891Swpaul# valid) then uncomment this line. This will cause $YPDIR/passwd to 2412891Swpaul# be generated with valid password fields. This is insecure: FreeBSD 2512891Swpaul# normally only serves the master.passwd maps (which have real encrypted 2612891Swpaul# passwords in them) to the superuser on other FreeBSD machines, but 2712891Swpaul# non-FreeBSD clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX, 2812891Swpaul# etc...) will only work properly in 'unsecure' mode. 2912891Swpaul# 3012891Swpaul#UNSECURE = "True" 3112891Swpaul 3219161Swpaul# The following line encodes the YP_INTERDOMAIN key into the hosts.byname 3319161Swpaul# and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve 3419161Swpaul# hosts not in the current domain. Commenting this line out will disable 3519161Swpaul# the DNS lookups. 3619161SwpaulB=-b 3719161Swpaul 3819161Swpaul# Normally, the master.passwd.* maps are guarded against access from 3919161Swpaul# non-privileged users. By commenting out the following line, the YP_SECURE 4019161Swpaul# key will be removed from these maps, allowing anyone to access them. 4119161SwpaulS=-s 4219161Swpaul 4312891Swpaul# These are commands which this Makefile needs to properly rebuild the 4412891Swpaul# NIS databases. Don't change these unless you have a good reason. Also 4512891Swpaul# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary 4612891Swpaul# and it'll break everything in sight. 4712891Swpaul# 4812891SwpaulAWK = /usr/bin/awk 4912891SwpaulRM = @/bin/rm -f 5015426SwpaulMV = @/bin/mv -f 5133100SwpaulRMV = /bin/mv -f 5212891SwpaulRCAT = /bin/cat 5312891SwpaulCAT = @$(RCAT) 5412891Swpaul 5517220SadamMKDB = /usr/sbin/yp_mkdb 5617220SadamDBLOAD = $(MKDB) -m `hostname` 5712891SwpaulMKNETID = /usr/libexec/mknetid 5815426SwpaulNEWALIASES = /usr/bin/newaliases 5913398SwpaulYPPUSH = /usr/sbin/yppush 6013896Swpaul.if !defined(UPDATE_DOMAIN) 6112891SwpaulDOMAIN = `/bin/domainname` 6213896Swpaul.else 6313896SwpaulDOMAIN = $(UPDATE_DOMAIN) 6413896Swpaul.endif 6512891SwpaulREVNETGROUP = /usr/libexec/revnetgroup 6633100SwpaulTMP = `echo $@.$$$$` 6712891Swpaul 6817220Sadam# It is advisable to create a separate directory to contain the 6917220Sadam# source files used to generate your NIS maps. If you intend to 7015426Swpaul# support multiple domains, something like /src/dir/$DOMAIN 7115426Swpaul# would work well. 7212891SwpaulYPSRCDIR = /etc 7331110Swpaul.if !defined(YP_DIR) 7412891SwpaulYPDIR = /var/yp 7531110Swpaul.else 7631110SwpaulYPDIR = $(YP_DIR) 7731110Swpaul.endif 7812891SwpaulYPMAPDIR = $(YPDIR)/$(DOMAIN) 7912891Swpaul 8012891Swpaul# These are the files from which the NIS databases are built. You may edit 8112891Swpaul# these to taste in the event that you wish to keep your NIS source files 8212891Swpaul# seperate from your NIS server's actual configuration files. Note that the 8312891Swpaul# NIS passwd and master.passwd files are stored in /var/yp: the server's 8412891Swpaul# real password database is not used by default. However, you may use 8512891Swpaul# the real /etc/passwd and /etc/master.passwd files by: 8612891Swpaul# 8712891Swpaul# 8837819Sphk# - invoking yppasswdd with `-t /etc/master.passwd' (yppasswdd will do a 8937819Sphk# 'pwd_mkdb' as needed if /etc/master.passwd is thus specified). 9012891Swpaul# - Specifying the location of the master.passwd file using the 9112891Swpaul# MASTER_PASSWD variable, i.e.: 9212891Swpaul# 9312891Swpaul# # make MASTER_PASSWD=/path/to/some/other/master.passwd 9412891Swpaul# 9512891Swpaul# - (optionally): editing this Makefile to change the default location. 9612891Swpaul# 9712891Swpaul# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw 9812891Swpaul# passwd file will be generated from the master.passwd file automagically. 9912891Swpaul# 10012891SwpaulETHERS = $(YPSRCDIR)/ethers # ethernet addresses (for rarpd) 10112891SwpaulBOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd) 10212891SwpaulHOSTS = $(YPSRCDIR)/hosts 10312891SwpaulNETWORKS = $(YPSRCDIR)/networks 10412891SwpaulPROTOCOLS = $(YPSRCDIR)/protocols 10512891SwpaulRPC = $(YPSRCDIR)/rpc 10612891SwpaulSERVICES = $(YPSRCDIR)/services 10712891SwpaulGROUP = $(YPSRCDIR)/group 10815426SwpaulALIASES = $(YPSRCDIR)/aliases 10915426SwpaulNETGROUP = $(YPDIR)/netgroup 11012891SwpaulPASSWD = $(YPDIR)/passwd 11112891Swpaul.if !defined(MASTER_PASSWD) 11212891SwpaulMASTER = $(YPDIR)/master.passwd 11312891Swpaul.else 11412891SwpaulMASTER = $(MASTER_PASSWD) 11512891Swpaul.endif 11612891SwpaulYPSERVERS = $(YPDIR)/ypservers # List of all NIS servers for a domain 11712891SwpaulPUBLICKEY = $(YPSRCDIR)/publickey 11816732SwpaulNETID = $(YPSRCDIR)/netid 11917266SpeterAMDHOST = $(YPSRCDIR)/amd.host 12012891Swpaul 12131110Swpaul# List of maps that are always built. 12231110Swpaul# If you want to omit some of them, feel free to comment 12331110Swpaul# them out from this list. 12431110SwpaulTARGETS= servers hosts networks protocols rpc services group 12531110Swpaul#TARGETS+= aliases 12631110Swpaul 12731110Swpaul# Sanity checks: filter out targets we can't build 12831110Swpaul# Note that we don't build the ethers or boorparams maps by default 12931110Swpaul# since /etc/ethers and /etc/bootparams are not likely to be present 13031110Swpaul# on all systems. 13131110Swpaul.if exists($(ETHERS)) 13231110SwpaulTARGETS+= ethers 13331110Swpaul.else 13431110SwpaulETHERS= /dev/null 13531110Swpaul.endif 13631110Swpaul 13731110Swpaul.if exists($(BOOTPARAMS)) 13831110SwpaulTARGETS+= bootparams 13931110Swpaul.else 14031110SwpaulBOOTPARAMS= /dev/null 14131110Swpaul.endif 14231110Swpaul 14331110Swpaul.if exists($(NETGROUP)) 14431110SwpaulTARGETS+= netgrp 14531110Swpaul.else 14631110SwpaulNETGROUP= /dev/null 14731110Swpaul.endif 14831110Swpaul 14931110Swpaul.if exists($(MASTER)) 15031110SwpaulTARGETS+= passwd master.passwd netid 15131110Swpaul.else 15231110SwpaulMASTER= /dev/null 15331110SwpaulTARGETS+= nopass 15431110Swpaul.endif 15531110Swpaul 15631110Swpaul.if exists($(PUBLICKEY)) 15731110SwpaulTARGETS+= publickey 15831110Swpaul.else 15931110SwpaulPUBLICKEY= /dev/null 16031110Swpaul.endif 16131110Swpaul 16231110Swpaul.if exists($(AMDHOST)) 16331110SwpaulTARGETS+= amd.host 16431110Swpaul.else 16531110SwpaulAMDHOST= /dev/null 16631110Swpaul.endif 16731110Swpaul 16812891Swpaultarget: 16912891Swpaul @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ 17013896Swpaul cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ 17112891Swpaul make -f ../Makefile all; echo "NIS Map update completed." 17212891Swpaul 17331110Swpaulall: $(TARGETS) 17412891Swpaul 17512891Swpaulethers: ethers.byname ethers.byaddr 17612891Swpaulbootparam: bootparams 17712891Swpaulhosts: hosts.byname hosts.byaddr 17812891Swpaulnetworks: networks.byaddr networks.byname 17912891Swpaulprotocols: protocols.bynumber protocols.byname 18012891Swpaulrpc: rpc.byname rpc.bynumber 18112891Swpaulservices: services.byname 18212891Swpaulpasswd: passwd.byname passwd.byuid 18312891Swpaulgroup: group.byname group.bygid 18412891Swpaulnetgrp: netgroup 18512891Swpaulnetid: netid.byname 18612891Swpaulservers: ypservers 18712891Swpaulpublickey: publickey.byname 18815426Swpaulaliases: mail.aliases 18912891Swpaul 19012891Swpaulmaster.passwd: master.passwd.byname master.passwd.byuid 19112891Swpaul 19216118Swpaul# 19316118Swpaul# This is a special target used only when doing in-place updates with 19416118Swpaul# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd 19516118Swpaul# server and won't need to be remade. They will have to be pushed to the 19616118Swpaul# slaves however. Calling this target implicitly insures that this will 19716118Swpaul# happen. 19816118Swpaul# 19916118Swpaulpushpw: 20016118Swpaul @$(DBLOAD) -c 20116118Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi 20216118Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi 20316118Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi 20416118Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi 20516118Swpaul 20631110Swpaulpushmap: 20731110Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi 20831110Swpaul 20931110Swpaulnopass: 21031110Swpaul @echo "" 21131110Swpaul @echo " ********WARNING********" 21231110Swpaul @echo " Couldn't find the master.passwd source file. This file" 21331110Swpaul @echo " is needed to generate the master.passwd and passwd maps." 21431110Swpaul @echo " The default location is /var/yp/master.passwd. You should" 21531110Swpaul @echo " edit /var/yp/Makefile and set the MASTER variable to point" 21631110Swpaul @echo " to the source file you wish to use for building the passwd" 21731110Swpaul @echo " maps, or else invoke make(1) in the following manner:" 21831110Swpaul @echo " 21931110Swpaul @echo " make MASTER_PASSWD=/path/to/master.passwd" 22031110Swpaul @echo "" 22131110Swpaul 22215426Swpaulmail.aliases: $(ALIASES) 22315426Swpaul @echo "Updating $@..." 22417220Sadam @$(NEWALIASES) -oA$(ALIASES) 22517481Sadam @$(MKDB) -u $(ALIASES).db \ 22633100Swpaul | $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \ 22733100Swpaul $(RMV) $(TMP) $@ 22815426Swpaul @$(DBLOAD) -c 22916044Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 23016044Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 23112891Swpaul 23215426Swpaul 23312891Swpaulypservers: $(YPSERVERS) 23412891Swpaul @echo "Updating $@..." 23512891Swpaul $(CAT) $(YPSERVERS) | \ 23632775Ssteve $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' $^ \ 23733100Swpaul | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \ 23833100Swpaul $(RMV) $(TMP) $@ 23915426Swpaul @$(DBLOAD) -c 24012891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 24112891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 24212891Swpaul 24315426Swpaul 24412891Swpaulethers.byname: $(ETHERS) 24512891Swpaul @echo "Updating $@..." 24631110Swpaul.if ${ETHERS} == "/dev/null" 24731110Swpaul @echo "Ethers source file not found -- skipping" 24831110Swpaul.else 24912891Swpaul $(CAT) $(ETHERS) | \ 25032775Ssteve $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 25112891Swpaul print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 25233100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 25315426Swpaul @$(DBLOAD) -c 25417268Speter @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 25512891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 25631110Swpaul.endif 25712891Swpaul 25812891Swpaulethers.byaddr: $(ETHERS) 25912891Swpaul @echo "Updating $@..." 26031110Swpaul.if ${ETHERS} == "/dev/null" 26131110Swpaul @echo "Ethers source file not found -- skipping" 26231110Swpaul.else 26312891Swpaul $(CAT) $(ETHERS) | \ 26432775Ssteve $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 26512891Swpaul print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 26633100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 26715426Swpaul @$(DBLOAD) -c 26812891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 26912891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 27031110Swpaul.endif 27112891Swpaul 27212891Swpaul 27312891Swpaulbootparams: $(BOOTPARAMS) 27412891Swpaul @echo "Updating $@..." 27531110Swpaul.if ${BOOTPARAMS} == "/dev/null" 27631110Swpaul @echo "Bootparams source file not found -- skipping" 27731110Swpaul.else 27812891Swpaul $(CAT) $(BOOTPARAMS) | \ 27932775Ssteve $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 28012891Swpaul print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \ 28133100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 28215426Swpaul @$(DBLOAD) -c 28312891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 28412891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 28531110Swpaul.endif 28612891Swpaul 28712891Swpaul 28812891Swpaulnetgroup: $(NETGROUP) netgroup.byhost netgroup.byuser 28912891Swpaul @echo "Updating $@..." 29031110Swpaul.if ${NETGROUP} == "/dev/null" 29131110Swpaul @echo "Netgroup source file not found -- skipping" 29231110Swpaul.else 29312891Swpaul $(CAT) $(NETGROUP) | \ 29432775Ssteve $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 29512891Swpaul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 29633100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 29715426Swpaul @$(DBLOAD) -c 29812891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 29912891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 30012891Swpaul @$(MAKE) -f ../Makefile netid 30131110Swpaul.endif 30212891Swpaul 30312891Swpaul 30412891Swpaulnetgroup.byhost: $(NETGROUP) 30512891Swpaul @echo "Updating $@..." 30631110Swpaul.if ${NETGROUP} == "/dev/null" 30731110Swpaul @echo "Netgroup source file not found -- skipping" 30831110Swpaul.else 30912891Swpaul $(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \ 31032775Ssteve $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 31112891Swpaul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 31233100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 31315426Swpaul @$(DBLOAD) -c 31412891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 31512891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 31631110Swpaul.endif 31712891Swpaul 31812891Swpaul 31912891Swpaulnetgroup.byuser: $(NETGROUP) 32012891Swpaul @echo "Updating $@..." 32131110Swpaul.if ${NETGROUP} == "/dev/null" 32231110Swpaul @echo "Netgroup source file not found -- skipping" 32331110Swpaul.else 32412891Swpaul $(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \ 32532775Ssteve $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 32612891Swpaul print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 32733100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 32815426Swpaul @$(DBLOAD) -c 32912891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 33012891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 33131110Swpaul.endif 33212891Swpaul 33312891Swpaul 33412891Swpaulhosts.byname: $(HOSTS) 33512891Swpaul @echo "Updating $@..." 33612891Swpaul $(CAT) $(HOSTS) | \ 33732775Ssteve $(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ 33819785Swpaul print $$n"\t"$$0 }' $^ | $(DBLOAD) ${B} -i $(HOSTS) \ 33933100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 34015426Swpaul @$(DBLOAD) -c 34112891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 34212891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 34312891Swpaul @$(MAKE) -f ../Makefile netid 34412891Swpaul 34515426Swpaul 34612891Swpaulhosts.byaddr: $(HOSTS) 34712891Swpaul @echo "Updating $@..." 34812891Swpaul $(CAT) $(HOSTS) | \ 34932775Ssteve $(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $^ \ 35033100Swpaul | $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP); \ 35133100Swpaul $(RMV) $(TMP) $@ 35215426Swpaul @$(DBLOAD) -c 35312891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 35412891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 35512891Swpaul @$(MAKE) -f ../Makefile netid 35612891Swpaul 35712891Swpaul 35812891Swpaulnetworks.byname: $(NETWORKS) 35912891Swpaul @echo "Updating $@..." 36012891Swpaul $(CAT) $(NETWORKS) | \ 36112891Swpaul $(AWK) \ 36232775Ssteve '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 36332775Ssteve for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 36412891Swpaul print $$n"\t"$$0 \ 36533100Swpaul }' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 36633100Swpaul $(RMV) $(TMP) $@ 36715426Swpaul @$(DBLOAD) -c 36812891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 36912891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 37012891Swpaul 37112891Swpaul 37212891Swpaulnetworks.byaddr: $(NETWORKS) 37312891Swpaul @echo "Updating $@..." 37412891Swpaul $(CAT) $(NETWORKS) | \ 37532775Ssteve $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 37633100Swpaul | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 37733100Swpaul $(RMV) $(TMP) $@ 37815426Swpaul @$(DBLOAD) -c 37912891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 38012891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 38112891Swpaul 38212891Swpaul 38312891Swpaulprotocols.byname: $(PROTOCOLS) 38412891Swpaul @echo "Updating $@..." 38512891Swpaul $(CAT) $(PROTOCOLS) | \ 38612891Swpaul $(AWK) \ 38732775Ssteve '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 38832775Ssteve for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 38912891Swpaul print $$n"\t"$$0 \ 39012891Swpaul }' $^ | $(DBLOAD) -i $(PROTOCOLS) \ 39133100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 39215426Swpaul @$(DBLOAD) -c 39312891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 39412891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 39512891Swpaul 39612891Swpaul 39712891Swpaulprotocols.bynumber: $(PROTOCOLS) 39812891Swpaul @echo "Updating $@..." 39912891Swpaul $(CAT) $(PROTOCOLS) | \ 40032775Ssteve $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 40133100Swpaul | $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP); \ 40233100Swpaul $(RMV) $(TMP) $@ 40315426Swpaul @$(DBLOAD) -c 40412891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 40512891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 40612891Swpaul 40712891Swpaul 40812891Swpaulrpc.byname: $(RPC) 40912891Swpaul @echo "Updating $@..." 41012891Swpaul $(CAT) $(RPC) | \ 41112891Swpaul $(AWK) \ 41232775Ssteve '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 41332775Ssteve for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 41412891Swpaul print $$n"\t"$$0 \ 41533100Swpaul }' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 41633100Swpaul $(RMV) $(TMP) $@ 41715426Swpaul @$(DBLOAD) -c 41812891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 41912891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 42012891Swpaul 42112891Swpaul 42212891Swpaulrpc.bynumber: $(RPC) 42312891Swpaul @echo "Updating $@..." 42412891Swpaul $(CAT) $(RPC) | \ 42532775Ssteve $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 42633100Swpaul | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 42733100Swpaul $(RMV) $(TMP) $@ 42815426Swpaul @$(DBLOAD) -c 42912891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 43012891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 43112891Swpaul 43212891Swpaul 43312891Swpaulservices.byname: $(SERVICES) 43412891Swpaul @echo "Updating $@..." 43512891Swpaul $(CAT) $(SERVICES) | \ 43612891Swpaul $(AWK) \ 43732775Ssteve '$$1 !~ "^#.*" { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \ 43833300Swpaul if (split($$2, t, "/")) { \ 43933300Swpaul printf("%s/%s", $$n, t[2]) }; \ 44033536Swpaul print "\t"$$0; \ 44133300Swpaul if (n == 1) n = 2; \ 44233300Swpaul } ; print $$2"\t"$$0 ; \ 44333100Swpaul }' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \ 44433100Swpaul $(RMV) $(TMP) $@ 44515426Swpaul @$(DBLOAD) -c 44612891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 44712891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 44812891Swpaul 44912891Swpaul 45012891Swpaulpublickey.byname: $(PUBLICKEY) 45112891Swpaul @echo "Updating $@..." 45231110Swpaul.if ${PUBLICKEY} == "/dev/null" 45331110Swpaul @echo "Publickey source file not found -- skipping" 45431110Swpaul.else 45522495Swpaul $(CAT) $(PUBLICKEY) | \ 45632775Ssteve $(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $^ \ 45733100Swpaul | $(DBLOAD) -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \ 45833100Swpaul $(RMV) $(TMP) $@ 45915426Swpaul @$(DBLOAD) -c 46012891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 46112891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 46231110Swpaul.endif 46312891Swpaul 46412891Swpaul 46512891Swpaul$(PASSWD): $(MASTER) 46612891Swpaul @echo "Creating new $@ file from $(MASTER)..." 46712891Swpaul @if [ ! $(UNSECURE) ]; then \ 46812891Swpaul $(RCAT) $(MASTER) | \ 46912891Swpaul $(AWK) -F: '{if ($$1 != "+") \ 47012891Swpaul print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 47112891Swpaul > $(PASSWD) ; \ 47212891Swpaul else $(RCAT) $(MASTER) | \ 47312891Swpaul $(AWK) -F: '{if ($$1 != "+") \ 47412891Swpaul print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 47512891Swpaul > $(PASSWD) ; fi 47612891Swpaul 47712891Swpaul 47812891Swpaulpasswd.byname: $(PASSWD) 47912891Swpaul @echo "Updating $@..." 48012891Swpaul $(CAT) $(PASSWD) | \ 48112891Swpaul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 48233100Swpaul | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 48333100Swpaul $(RMV) $(TMP) $@ 48415426Swpaul @$(DBLOAD) -c 48512891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 48612891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 48712891Swpaul 48815426Swpaul 48912891Swpaulpasswd.byuid: $(PASSWD) 49012891Swpaul @echo "Updating $@..." 49112891Swpaul $(CAT) $(PASSWD) | \ 49212891Swpaul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 49333100Swpaul | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 49433100Swpaul $(RMV) $(TMP) $@ 49515426Swpaul @$(DBLOAD) -c 49612891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 49712891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 49812891Swpaul @$(MAKE) -f ../Makefile netid 49912891Swpaul 50012891Swpaul 50112891Swpaulgroup.byname: $(GROUP) 50212891Swpaul @echo "Updating $@..." 50312891Swpaul $(CAT) $(GROUP) | \ 50412891Swpaul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 50533100Swpaul | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 50633100Swpaul $(RMV) $(TMP) $@ 50715426Swpaul @$(DBLOAD) -c 50812891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 50912891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 51012891Swpaul 51112891Swpaul 51212891Swpaulgroup.bygid: $(GROUP) 51312891Swpaul @echo "Updating $@..." 51412891Swpaul $(CAT) $(GROUP) | \ 51512891Swpaul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 51633100Swpaul | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 51733100Swpaul $(RMV) $(TMP) $@ 51815426Swpaul @$(DBLOAD) -c 51912891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 52012891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 52112891Swpaul @$(MAKE) -f ../Makefile netid 52212891Swpaul 52312891Swpaul 52412891Swpaulnetid.byname: $(GROUP) $(PASSWD) 52512891Swpaul @echo "Updating $@..." 52616732Swpaul @$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \ 52733100Swpaul -d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \ 52833100Swpaul $(RMV) $(TMP) $@ 52915426Swpaul @$(DBLOAD) -c 53012891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 53112891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 53212891Swpaul 53312891Swpaul 53412891Swpaulmaster.passwd.byname: $(MASTER) 53512891Swpaul @echo "Updating $@..." 53631110Swpaul.if ${MASTER} == "/dev/null" 53731110Swpaul @echo "Master.passwd source file not found -- skipping" 53831110Swpaul.else 53912891Swpaul $(CAT) $(MASTER) | \ 54012891Swpaul $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 54133100Swpaul | $(DBLOAD) ${S} -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 54233100Swpaul $(RMV) $(TMP) $@ 54315426Swpaul @$(DBLOAD) -c 54412891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 54512891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 54631110Swpaul.endif 54712891Swpaul 54812891Swpaul 54912891Swpaulmaster.passwd.byuid: $(MASTER) 55012891Swpaul @echo "Updating $@..." 55131110Swpaul.if ${MASTER} == "/dev/null" 55231110Swpaul @echo "Master.passwd source file not found -- skipping" 55331110Swpaul.else 55412891Swpaul $(CAT) $(MASTER) | \ 55512891Swpaul $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 55633100Swpaul | $(DBLOAD) ${S} -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 55733100Swpaul $(RMV) $(TMP) $@ 55815426Swpaul @$(DBLOAD) -c 55912891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 56012891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 56131110Swpaul.endif 56217266Speter 56331110Swpaul 56417266Speteramd.host: $(AMDHOST) 56517266Speter @echo "Updating $@..." 56617266Speter $(CAT) $(AMDHOST) | \ 56732775Ssteve $(AWK) '$$1 !~ "^#.*" { \ 56817266Speter for (i = 1; i <= NF; i++) \ 56917266Speter if (i == NF) { \ 57017266Speter if (substr($$i, length($$i), 1) == "\\") \ 57117266Speter printf("%s", substr($$i, 1, length($$i) - 1)); \ 57217266Speter else \ 57317266Speter printf("%s\n", $$i); \ 57417266Speter } \ 57517266Speter else \ 57617266Speter printf("%s ", $$i); \ 57717266Speter }' | \ 57833100Swpaul $(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP); \ 57933100Swpaul $(RMV) $(TMP) $@ 58017266Speter @$(DBLOAD) -c 58117266Speter @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 58217266Speter @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 58317266Speter 584