112891Swpaul# 212891Swpaul# Makefile for the NIS databases 312891Swpaul# 450479Speter# $FreeBSD$ 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 14194968Sbrian# If this machine is an NIS master, reset this variable (NOPUSH=) 15194968Sbrian# in Makefile.local so that changes to the NIS maps can be propagated to 16194968Sbrian# the slave servers. (By default we assume that we are only serving a 17194968Sbrian# small domain with only one server.) 1812891Swpaul# 1912891SwpaulNOPUSH = "True" 2012891Swpaul 21194968Sbrian# If this machine does not wish to generate a linux-style shadow map 22194968Sbrian# from the master.passwd file, reset this variable (SHADOW=) in 23194968Sbrian# Makefile.local. 24194968SbrianSHADOW = "True" 25194968Sbrian 2612891Swpaul# If you want to use a FreeBSD NIS server to serve non-FreeBSD clients 2712891Swpaul# (i.e. clients who expect the password field in the passwd maps to be 28194968Sbrian# valid) then set this variable (UNSECURE="True") in Makefile.local. 29194968Sbrian# This will cause $YPDIR/passwd to be generated with valid password 30194968Sbrian# fields. This is insecure: FreeBSD normally only serves the 31194968Sbrian# master.passwd and shadow maps (which have real encrypted passwords 32194968Sbrian# in them) to the superuser on other FreeBSD machines, but non-FreeBSD 33194968Sbrian# clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX, etc...) 34194968Sbrian# will only work properly in 'unsecure' mode. 3512891Swpaul# 3612891Swpaul#UNSECURE = "True" 3712891Swpaul 3819161Swpaul# The following line encodes the YP_INTERDOMAIN key into the hosts.byname 3919161Swpaul# and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve 40194968Sbrian# hosts not in the current domain. Resetting this variable in 41194968Sbrian# Makefile.local (B=) will disable the DNS lookups. 4219161SwpaulB=-b 4319161Swpaul 44194968Sbrian# Normally, the master.passwd.* and shadow.* maps are guarded against access 45194968Sbrian# from non-privileged users. By resetting S in Makefile.local (S=), the 46194968Sbrian# YP_SECURE key will be removed from these maps, allowing anyone to access 47194968Sbrian# them. 4819161SwpaulS=-s 4919161Swpaul 5012891Swpaul# These are commands which this Makefile needs to properly rebuild the 5112891Swpaul# NIS databases. Don't change these unless you have a good reason. Also 5212891Swpaul# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary 5312891Swpaul# and it'll break everything in sight. 5412891Swpaul# 5512891SwpaulAWK = /usr/bin/awk 5612891SwpaulRM = @/bin/rm -f 5715426SwpaulMV = @/bin/mv -f 5833100SwpaulRMV = /bin/mv -f 5912891Swpaul 6017220SadamMKDB = /usr/sbin/yp_mkdb 6117220SadamDBLOAD = $(MKDB) -m `hostname` 6212891SwpaulMKNETID = /usr/libexec/mknetid 6315426SwpaulNEWALIASES = /usr/bin/newaliases 6413398SwpaulYPPUSH = /usr/sbin/yppush 6513896Swpaul.if !defined(UPDATE_DOMAIN) 6612891SwpaulDOMAIN = `/bin/domainname` 6713896Swpaul.else 6813896SwpaulDOMAIN = $(UPDATE_DOMAIN) 6913896Swpaul.endif 7012891SwpaulREVNETGROUP = /usr/libexec/revnetgroup 7133100SwpaulTMP = `echo $@.$$$$` 7212891Swpaul 7317220Sadam# It is advisable to create a separate directory to contain the 7417220Sadam# source files used to generate your NIS maps. If you intend to 7515426Swpaul# support multiple domains, something like /src/dir/$DOMAIN 7615426Swpaul# would work well. 7712891SwpaulYPSRCDIR = /etc 7831110Swpaul.if !defined(YP_DIR) 7912891SwpaulYPDIR = /var/yp 8031110Swpaul.else 8131110SwpaulYPDIR = $(YP_DIR) 8231110Swpaul.endif 8312891SwpaulYPMAPDIR = $(YPDIR)/$(DOMAIN) 8412891Swpaul 8512891Swpaul# These are the files from which the NIS databases are built. You may edit 8612891Swpaul# these to taste in the event that you wish to keep your NIS source files 8772091Sasmodai# separate from your NIS server's actual configuration files. Note that the 8812891Swpaul# NIS passwd and master.passwd files are stored in /var/yp: the server's 8912891Swpaul# real password database is not used by default. However, you may use 9012891Swpaul# the real /etc/passwd and /etc/master.passwd files by: 9112891Swpaul# 9212891Swpaul# 9337819Sphk# - invoking yppasswdd with `-t /etc/master.passwd' (yppasswdd will do a 9437819Sphk# 'pwd_mkdb' as needed if /etc/master.passwd is thus specified). 9512891Swpaul# - Specifying the location of the master.passwd file using the 9612891Swpaul# MASTER_PASSWD variable, i.e.: 9712891Swpaul# 9812891Swpaul# # make MASTER_PASSWD=/path/to/some/other/master.passwd 9912891Swpaul# 10012891Swpaul# - (optionally): editing this Makefile to change the default location. 10112891Swpaul# 10212891Swpaul# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw 10312891Swpaul# passwd file will be generated from the master.passwd file automagically. 10412891Swpaul# 10512891SwpaulETHERS = $(YPSRCDIR)/ethers # ethernet addresses (for rarpd) 106287375SasomersEUI64 = $(YPSRCDIR)/eui64 # eui64 addresses (for firewire) 10712891SwpaulBOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd) 10812891SwpaulHOSTS = $(YPSRCDIR)/hosts 109145801SumeIPNODES = $(YPDIR)/ipnodes 11012891SwpaulNETWORKS = $(YPSRCDIR)/networks 11112891SwpaulPROTOCOLS = $(YPSRCDIR)/protocols 11212891SwpaulRPC = $(YPSRCDIR)/rpc 11312891SwpaulSERVICES = $(YPSRCDIR)/services 114112458SrobertSHELLS = $(YPSRCDIR)/shells 11512891SwpaulGROUP = $(YPSRCDIR)/group 11676621SgshapiroALIASES = $(YPSRCDIR)/mail/aliases 11715426SwpaulNETGROUP = $(YPDIR)/netgroup 11812891SwpaulPASSWD = $(YPDIR)/passwd 11912891Swpaul.if !defined(MASTER_PASSWD) 12012891SwpaulMASTER = $(YPDIR)/master.passwd 12112891Swpaul.else 12212891SwpaulMASTER = $(MASTER_PASSWD) 12312891Swpaul.endif 12412891SwpaulYPSERVERS = $(YPDIR)/ypservers # List of all NIS servers for a domain 12512891SwpaulPUBLICKEY = $(YPSRCDIR)/publickey 12616732SwpaulNETID = $(YPSRCDIR)/netid 12790320SmarkmAMDHOST = $(YPSRCDIR)/amd.map 12812891Swpaul 129194968Sbriantarget: 130194968Sbrian @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ 131194968Sbrian cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ 132194968Sbrian make -f ../Makefile all; echo "NIS Map update completed." 133194968Sbrian 134194968Sbrian# Read overrides. Note, the current directory will be /var/yp/<domain> 135194968Sbrian# when 'all' is built. 136194968Sbrian.if exists(${YPDIR}/Makefile.local) 137194968Sbrian.include "${YPDIR}/Makefile.local" 138194968Sbrian.endif 139194968Sbrian 14031110Swpaul# List of maps that are always built. 14131110Swpaul# If you want to omit some of them, feel free to comment 14231110Swpaul# them out from this list. 143112458SrobertTARGETS= servers hosts networks protocols rpc services shells group 144292720SumeTARGETS+= ipnodes 14531110Swpaul#TARGETS+= aliases 14631110Swpaul 14731110Swpaul# Sanity checks: filter out targets we can't build 148287375Sasomers# Note that we don't build the ethers, eui64, or boorparams maps by default 149287375Sasomers# since /etc/ethers, /etc/eui64 and /etc/bootparams are not likely to be present 15031110Swpaul# on all systems. 15131110Swpaul.if exists($(ETHERS)) 15231110SwpaulTARGETS+= ethers 15331110Swpaul.else 15431110SwpaulETHERS= /dev/null 15531110Swpaul.endif 15631110Swpaul 157287375Sasomers.if exists($(EUI64)) 158287375SasomersTARGETS+= eui64 159287375Sasomers.else 160287375SasomersEUI64= /dev/null 161287375Sasomers.endif 162287375Sasomers 16331110Swpaul.if exists($(BOOTPARAMS)) 16431110SwpaulTARGETS+= bootparams 16531110Swpaul.else 16631110SwpaulBOOTPARAMS= /dev/null 16731110Swpaul.endif 16831110Swpaul 16931110Swpaul.if exists($(NETGROUP)) 17031110SwpaulTARGETS+= netgrp 17131110Swpaul.else 17231110SwpaulNETGROUP= /dev/null 17331110Swpaul.endif 17431110Swpaul 17531110Swpaul.if exists($(MASTER)) 17631110SwpaulTARGETS+= passwd master.passwd netid 177194968Sbrian.if ${SHADOW} == "\"True\"" 178194968SbrianTARGETS+= shadow 179194968Sbrian.endif 18031110Swpaul.else 18131110SwpaulMASTER= /dev/null 18231110SwpaulTARGETS+= nopass 18331110Swpaul.endif 18431110Swpaul 18531110Swpaul.if exists($(PUBLICKEY)) 18631110SwpaulTARGETS+= publickey 18731110Swpaul.else 18831110SwpaulPUBLICKEY= /dev/null 18931110Swpaul.endif 19031110Swpaul 19131110Swpaul.if exists($(AMDHOST)) 19290320SmarkmTARGETS+= amd.map 19331110Swpaul.else 19431110SwpaulAMDHOST= /dev/null 19531110Swpaul.endif 19631110Swpaul 197292720Sume.if !exists($(IPNODES)) 198292720SumeIPNODES= $(HOSTS) 199145801Sume.endif 200145801Sume 20131110Swpaulall: $(TARGETS) 20212891Swpaul 20312891Swpaulethers: ethers.byname ethers.byaddr 204287375Sasomerseui64: eui64.byname eui64.byid 20512891Swpaulbootparam: bootparams 20612891Swpaulhosts: hosts.byname hosts.byaddr 207145801Sumeipnodes: ipnodes.byname ipnodes.byaddr 20812891Swpaulnetworks: networks.byaddr networks.byname 20912891Swpaulprotocols: protocols.bynumber protocols.byname 21012891Swpaulrpc: rpc.byname rpc.bynumber 21112891Swpaulservices: services.byname 21212891Swpaulpasswd: passwd.byname passwd.byuid 213194968Sbrianshadow: shadow.byname shadow.byuid 21412891Swpaulgroup: group.byname group.bygid 21512891Swpaulnetgrp: netgroup 21612891Swpaulnetid: netid.byname 21712891Swpaulservers: ypservers 21812891Swpaulpublickey: publickey.byname 21915426Swpaulaliases: mail.aliases 22012891Swpaul 22112891Swpaulmaster.passwd: master.passwd.byname master.passwd.byuid 22212891Swpaul 22316118Swpaul# 22416118Swpaul# This is a special target used only when doing in-place updates with 22516118Swpaul# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd 22616118Swpaul# server and won't need to be remade. They will have to be pushed to the 22716118Swpaul# slaves however. Calling this target implicitly insures that this will 22816118Swpaul# happen. 22916118Swpaul# 23016118Swpaulpushpw: 23116118Swpaul @$(DBLOAD) -c 23216118Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi 23316118Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi 234194968Sbrian.if ${SHADOW} == "\"True\"" 235194968Sbrian @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byname ; fi 236194968Sbrian @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byuid ; fi 237194968Sbrian.endif 23816118Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi 23916118Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi 24016118Swpaul 24131110Swpaulpushmap: 24231110Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi 24331110Swpaul 24431110Swpaulnopass: 24531110Swpaul @echo "" 24631110Swpaul @echo " ********WARNING********" 24731110Swpaul @echo " Couldn't find the master.passwd source file. This file" 24831110Swpaul @echo " is needed to generate the master.passwd and passwd maps." 24931110Swpaul @echo " The default location is /var/yp/master.passwd. You should" 25031110Swpaul @echo " edit /var/yp/Makefile and set the MASTER variable to point" 25131110Swpaul @echo " to the source file you wish to use for building the passwd" 25231110Swpaul @echo " maps, or else invoke make(1) in the following manner:" 25348199Sn_hibma @echo "" 25431110Swpaul @echo " make MASTER_PASSWD=/path/to/master.passwd" 25531110Swpaul @echo "" 25631110Swpaul 25715426Swpaulmail.aliases: $(ALIASES) 25815426Swpaul @echo "Updating $@..." 25917220Sadam @$(NEWALIASES) -oA$(ALIASES) 26017481Sadam @$(MKDB) -u $(ALIASES).db \ 26133100Swpaul | $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \ 26233100Swpaul $(RMV) $(TMP) $@ 26315426Swpaul @$(DBLOAD) -c 26416044Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 26516044Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 26612891Swpaul 26715426Swpaul 26812891Swpaulypservers: $(YPSERVERS) 26912891Swpaul @echo "Updating $@..." 270116301Sru @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \ 271116301Sru $(YPSERVERS) \ 27233100Swpaul | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \ 27333100Swpaul $(RMV) $(TMP) $@ 27415426Swpaul @$(DBLOAD) -c 27512891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 27612891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 27712891Swpaul 27812891Swpaulethers.byname: $(ETHERS) 27912891Swpaul @echo "Updating $@..." 28031110Swpaul.if ${ETHERS} == "/dev/null" 28131110Swpaul @echo "Ethers source file not found -- skipping" 28231110Swpaul.else 283116301Sru @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 284116301Sru print $$2"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \ 28533100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 28615426Swpaul @$(DBLOAD) -c 28717268Speter @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 28812891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 28931110Swpaul.endif 29012891Swpaul 29112891Swpaulethers.byaddr: $(ETHERS) 29212891Swpaul @echo "Updating $@..." 29331110Swpaul.if ${ETHERS} == "/dev/null" 29431110Swpaul @echo "Ethers source file not found -- skipping" 29531110Swpaul.else 296116301Sru @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 297116301Sru print $$1"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \ 29833100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 29915426Swpaul @$(DBLOAD) -c 30012891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 30112891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 30231110Swpaul.endif 30312891Swpaul 304287375Sasomerseui64.byname: $(EUI64) 305287375Sasomers @echo "Updating $@..." 306287375Sasomers.if ${EUI64} == "/dev/null" 307287375Sasomers @echo "EUI64 source file not found -- skipping" 308287375Sasomers.else 309287375Sasomers @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 310287375Sasomers print $$2"\t"$$0 }' $(EUI64) | $(DBLOAD) -i $(EUI64) \ 311287375Sasomers -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 312287375Sasomers @$(DBLOAD) -c 313287375Sasomers @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 314287375Sasomers @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 315287375Sasomers.endif 31612891Swpaul 317287375Sasomerseui64.byid: $(EUI64) 318287375Sasomers @echo "Updating $@..." 319287375Sasomers.if ${EUI64} == "/dev/null" 320287375Sasomers @echo "EUI64 source file not found -- skipping" 321287375Sasomers.else 322287375Sasomers @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 323287375Sasomers print $$1"\t"$$0 }' $(EUI64) | $(DBLOAD) -i $(EUI64) \ 324287375Sasomers -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 325287375Sasomers @$(DBLOAD) -c 326287375Sasomers @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 327287375Sasomers @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 328287375Sasomers.endif 329287375Sasomers 330287375Sasomers 33112891Swpaulbootparams: $(BOOTPARAMS) 33212891Swpaul @echo "Updating $@..." 33331110Swpaul.if ${BOOTPARAMS} == "/dev/null" 33431110Swpaul @echo "Bootparams source file not found -- skipping" 33531110Swpaul.else 336116301Sru @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 337116301Sru print $$0 }' $(BOOTPARAMS) | $(DBLOAD) -i $(BOOTPARAMS) \ 33833100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 33915426Swpaul @$(DBLOAD) -c 34012891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 34112891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 34231110Swpaul.endif 34312891Swpaul 34412891Swpaul 34512891Swpaulnetgroup: $(NETGROUP) netgroup.byhost netgroup.byuser 34612891Swpaul @echo "Updating $@..." 34731110Swpaul.if ${NETGROUP} == "/dev/null" 34831110Swpaul @echo "Netgroup source file not found -- skipping" 34931110Swpaul.else 350116301Sru @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 351116301Sru print $$0 }' $(NETGROUP) | $(DBLOAD) -i $(NETGROUP) \ 35233100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 35315426Swpaul @$(DBLOAD) -c 35412891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 35512891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 35631110Swpaul.endif 35712891Swpaul 35812891Swpaul 35912891Swpaulnetgroup.byhost: $(NETGROUP) 36012891Swpaul @echo "Updating $@..." 36131110Swpaul.if ${NETGROUP} == "/dev/null" 36231110Swpaul @echo "Netgroup source file not found -- skipping" 36331110Swpaul.else 364116301Sru @$(REVNETGROUP) -h -f $(NETGROUP) | \ 36532775Ssteve $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 366116301Sru print $$0 }' | $(DBLOAD) -i $(NETGROUP) \ 36733100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 36815426Swpaul @$(DBLOAD) -c 36912891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 37012891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 37131110Swpaul.endif 37212891Swpaul 37312891Swpaul 37412891Swpaulnetgroup.byuser: $(NETGROUP) 37512891Swpaul @echo "Updating $@..." 37631110Swpaul.if ${NETGROUP} == "/dev/null" 37731110Swpaul @echo "Netgroup source file not found -- skipping" 37831110Swpaul.else 379116301Sru @$(REVNETGROUP) -u -f $(NETGROUP) | \ 38032775Ssteve $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 381116301Sru print $$0 }' | $(DBLOAD) -i $(NETGROUP) \ 38233100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 38315426Swpaul @$(DBLOAD) -c 38412891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 38512891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 38631110Swpaul.endif 38712891Swpaul 38812891Swpaul 389292720Sume# Solaris 8 does the following: 390292720Sume# - /etc/hosts and hosts.{byname,byaddr} are IPv4 only. 391292720Sume# - /etc/inet/ipnodes and ipnodes.{byname,byaddr} are used for protocol 392292720Sume# independent name-to-address mapping. 393292720Sume# 394292720Sume# For local name resolution, we made /etc/hosts protocol independent. 395292720Sume# For NIS name resolution, we obey Solaris 8 practice. 396292720Sume# - We keep hosts.{byname,byaddr} IPv4 only, to be friendly with Solaris 8 397292720Sume# clients. 398292720Sume# - ipnodes.{byname,byaddr} is used for protocol independent mapping. 399292720Sume# We generate all the mappings from /etc/hosts unless /var/yp/ipnodes 400292720Sume# exists, for compatibility with FreeBSD local name resolution. 401292720Sume# 40212891Swpaulhosts.byname: $(HOSTS) 40312891Swpaul @echo "Updating $@..." 404292720Sume @$(AWK) '/^[0-9.]+[\t ]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ 405116301Sru print $$n"\t"$$0 }' $(HOSTS) | $(DBLOAD) ${B} -i $(HOSTS) \ 40633100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 40715426Swpaul @$(DBLOAD) -c 40812891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 40912891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 41012891Swpaul 41115426Swpaul 41212891Swpaulhosts.byaddr: $(HOSTS) 41312891Swpaul @echo "Updating $@..." 414292720Sume @$(AWK) '/^[0-9.]+[\t ]/ { print $$1"\t"$$0 }' $(HOSTS) \ 41533100Swpaul | $(DBLOAD) ${B} -i $(HOSTS) -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 422145801Sumeipnodes.byname: $(IPNODES) 423145801Sume @echo "Updating $@..." 424145801Sume @$(AWK) '/^[0-9a-fA-F:]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ 425145801Sume print $$n"\t"$$0 }' $(IPNODES) | $(DBLOAD) ${B} -i $(IPNODES) \ 426145801Sume -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 427145801Sume @$(DBLOAD) -c 428145801Sume @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 429145801Sume @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 430145801Sume 431145801Sume 432145801Sumeipnodes.byaddr: $(IPNODES) 433145801Sume @echo "Updating $@..." 434145801Sume @$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $(IPNODES) \ 435145801Sume | $(DBLOAD) ${B} -i $(IPNODES) -o $(YPMAPDIR)/$@ - $(TMP); \ 436145801Sume $(RMV) $(TMP) $@ 437145801Sume @$(DBLOAD) -c 438145801Sume @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 439145801Sume @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 440145801Sume 441145801Sume 44212891Swpaulnetworks.byname: $(NETWORKS) 44312891Swpaul @echo "Updating $@..." 444116301Sru @$(AWK) \ 44532775Ssteve '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 44632775Ssteve for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 44712891Swpaul print $$n"\t"$$0 \ 448116301Sru }' $(NETWORKS) \ 449116301Sru | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 45033100Swpaul $(RMV) $(TMP) $@ 45115426Swpaul @$(DBLOAD) -c 45212891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 45312891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 45412891Swpaul 45512891Swpaul 45612891Swpaulnetworks.byaddr: $(NETWORKS) 45712891Swpaul @echo "Updating $@..." 458116301Sru @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(NETWORKS) \ 45933100Swpaul | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 46033100Swpaul $(RMV) $(TMP) $@ 46115426Swpaul @$(DBLOAD) -c 46212891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 46312891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 46412891Swpaul 46512891Swpaul 46612891Swpaulprotocols.byname: $(PROTOCOLS) 46712891Swpaul @echo "Updating $@..." 468116301Sru @$(AWK) \ 46932775Ssteve '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 47032775Ssteve for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 47112891Swpaul print $$n"\t"$$0 \ 472116301Sru }' $(PROTOCOLS) | $(DBLOAD) -i $(PROTOCOLS) \ 47333100Swpaul -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 47415426Swpaul @$(DBLOAD) -c 47512891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 47612891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 47712891Swpaul 47812891Swpaul 47912891Swpaulprotocols.bynumber: $(PROTOCOLS) 48012891Swpaul @echo "Updating $@..." 481116301Sru @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(PROTOCOLS) \ 48233100Swpaul | $(DBLOAD) -i $(PROTOCOLS) -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 48812891Swpaul 48912891Swpaulrpc.byname: $(RPC) 49012891Swpaul @echo "Updating $@..." 491116301Sru @$(AWK) \ 49232775Ssteve '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 49332775Ssteve for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 49412891Swpaul print $$n"\t"$$0 \ 495116301Sru }' $(RPC) | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 49633100Swpaul $(RMV) $(TMP) $@ 49715426Swpaul @$(DBLOAD) -c 49812891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 49912891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 50012891Swpaul 50112891Swpaul 50212891Swpaulrpc.bynumber: $(RPC) 50312891Swpaul @echo "Updating $@..." 504116301Sru @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(RPC) \ 50533100Swpaul | $(DBLOAD) -i $(RPC) -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 51212891Swpaulservices.byname: $(SERVICES) 51312891Swpaul @echo "Updating $@..." 514116301Sru @$(AWK) \ 51532775Ssteve '$$1 !~ "^#.*" { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \ 51633300Swpaul if (split($$2, t, "/")) { \ 51733300Swpaul printf("%s/%s", $$n, t[2]) }; \ 51833536Swpaul print "\t"$$0; \ 51933300Swpaul if (n == 1) n = 2; \ 52033300Swpaul } ; print $$2"\t"$$0 ; \ 521116301Sru }' $(SERVICES) \ 522116301Sru | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \ 52333100Swpaul $(RMV) $(TMP) $@ 52415426Swpaul @$(DBLOAD) -c 52512891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 52612891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 52712891Swpaul 528159394Smaximshells: $(SHELLS) 529112458Srobert @echo "Updating $@..." 530116301Sru @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \ 531116301Sru $(SHELLS) \ 532116301Sru | $(DBLOAD) -i $(SHELLS) -o $(YPMAPDIR)/$@ - $(TMP); \ 533112458Srobert $(RMV) $(TMP) $@ 534112458Srobert @$(DBLOAD) -c 535112458Srobert @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 536112458Srobert @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 53712891Swpaul 53812891Swpaulpublickey.byname: $(PUBLICKEY) 53912891Swpaul @echo "Updating $@..." 54031110Swpaul.if ${PUBLICKEY} == "/dev/null" 54131110Swpaul @echo "Publickey source file not found -- skipping" 54231110Swpaul.else 543116301Sru @$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $(PUBLICKEY) \ 54433100Swpaul | $(DBLOAD) -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \ 54533100Swpaul $(RMV) $(TMP) $@ 54615426Swpaul @$(DBLOAD) -c 54712891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 54812891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 54931110Swpaul.endif 55012891Swpaul 55112891Swpaul 55212891Swpaul$(PASSWD): $(MASTER) 55312891Swpaul @echo "Creating new $@ file from $(MASTER)..." 55412891Swpaul @if [ ! $(UNSECURE) ]; then \ 55562210Sbrian $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 556116301Sru print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \ 55712891Swpaul > $(PASSWD) ; \ 558116301Sru else \ 55962210Sbrian $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 560116301Sru print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \ 56112891Swpaul > $(PASSWD) ; fi 56212891Swpaul 56312891Swpaul 56412891Swpaulpasswd.byname: $(PASSWD) 56512891Swpaul @echo "Updating $@..." 566116301Sru @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 567116301Sru print $$1"\t"$$0 }' $(PASSWD) \ 56850159Swpaul | $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 56933100Swpaul $(RMV) $(TMP) $@ 57015426Swpaul @$(DBLOAD) -c 57112891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 57212891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 57312891Swpaul 57415426Swpaul 57512891Swpaulpasswd.byuid: $(PASSWD) 57612891Swpaul @echo "Updating $@..." 577116301Sru @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 578116301Sru print $$3"\t"$$0 }' $(PASSWD) \ 57950159Swpaul | $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 58033100Swpaul $(RMV) $(TMP) $@ 58115426Swpaul @$(DBLOAD) -c 58212891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 58312891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 58412891Swpaul 58512891Swpaul 58612891Swpaulgroup.byname: $(GROUP) 58712891Swpaul @echo "Updating $@..." 588116301Sru @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 589116301Sru print $$1"\t"$$0 }' $(GROUP) \ 59050159Swpaul | $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 59133100Swpaul $(RMV) $(TMP) $@ 59215426Swpaul @$(DBLOAD) -c 59312891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 59412891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 59512891Swpaul 59612891Swpaul 59712891Swpaulgroup.bygid: $(GROUP) 59812891Swpaul @echo "Updating $@..." 599116301Sru @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 600116301Sru print $$3"\t"$$0 }' $(GROUP) \ 60150159Swpaul | $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 60233100Swpaul $(RMV) $(TMP) $@ 60315426Swpaul @$(DBLOAD) -c 60412891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 60512891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 60612891Swpaul 60712891Swpaul 608157722Srunetid.byname: $(GROUP) $(PASSWD) $(HOSTS) 60912891Swpaul @echo "Updating $@..." 61016732Swpaul @$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \ 61133100Swpaul -d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \ 61233100Swpaul $(RMV) $(TMP) $@ 61315426Swpaul @$(DBLOAD) -c 61412891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 61512891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 61612891Swpaul 61712891Swpaul 61812891Swpaulmaster.passwd.byname: $(MASTER) 61912891Swpaul @echo "Updating $@..." 62031110Swpaul.if ${MASTER} == "/dev/null" 62131110Swpaul @echo "Master.passwd source file not found -- skipping" 62231110Swpaul.else 623116301Sru @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 624116301Sru print $$1"\t"$$0 }' $(MASTER) \ 62550159Swpaul | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 62633100Swpaul $(RMV) $(TMP) $@ 62715426Swpaul @$(DBLOAD) -c 62812891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 62912891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 63031110Swpaul.endif 63112891Swpaul 63212891Swpaul 63312891Swpaulmaster.passwd.byuid: $(MASTER) 63412891Swpaul @echo "Updating $@..." 63531110Swpaul.if ${MASTER} == "/dev/null" 63631110Swpaul @echo "Master.passwd source file not found -- skipping" 63731110Swpaul.else 638116301Sru @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 639116301Sru print $$3"\t"$$0 }' $(MASTER) \ 64050159Swpaul | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 64133100Swpaul $(RMV) $(TMP) $@ 64215426Swpaul @$(DBLOAD) -c 64312891Swpaul @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 64412891Swpaul @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 64531110Swpaul.endif 64617266Speter 64731110Swpaul 648194968Sbrianshadow.byname: $(MASTER) 649194968Sbrian @echo "Updating $@..." 650194968Sbrian.if ${MASTER} == "/dev/null" 651194968Sbrian @echo "Master.passwd source file not found -- skipping" 652194968Sbrian.else 653194968Sbrian @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 654194968Sbrian print $$1"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \ 655194968Sbrian | sed 's/\( [^:]*:\)\*:/\1!:/' \ 656194968Sbrian | $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 657194968Sbrian $(RMV) $(TMP) $@ 658194968Sbrian @$(DBLOAD) -c 659194968Sbrian @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 660194968Sbrian @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 661194968Sbrian.endif 662194968Sbrian 663194968Sbrianshadow.byuid: $(MASTER) 664194968Sbrian @echo "Updating $@..." 665194968Sbrian.if ${MASTER} == "/dev/null" 666194968Sbrian @echo "Master.passwd source file not found -- skipping" 667194968Sbrian.else 668194968Sbrian @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 669194968Sbrian print $$3"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \ 670194968Sbrian | sed 's/\( [^:]*:\)\*:/\1!:/' \ 671194968Sbrian | $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 672194968Sbrian $(RMV) $(TMP) $@ 673194968Sbrian @$(DBLOAD) -c 674194968Sbrian @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 675194968Sbrian @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 676194968Sbrian.endif 677194968Sbrian 67890320Smarkmamd.map: $(AMDHOST) 67917266Speter @echo "Updating $@..." 680116301Sru @$(AWK) '$$1 !~ "^#.*" { \ 68117266Speter for (i = 1; i <= NF; i++) \ 68217266Speter if (i == NF) { \ 68317266Speter if (substr($$i, length($$i), 1) == "\\") \ 68417266Speter printf("%s", substr($$i, 1, length($$i) - 1)); \ 68517266Speter else \ 68617266Speter printf("%s\n", $$i); \ 68717266Speter } \ 68817266Speter else \ 68917266Speter printf("%s ", $$i); \ 690116301Sru }' $(AMDHOST) | \ 69133100Swpaul $(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP); \ 69233100Swpaul $(RMV) $(TMP) $@ 69317266Speter @$(DBLOAD) -c 69417266Speter @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 69517266Speter @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 696