1# 2# Makefile for the NIS databases 3# 4# $FreeBSD$ 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 51RMV = /bin/mv -f 52RCAT = /bin/cat 53CAT = @$(RCAT) 54 55MKDB = /usr/sbin/yp_mkdb 56DBLOAD = $(MKDB) -m `hostname` 57MKNETID = /usr/libexec/mknetid 58NEWALIASES = /usr/bin/newaliases 59YPPUSH = /usr/sbin/yppush 60.if !defined(UPDATE_DOMAIN) 61DOMAIN = `/bin/domainname` 62.else 63DOMAIN = $(UPDATE_DOMAIN) 64.endif 65REVNETGROUP = /usr/libexec/revnetgroup 66TMP = `echo $@.$$$$` 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# separate 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 with `-t /etc/master.passwd' (yppasswdd will do a 89# 'pwd_mkdb' as needed if /etc/master.passwd is thus specified). 90# - Specifying the location of the master.passwd file using the 91# MASTER_PASSWD variable, i.e.: 92# 93# # make MASTER_PASSWD=/path/to/some/other/master.passwd 94# 95# - (optionally): editing this Makefile to change the default location. 96# 97# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw 98# passwd file will be generated from the master.passwd file automagically. 99# 100ETHERS = $(YPSRCDIR)/ethers # ethernet addresses (for rarpd) 101BOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd) 102HOSTS = $(YPSRCDIR)/hosts 103NETWORKS = $(YPSRCDIR)/networks 104PROTOCOLS = $(YPSRCDIR)/protocols 105RPC = $(YPSRCDIR)/rpc 106SERVICES = $(YPSRCDIR)/services 107SHELLS = $(YPSRCDIR)/shells 108GROUP = $(YPSRCDIR)/group 109ALIASES = $(YPSRCDIR)/mail/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.map 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 shells 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.map 165.else 166AMDHOST= /dev/null 167.endif 168 169target: 170 @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ 171 cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ 172 make -f ../Makefile all; echo "NIS Map update completed." 173 174all: $(TARGETS) 175 176ethers: ethers.byname ethers.byaddr 177bootparam: bootparams 178hosts: hosts.byname hosts.byaddr 179networks: networks.byaddr networks.byname 180protocols: protocols.bynumber protocols.byname 181rpc: rpc.byname rpc.bynumber 182services: services.byname 183shells: shells.list 184passwd: passwd.byname passwd.byuid 185group: group.byname group.bygid 186netgrp: netgroup 187netid: netid.byname 188servers: ypservers 189publickey: publickey.byname 190aliases: mail.aliases 191 192master.passwd: master.passwd.byname master.passwd.byuid 193 194# 195# This is a special target used only when doing in-place updates with 196# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd 197# server and won't need to be remade. They will have to be pushed to the 198# slaves however. Calling this target implicitly insures that this will 199# happen. 200# 201pushpw: 202 @$(DBLOAD) -c 203 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi 204 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi 205 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi 206 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi 207 208pushmap: 209 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi 210 211nopass: 212 @echo "" 213 @echo " ********WARNING********" 214 @echo " Couldn't find the master.passwd source file. This file" 215 @echo " is needed to generate the master.passwd and passwd maps." 216 @echo " The default location is /var/yp/master.passwd. You should" 217 @echo " edit /var/yp/Makefile and set the MASTER variable to point" 218 @echo " to the source file you wish to use for building the passwd" 219 @echo " maps, or else invoke make(1) in the following manner:" 220 @echo "" 221 @echo " make MASTER_PASSWD=/path/to/master.passwd" 222 @echo "" 223 224mail.aliases: $(ALIASES) 225 @echo "Updating $@..." 226 @$(NEWALIASES) -oA$(ALIASES) 227 @$(MKDB) -u $(ALIASES).db \ 228 | $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \ 229 $(RMV) $(TMP) $@ 230 @$(DBLOAD) -c 231 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 232 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 233 234 235ypservers: $(YPSERVERS) 236 @echo "Updating $@..." 237 $(CAT) $(YPSERVERS) | \ 238 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' $^ \ 239 | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \ 240 $(RMV) $(TMP) $@ 241 @$(DBLOAD) -c 242 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 243 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 244 245ethers.byname: $(ETHERS) 246 @echo "Updating $@..." 247.if ${ETHERS} == "/dev/null" 248 @echo "Ethers source file not found -- skipping" 249.else 250 $(CAT) $(ETHERS) | \ 251 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 252 print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 253 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 254 @$(DBLOAD) -c 255 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 256 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 257.endif 258 259ethers.byaddr: $(ETHERS) 260 @echo "Updating $@..." 261.if ${ETHERS} == "/dev/null" 262 @echo "Ethers source file not found -- skipping" 263.else 264 $(CAT) $(ETHERS) | \ 265 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 266 print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 267 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 268 @$(DBLOAD) -c 269 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 270 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 271.endif 272 273 274bootparams: $(BOOTPARAMS) 275 @echo "Updating $@..." 276.if ${BOOTPARAMS} == "/dev/null" 277 @echo "Bootparams source file not found -- skipping" 278.else 279 $(CAT) $(BOOTPARAMS) | \ 280 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 281 print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \ 282 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 283 @$(DBLOAD) -c 284 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 285 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 286.endif 287 288 289netgroup: $(NETGROUP) netgroup.byhost netgroup.byuser 290 @echo "Updating $@..." 291.if ${NETGROUP} == "/dev/null" 292 @echo "Netgroup source file not found -- skipping" 293.else 294 $(CAT) $(NETGROUP) | \ 295 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 296 print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 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 @$(MAKE) -f ../Makefile netid 302.endif 303 304 305netgroup.byhost: $(NETGROUP) 306 @echo "Updating $@..." 307.if ${NETGROUP} == "/dev/null" 308 @echo "Netgroup source file not found -- skipping" 309.else 310 $(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \ 311 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 312 print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 313 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 314 @$(DBLOAD) -c 315 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 316 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 317.endif 318 319 320netgroup.byuser: $(NETGROUP) 321 @echo "Updating $@..." 322.if ${NETGROUP} == "/dev/null" 323 @echo "Netgroup source file not found -- skipping" 324.else 325 $(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \ 326 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 327 print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 328 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 329 @$(DBLOAD) -c 330 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 331 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 332.endif 333 334 335hosts.byname: $(HOSTS) 336 @echo "Updating $@..." 337 $(CAT) $(HOSTS) | \ 338 $(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ 339 print $$n"\t"$$0 }' $^ | $(DBLOAD) ${B} -i $(HOSTS) \ 340 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 341 @$(DBLOAD) -c 342 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 343 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 344 @$(MAKE) -f ../Makefile netid 345 346 347hosts.byaddr: $(HOSTS) 348 @echo "Updating $@..." 349 $(CAT) $(HOSTS) | \ 350 $(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $^ \ 351 | $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP); \ 352 $(RMV) $(TMP) $@ 353 @$(DBLOAD) -c 354 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 355 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 356 @$(MAKE) -f ../Makefile netid 357 358 359networks.byname: $(NETWORKS) 360 @echo "Updating $@..." 361 $(CAT) $(NETWORKS) | \ 362 $(AWK) \ 363 '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 364 for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 365 print $$n"\t"$$0 \ 366 }' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 367 $(RMV) $(TMP) $@ 368 @$(DBLOAD) -c 369 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 370 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 371 372 373networks.byaddr: $(NETWORKS) 374 @echo "Updating $@..." 375 $(CAT) $(NETWORKS) | \ 376 $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 377 | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 378 $(RMV) $(TMP) $@ 379 @$(DBLOAD) -c 380 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 381 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 382 383 384protocols.byname: $(PROTOCOLS) 385 @echo "Updating $@..." 386 $(CAT) $(PROTOCOLS) | \ 387 $(AWK) \ 388 '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 389 for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 390 print $$n"\t"$$0 \ 391 }' $^ | $(DBLOAD) -i $(PROTOCOLS) \ 392 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 393 @$(DBLOAD) -c 394 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 395 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 396 397 398protocols.bynumber: $(PROTOCOLS) 399 @echo "Updating $@..." 400 $(CAT) $(PROTOCOLS) | \ 401 $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 402 | $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP); \ 403 $(RMV) $(TMP) $@ 404 @$(DBLOAD) -c 405 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 406 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 407 408 409rpc.byname: $(RPC) 410 @echo "Updating $@..." 411 $(CAT) $(RPC) | \ 412 $(AWK) \ 413 '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 414 for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 415 print $$n"\t"$$0 \ 416 }' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 417 $(RMV) $(TMP) $@ 418 @$(DBLOAD) -c 419 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 420 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 421 422 423rpc.bynumber: $(RPC) 424 @echo "Updating $@..." 425 $(CAT) $(RPC) | \ 426 $(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \ 427 | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 428 $(RMV) $(TMP) $@ 429 @$(DBLOAD) -c 430 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 431 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 432 433 434services.byname: $(SERVICES) 435 @echo "Updating $@..." 436 $(CAT) $(SERVICES) | \ 437 $(AWK) \ 438 '$$1 !~ "^#.*" { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \ 439 if (split($$2, t, "/")) { \ 440 printf("%s/%s", $$n, t[2]) }; \ 441 print "\t"$$0; \ 442 if (n == 1) n = 2; \ 443 } ; print $$2"\t"$$0 ; \ 444 }' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \ 445 $(RMV) $(TMP) $@ 446 @$(DBLOAD) -c 447 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 448 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 449 450shells.list: $(SHELLS) 451 @echo "Updating $@..." 452 $(CAT) $(SHELLS) | \ 453 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' $^ | \ 454 $(DBLOAD) -i $(SHELLS) -o $(YPMAPDIR)/$@ - $(TMP); \ 455 $(RMV) $(TMP) $@ 456 @$(DBLOAD) -c 457 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 458 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 459 460publickey.byname: $(PUBLICKEY) 461 @echo "Updating $@..." 462.if ${PUBLICKEY} == "/dev/null" 463 @echo "Publickey source file not found -- skipping" 464.else 465 $(CAT) $(PUBLICKEY) | \ 466 $(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $^ \ 467 | $(DBLOAD) -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \ 468 $(RMV) $(TMP) $@ 469 @$(DBLOAD) -c 470 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 471 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 472.endif 473 474 475$(PASSWD): $(MASTER) 476 @echo "Creating new $@ file from $(MASTER)..." 477 @if [ ! $(UNSECURE) ]; then \ 478 $(RCAT) $(MASTER) | \ 479 $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 480 print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 481 > $(PASSWD) ; \ 482 else $(RCAT) $(MASTER) | \ 483 $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 484 print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 485 > $(PASSWD) ; fi 486 487 488passwd.byname: $(PASSWD) 489 @echo "Updating $@..." 490 $(CAT) $(PASSWD) | \ 491 $(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 492 print $$1"\t"$$0 }' $^ \ 493 | $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 494 $(RMV) $(TMP) $@ 495 @$(DBLOAD) -c 496 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 497 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 498 499 500passwd.byuid: $(PASSWD) 501 @echo "Updating $@..." 502 $(CAT) $(PASSWD) | \ 503 $(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 504 print $$3"\t"$$0 }' $^ \ 505 | $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 506 $(RMV) $(TMP) $@ 507 @$(DBLOAD) -c 508 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 509 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 510 @$(MAKE) -f ../Makefile netid 511 512 513group.byname: $(GROUP) 514 @echo "Updating $@..." 515 $(CAT) $(GROUP) | \ 516 $(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 517 print $$1"\t"$$0 }' $^ \ 518 | $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 519 $(RMV) $(TMP) $@ 520 @$(DBLOAD) -c 521 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 522 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 523 524 525group.bygid: $(GROUP) 526 @echo "Updating $@..." 527 $(CAT) $(GROUP) | \ 528 $(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 529 print $$3"\t"$$0 }' $^ \ 530 | $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 531 $(RMV) $(TMP) $@ 532 @$(DBLOAD) -c 533 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 534 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 535 @$(MAKE) -f ../Makefile netid 536 537 538netid.byname: $(GROUP) $(PASSWD) 539 @echo "Updating $@..." 540 @$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \ 541 -d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \ 542 $(RMV) $(TMP) $@ 543 @$(DBLOAD) -c 544 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 545 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 546 547 548master.passwd.byname: $(MASTER) 549 @echo "Updating $@..." 550.if ${MASTER} == "/dev/null" 551 @echo "Master.passwd source file not found -- skipping" 552.else 553 $(CAT) $(MASTER) | \ 554 $(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 555 print $$1"\t"$$0 }' $^ \ 556 | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 557 $(RMV) $(TMP) $@ 558 @$(DBLOAD) -c 559 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 560 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 561.endif 562 563 564master.passwd.byuid: $(MASTER) 565 @echo "Updating $@..." 566.if ${MASTER} == "/dev/null" 567 @echo "Master.passwd source file not found -- skipping" 568.else 569 $(CAT) $(MASTER) | \ 570 $(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 571 print $$3"\t"$$0 }' $^ \ 572 | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 573 $(RMV) $(TMP) $@ 574 @$(DBLOAD) -c 575 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 576 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 577.endif 578 579 580amd.map: $(AMDHOST) 581 @echo "Updating $@..." 582 $(CAT) $(AMDHOST) | \ 583 $(AWK) '$$1 !~ "^#.*" { \ 584 for (i = 1; i <= NF; i++) \ 585 if (i == NF) { \ 586 if (substr($$i, length($$i), 1) == "\\") \ 587 printf("%s", substr($$i, 1, length($$i) - 1)); \ 588 else \ 589 printf("%s\n", $$i); \ 590 } \ 591 else \ 592 printf("%s ", $$i); \ 593 }' | \ 594 $(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP); \ 595 $(RMV) $(TMP) $@ 596 @$(DBLOAD) -c 597 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 598 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 599 600