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