1# 2# Makefile for the NIS databases 3# 4# 5# This Makefile should only be run on the NIS master server of a domain. 6# All updated maps will be pushed to all NIS slave servers listed in the 7# /var/yp/ypservers file. Please make sure that the hostnames of all 8# NIS servers in your domain are listed in /var/yp/ypservers. 9# 10# This Makefile can be modified to support more NIS maps if desired. 11# 12 13# If this machine is an NIS master, reset this variable (NOPUSH=) 14# in Makefile.local so that changes to the NIS maps can be propagated to 15# the slave servers. (By default we assume that we are only serving a 16# small domain with only one server.) 17# 18NOPUSH = "True" 19 20# If this machine does not wish to generate a linux-style shadow map 21# from the master.passwd file, reset this variable (SHADOW=) in 22# Makefile.local. 23SHADOW = "True" 24 25# If you want to use a FreeBSD NIS server to serve non-FreeBSD clients 26# (i.e. clients who expect the password field in the passwd maps to be 27# valid) then set this variable (UNSECURE="True") in Makefile.local. 28# This will cause $YPDIR/passwd to be generated with valid password 29# fields. This is insecure: FreeBSD normally only serves the 30# master.passwd and shadow maps (which have real encrypted passwords 31# in them) to the superuser on other FreeBSD machines, but non-FreeBSD 32# clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX, etc...) 33# will only work properly in 'unsecure' mode. 34# 35#UNSECURE = "True" 36 37# The following line encodes the YP_INTERDOMAIN key into the hosts.byname 38# and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve 39# hosts not in the current domain. Resetting this variable in 40# Makefile.local (B=) will disable the DNS lookups. 41B=-b 42 43# Normally, the master.passwd.* and shadow.* maps are guarded against access 44# from non-privileged users. By resetting S in Makefile.local (S=), the 45# YP_SECURE key will be removed from these maps, allowing anyone to access 46# them. 47S=-s 48 49# These are commands which this Makefile needs to properly rebuild the 50# NIS databases. Don't change these unless you have a good reason. Also 51# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary 52# and it'll break everything in sight. 53# 54AWK = /usr/bin/awk 55RM = @/bin/rm -f 56MV = @/bin/mv -f 57RMV = /bin/mv -f 58 59MKDB = /usr/sbin/yp_mkdb 60DBLOAD = $(MKDB) -m `hostname` 61MKNETID = /usr/libexec/mknetid 62NEWALIASES = /usr/bin/newaliases 63YPPUSH = /usr/sbin/yppush 64.if !defined(UPDATE_DOMAIN) 65DOMAIN = `/bin/domainname` 66.else 67DOMAIN = $(UPDATE_DOMAIN) 68.endif 69REVNETGROUP = /usr/libexec/revnetgroup 70TMP = `echo $@.$$$$` 71 72# It is advisable to create a separate directory to contain the 73# source files used to generate your NIS maps. If you intend to 74# support multiple domains, something like /src/dir/$DOMAIN 75# would work well. 76YPSRCDIR = /etc 77.if !defined(YP_DIR) 78YPDIR = /var/yp 79.else 80YPDIR = $(YP_DIR) 81.endif 82YPMAPDIR = $(YPDIR)/$(DOMAIN) 83 84# These are the files from which the NIS databases are built. You may edit 85# these to taste in the event that you wish to keep your NIS source files 86# separate from your NIS server's actual configuration files. Note that the 87# NIS passwd and master.passwd files are stored in /var/yp: the server's 88# real password database is not used by default. However, you may use 89# the real /etc/passwd and /etc/master.passwd files by: 90# 91# 92# - invoking yppasswdd with `-t /etc/master.passwd' (yppasswdd will do a 93# 'pwd_mkdb' as needed if /etc/master.passwd is thus specified). 94# - Specifying the location of the master.passwd file using the 95# MASTER_PASSWD variable, i.e.: 96# 97# # make MASTER_PASSWD=/path/to/some/other/master.passwd 98# 99# - (optionally): editing this Makefile to change the default location. 100# 101# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw 102# passwd file will be generated from the master.passwd file automagically. 103# 104ETHERS = $(YPSRCDIR)/ethers # ethernet addresses (for rarpd) 105EUI64 = $(YPSRCDIR)/eui64 # eui64 addresses (for firewire) 106BOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd) 107HOSTS = $(YPSRCDIR)/hosts 108IPNODES = $(YPDIR)/ipnodes 109NETWORKS = $(YPSRCDIR)/networks 110PROTOCOLS = $(YPSRCDIR)/protocols 111RPC = $(YPSRCDIR)/rpc 112SERVICES = $(YPSRCDIR)/services 113SHELLS = $(YPSRCDIR)/shells 114GROUP = $(YPSRCDIR)/group 115ALIASES = $(YPSRCDIR)/mail/aliases 116NETGROUP = $(YPDIR)/netgroup 117PASSWD = $(YPDIR)/passwd 118.if !defined(MASTER_PASSWD) 119MASTER = $(YPDIR)/master.passwd 120.else 121MASTER = $(MASTER_PASSWD) 122.endif 123YPSERVERS = $(YPDIR)/ypservers # List of all NIS servers for a domain 124PUBLICKEY = $(YPSRCDIR)/publickey 125NETID = $(YPSRCDIR)/netid 126AMDHOST = $(YPSRCDIR)/amd.map 127 128target: 129 @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ 130 cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ 131 make -f ../Makefile all; echo "NIS Map update completed." 132 133# Read overrides. Note, the current directory will be /var/yp/<domain> 134# when 'all' is built. 135.if exists(${YPDIR}/Makefile.local) 136.include "${YPDIR}/Makefile.local" 137.endif 138 139# List of maps that are always built. 140# If you want to omit some of them, feel free to comment 141# them out from this list. 142TARGETS= servers hosts networks protocols rpc services shells group 143TARGETS+= ipnodes 144#TARGETS+= aliases 145 146# Sanity checks: filter out targets we can't build 147# Note that we don't build the ethers, eui64, or boorparams maps by default 148# since /etc/ethers, /etc/eui64 and /etc/bootparams are not likely to be present 149# on all systems. 150.if exists($(ETHERS)) 151TARGETS+= ethers 152.else 153ETHERS= /dev/null 154.endif 155 156.if exists($(EUI64)) 157TARGETS+= eui64 158.else 159EUI64= /dev/null 160.endif 161 162.if exists($(BOOTPARAMS)) 163TARGETS+= bootparams 164.else 165BOOTPARAMS= /dev/null 166.endif 167 168.if exists($(NETGROUP)) 169TARGETS+= netgrp 170.else 171NETGROUP= /dev/null 172.endif 173 174.if exists($(MASTER)) 175TARGETS+= passwd master.passwd netid 176.if ${SHADOW} == "\"True\"" 177TARGETS+= shadow 178.endif 179.else 180MASTER= /dev/null 181TARGETS+= nopass 182.endif 183 184.if exists($(PUBLICKEY)) 185TARGETS+= publickey 186.else 187PUBLICKEY= /dev/null 188.endif 189 190.if exists($(AMDHOST)) 191TARGETS+= amd.map 192.else 193AMDHOST= /dev/null 194.endif 195 196.if !exists($(IPNODES)) 197IPNODES= $(HOSTS) 198.endif 199 200all: $(TARGETS) 201 202ethers: ethers.byname ethers.byaddr 203eui64: eui64.byname eui64.byid 204bootparam: bootparams 205hosts: hosts.byname hosts.byaddr 206ipnodes: ipnodes.byname ipnodes.byaddr 207networks: networks.byaddr networks.byname 208protocols: protocols.bynumber protocols.byname 209rpc: rpc.byname rpc.bynumber 210services: services.byname 211passwd: passwd.byname passwd.byuid 212shadow: shadow.byname shadow.byuid 213group: group.byname group.bygid 214netgrp: netgroup 215netid: netid.byname 216servers: ypservers 217publickey: publickey.byname 218aliases: mail.aliases 219 220master.passwd: master.passwd.byname master.passwd.byuid 221 222# 223# This is a special target used only when doing in-place updates with 224# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd 225# server and won't need to be remade. They will have to be pushed to the 226# slaves however. Calling this target implicitly insures that this will 227# happen. 228# 229pushpw: 230 @$(DBLOAD) -c 231 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi 232 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi 233.if ${SHADOW} == "\"True\"" 234 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byname ; fi 235 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byuid ; fi 236.endif 237 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi 238 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi 239 240pushmap: 241 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi 242 243nopass: 244 @echo "" 245 @echo " ********WARNING********" 246 @echo " Couldn't find the master.passwd source file. This file" 247 @echo " is needed to generate the master.passwd and passwd maps." 248 @echo " The default location is /var/yp/master.passwd. You should" 249 @echo " edit /var/yp/Makefile and set the MASTER variable to point" 250 @echo " to the source file you wish to use for building the passwd" 251 @echo " maps, or else invoke make(1) in the following manner:" 252 @echo "" 253 @echo " make MASTER_PASSWD=/path/to/master.passwd" 254 @echo "" 255 256mail.aliases: $(ALIASES) 257 @echo "Updating $@..." 258 @$(NEWALIASES) -oA$(ALIASES) 259 @$(MKDB) -u $(ALIASES).db \ 260 | $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \ 261 $(RMV) $(TMP) $@ 262 @$(DBLOAD) -c 263 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 264 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 265 266 267ypservers: $(YPSERVERS) 268 @echo "Updating $@..." 269 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \ 270 $(YPSERVERS) \ 271 | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \ 272 $(RMV) $(TMP) $@ 273 @$(DBLOAD) -c 274 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 275 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 276 277ethers.byname: $(ETHERS) 278 @echo "Updating $@..." 279.if ${ETHERS} == "/dev/null" 280 @echo "Ethers source file not found -- skipping" 281.else 282 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 283 print $$2"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \ 284 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 285 @$(DBLOAD) -c 286 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 287 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 288.endif 289 290ethers.byaddr: $(ETHERS) 291 @echo "Updating $@..." 292.if ${ETHERS} == "/dev/null" 293 @echo "Ethers source file not found -- skipping" 294.else 295 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 296 print $$1"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \ 297 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 298 @$(DBLOAD) -c 299 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 300 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 301.endif 302 303eui64.byname: $(EUI64) 304 @echo "Updating $@..." 305.if ${EUI64} == "/dev/null" 306 @echo "EUI64 source file not found -- skipping" 307.else 308 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 309 print $$2"\t"$$0 }' $(EUI64) | $(DBLOAD) -i $(EUI64) \ 310 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 311 @$(DBLOAD) -c 312 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 313 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 314.endif 315 316eui64.byid: $(EUI64) 317 @echo "Updating $@..." 318.if ${EUI64} == "/dev/null" 319 @echo "EUI64 source file not found -- skipping" 320.else 321 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 322 print $$1"\t"$$0 }' $(EUI64) | $(DBLOAD) -i $(EUI64) \ 323 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 324 @$(DBLOAD) -c 325 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 326 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 327.endif 328 329 330bootparams: $(BOOTPARAMS) 331 @echo "Updating $@..." 332.if ${BOOTPARAMS} == "/dev/null" 333 @echo "Bootparams source file not found -- skipping" 334.else 335 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 336 print $$0 }' $(BOOTPARAMS) | $(DBLOAD) -i $(BOOTPARAMS) \ 337 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 338 @$(DBLOAD) -c 339 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 340 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 341.endif 342 343 344netgroup: $(NETGROUP) netgroup.byhost netgroup.byuser 345 @echo "Updating $@..." 346.if ${NETGROUP} == "/dev/null" 347 @echo "Netgroup source file not found -- skipping" 348.else 349 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 350 print $$0 }' $(NETGROUP) | $(DBLOAD) -i $(NETGROUP) \ 351 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 352 @$(DBLOAD) -c 353 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 354 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 355.endif 356 357 358netgroup.byhost: $(NETGROUP) 359 @echo "Updating $@..." 360.if ${NETGROUP} == "/dev/null" 361 @echo "Netgroup source file not found -- skipping" 362.else 363 @$(REVNETGROUP) -h -f $(NETGROUP) | \ 364 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 365 print $$0 }' | $(DBLOAD) -i $(NETGROUP) \ 366 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 367 @$(DBLOAD) -c 368 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 369 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 370.endif 371 372 373netgroup.byuser: $(NETGROUP) 374 @echo "Updating $@..." 375.if ${NETGROUP} == "/dev/null" 376 @echo "Netgroup source file not found -- skipping" 377.else 378 @$(REVNETGROUP) -u -f $(NETGROUP) | \ 379 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 380 print $$0 }' | $(DBLOAD) -i $(NETGROUP) \ 381 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 382 @$(DBLOAD) -c 383 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 384 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 385.endif 386 387 388# Solaris 8 does the following: 389# - /etc/hosts and hosts.{byname,byaddr} are IPv4 only. 390# - /etc/inet/ipnodes and ipnodes.{byname,byaddr} are used for protocol 391# independent name-to-address mapping. 392# 393# For local name resolution, we made /etc/hosts protocol independent. 394# For NIS name resolution, we obey Solaris 8 practice. 395# - We keep hosts.{byname,byaddr} IPv4 only, to be friendly with Solaris 8 396# clients. 397# - ipnodes.{byname,byaddr} is used for protocol independent mapping. 398# We generate all the mappings from /etc/hosts unless /var/yp/ipnodes 399# exists, for compatibility with FreeBSD local name resolution. 400# 401hosts.byname: $(HOSTS) 402 @echo "Updating $@..." 403 @$(AWK) '/^[0-9.]+[\t ]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ 404 print $$n"\t"$$0 }' $(HOSTS) | $(DBLOAD) ${B} -i $(HOSTS) \ 405 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 406 @$(DBLOAD) -c 407 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 408 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 409 410 411hosts.byaddr: $(HOSTS) 412 @echo "Updating $@..." 413 @$(AWK) '/^[0-9.]+[\t ]/ { print $$1"\t"$$0 }' $(HOSTS) \ 414 | $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP); \ 415 $(RMV) $(TMP) $@ 416 @$(DBLOAD) -c 417 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 418 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 419 420 421ipnodes.byname: $(IPNODES) 422 @echo "Updating $@..." 423 @$(AWK) '/^[0-9a-fA-F:]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ 424 print $$n"\t"$$0 }' $(IPNODES) | $(DBLOAD) ${B} -i $(IPNODES) \ 425 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 426 @$(DBLOAD) -c 427 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 428 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 429 430 431ipnodes.byaddr: $(IPNODES) 432 @echo "Updating $@..." 433 @$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $(IPNODES) \ 434 | $(DBLOAD) ${B} -i $(IPNODES) -o $(YPMAPDIR)/$@ - $(TMP); \ 435 $(RMV) $(TMP) $@ 436 @$(DBLOAD) -c 437 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 438 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 439 440 441networks.byname: $(NETWORKS) 442 @echo "Updating $@..." 443 @$(AWK) \ 444 '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 445 for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 446 print $$n"\t"$$0 \ 447 }' $(NETWORKS) \ 448 | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 449 $(RMV) $(TMP) $@ 450 @$(DBLOAD) -c 451 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 452 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 453 454 455networks.byaddr: $(NETWORKS) 456 @echo "Updating $@..." 457 @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(NETWORKS) \ 458 | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 459 $(RMV) $(TMP) $@ 460 @$(DBLOAD) -c 461 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 462 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 463 464 465protocols.byname: $(PROTOCOLS) 466 @echo "Updating $@..." 467 @$(AWK) \ 468 '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 469 for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 470 print $$n"\t"$$0 \ 471 }' $(PROTOCOLS) | $(DBLOAD) -i $(PROTOCOLS) \ 472 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 473 @$(DBLOAD) -c 474 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 475 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 476 477 478protocols.bynumber: $(PROTOCOLS) 479 @echo "Updating $@..." 480 @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(PROTOCOLS) \ 481 | $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP); \ 482 $(RMV) $(TMP) $@ 483 @$(DBLOAD) -c 484 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 485 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 486 487 488rpc.byname: $(RPC) 489 @echo "Updating $@..." 490 @$(AWK) \ 491 '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 492 for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 493 print $$n"\t"$$0 \ 494 }' $(RPC) | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 495 $(RMV) $(TMP) $@ 496 @$(DBLOAD) -c 497 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 498 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 499 500 501rpc.bynumber: $(RPC) 502 @echo "Updating $@..." 503 @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(RPC) \ 504 | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 505 $(RMV) $(TMP) $@ 506 @$(DBLOAD) -c 507 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 508 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 509 510 511services.byname: $(SERVICES) 512 @echo "Updating $@..." 513 @$(AWK) \ 514 '$$1 !~ "^#.*" { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \ 515 if (split($$2, t, "/")) { \ 516 printf("%s/%s", $$n, t[2]) }; \ 517 print "\t"$$0; \ 518 if (n == 1) n = 2; \ 519 } ; print $$2"\t"$$0 ; \ 520 }' $(SERVICES) \ 521 | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \ 522 $(RMV) $(TMP) $@ 523 @$(DBLOAD) -c 524 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 525 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 526 527shells: $(SHELLS) 528 @echo "Updating $@..." 529 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \ 530 $(SHELLS) \ 531 | $(DBLOAD) -i $(SHELLS) -o $(YPMAPDIR)/$@ - $(TMP); \ 532 $(RMV) $(TMP) $@ 533 @$(DBLOAD) -c 534 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 535 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 536 537publickey.byname: $(PUBLICKEY) 538 @echo "Updating $@..." 539.if ${PUBLICKEY} == "/dev/null" 540 @echo "Publickey source file not found -- skipping" 541.else 542 @$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $(PUBLICKEY) \ 543 | $(DBLOAD) -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \ 544 $(RMV) $(TMP) $@ 545 @$(DBLOAD) -c 546 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 547 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 548.endif 549 550 551$(PASSWD): $(MASTER) 552 @echo "Creating new $@ file from $(MASTER)..." 553 @if [ ! $(UNSECURE) ]; then \ 554 $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 555 print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \ 556 > $(PASSWD) ; \ 557 else \ 558 $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 559 print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \ 560 > $(PASSWD) ; fi 561 562 563passwd.byname: $(PASSWD) 564 @echo "Updating $@..." 565 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 566 print $$1"\t"$$0 }' $(PASSWD) \ 567 | $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 568 $(RMV) $(TMP) $@ 569 @$(DBLOAD) -c 570 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 571 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 572 573 574passwd.byuid: $(PASSWD) 575 @echo "Updating $@..." 576 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 577 print $$3"\t"$$0 }' $(PASSWD) \ 578 | $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 579 $(RMV) $(TMP) $@ 580 @$(DBLOAD) -c 581 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 582 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 583 584 585group.byname: $(GROUP) 586 @echo "Updating $@..." 587 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 588 print $$1"\t"$$0 }' $(GROUP) \ 589 | $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 590 $(RMV) $(TMP) $@ 591 @$(DBLOAD) -c 592 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 593 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 594 595 596group.bygid: $(GROUP) 597 @echo "Updating $@..." 598 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 599 print $$3"\t"$$0 }' $(GROUP) \ 600 | $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 601 $(RMV) $(TMP) $@ 602 @$(DBLOAD) -c 603 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 604 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 605 606 607netid.byname: $(GROUP) $(PASSWD) $(HOSTS) 608 @echo "Updating $@..." 609 @$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \ 610 -d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \ 611 $(RMV) $(TMP) $@ 612 @$(DBLOAD) -c 613 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 614 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 615 616 617master.passwd.byname: $(MASTER) 618 @echo "Updating $@..." 619.if ${MASTER} == "/dev/null" 620 @echo "Master.passwd source file not found -- skipping" 621.else 622 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 623 print $$1"\t"$$0 }' $(MASTER) \ 624 | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 625 $(RMV) $(TMP) $@ 626 @$(DBLOAD) -c 627 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 628 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 629.endif 630 631 632master.passwd.byuid: $(MASTER) 633 @echo "Updating $@..." 634.if ${MASTER} == "/dev/null" 635 @echo "Master.passwd source file not found -- skipping" 636.else 637 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 638 print $$3"\t"$$0 }' $(MASTER) \ 639 | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 640 $(RMV) $(TMP) $@ 641 @$(DBLOAD) -c 642 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 643 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 644.endif 645 646 647shadow.byname: $(MASTER) 648 @echo "Updating $@..." 649.if ${MASTER} == "/dev/null" 650 @echo "Master.passwd source file not found -- skipping" 651.else 652 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 653 print $$1"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \ 654 | sed 's/\( [^:]*:\)\*:/\1!:/' \ 655 | $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 656 $(RMV) $(TMP) $@ 657 @$(DBLOAD) -c 658 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 659 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 660.endif 661 662shadow.byuid: $(MASTER) 663 @echo "Updating $@..." 664.if ${MASTER} == "/dev/null" 665 @echo "Master.passwd source file not found -- skipping" 666.else 667 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 668 print $$3"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \ 669 | sed 's/\( [^:]*:\)\*:/\1!:/' \ 670 | $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 671 $(RMV) $(TMP) $@ 672 @$(DBLOAD) -c 673 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 674 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 675.endif 676 677amd.map: $(AMDHOST) 678 @echo "Updating $@..." 679 @$(AWK) '$$1 !~ "^#.*" { \ 680 for (i = 1; i <= NF; i++) \ 681 if (i == NF) { \ 682 if (substr($$i, length($$i), 1) == "\\") \ 683 printf("%s", substr($$i, 1, length($$i) - 1)); \ 684 else \ 685 printf("%s\n", $$i); \ 686 } \ 687 else \ 688 printf("%s ", $$i); \ 689 }' $(AMDHOST) | \ 690 $(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP); \ 691 $(RMV) $(TMP) $@ 692 @$(DBLOAD) -c 693 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 694 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 695