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