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 101NETWORKS = $(YPSRCDIR)/networks 102PROTOCOLS = $(YPSRCDIR)/protocols 103RPC = $(YPSRCDIR)/rpc 104SERVICES = $(YPSRCDIR)/services 105SHELLS = $(YPSRCDIR)/shells 106GROUP = $(YPSRCDIR)/group 107ALIASES = $(YPSRCDIR)/mail/aliases 108NETGROUP = $(YPDIR)/netgroup 109PASSWD = $(YPDIR)/passwd 110.if !defined(MASTER_PASSWD) 111MASTER = $(YPDIR)/master.passwd 112.else 113MASTER = $(MASTER_PASSWD) 114.endif 115YPSERVERS = $(YPDIR)/ypservers # List of all NIS servers for a domain 116PUBLICKEY = $(YPSRCDIR)/publickey 117NETID = $(YPSRCDIR)/netid 118AMDHOST = $(YPSRCDIR)/amd.map 119 120# List of maps that are always built. 121# If you want to omit some of them, feel free to comment 122# them out from this list. 123TARGETS= servers hosts networks protocols rpc services shells group 124#TARGETS+= aliases 125 126# Sanity checks: filter out targets we can't build 127# Note that we don't build the ethers or boorparams maps by default 128# since /etc/ethers and /etc/bootparams are not likely to be present 129# on all systems. 130.if exists($(ETHERS)) 131TARGETS+= ethers 132.else 133ETHERS= /dev/null 134.endif 135 136.if exists($(BOOTPARAMS)) 137TARGETS+= bootparams 138.else 139BOOTPARAMS= /dev/null 140.endif 141 142.if exists($(NETGROUP)) 143TARGETS+= netgrp 144.else 145NETGROUP= /dev/null 146.endif 147 148.if exists($(MASTER)) 149TARGETS+= passwd master.passwd netid 150.else 151MASTER= /dev/null 152TARGETS+= nopass 153.endif 154 155.if exists($(PUBLICKEY)) 156TARGETS+= publickey 157.else 158PUBLICKEY= /dev/null 159.endif 160 161.if exists($(AMDHOST)) 162TARGETS+= amd.map 163.else 164AMDHOST= /dev/null 165.endif 166 167target: 168 @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ 169 cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ 170 make -f ../Makefile all; echo "NIS Map update completed." 171 172all: $(TARGETS) 173 174ethers: ethers.byname ethers.byaddr 175bootparam: bootparams 176hosts: hosts.byname hosts.byaddr 177networks: networks.byaddr networks.byname 178protocols: protocols.bynumber protocols.byname 179rpc: rpc.byname rpc.bynumber 180services: services.byname 181shells: shells.list 182passwd: passwd.byname passwd.byuid 183group: group.byname group.bygid 184netgrp: netgroup 185netid: netid.byname 186servers: ypservers 187publickey: publickey.byname 188aliases: mail.aliases 189 190master.passwd: master.passwd.byname master.passwd.byuid 191 192# 193# This is a special target used only when doing in-place updates with 194# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd 195# server and won't need to be remade. They will have to be pushed to the 196# slaves however. Calling this target implicitly insures that this will 197# happen. 198# 199pushpw: 200 @$(DBLOAD) -c 201 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi 202 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi 203 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi 204 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi 205 206pushmap: 207 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi 208 209nopass: 210 @echo "" 211 @echo " ********WARNING********" 212 @echo " Couldn't find the master.passwd source file. This file" 213 @echo " is needed to generate the master.passwd and passwd maps." 214 @echo " The default location is /var/yp/master.passwd. You should" 215 @echo " edit /var/yp/Makefile and set the MASTER variable to point" 216 @echo " to the source file you wish to use for building the passwd" 217 @echo " maps, or else invoke make(1) in the following manner:" 218 @echo "" 219 @echo " make MASTER_PASSWD=/path/to/master.passwd" 220 @echo "" 221 222mail.aliases: $(ALIASES) 223 @echo "Updating $@..." 224 @$(NEWALIASES) -oA$(ALIASES) 225 @$(MKDB) -u $(ALIASES).db \ 226 | $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \ 227 $(RMV) $(TMP) $@ 228 @$(DBLOAD) -c 229 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 230 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 231 232 233ypservers: $(YPSERVERS) 234 @echo "Updating $@..." 235 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \ 236 $(YPSERVERS) \ 237 | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \ 238 $(RMV) $(TMP) $@ 239 @$(DBLOAD) -c 240 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 241 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 242 243ethers.byname: $(ETHERS) 244 @echo "Updating $@..." 245.if ${ETHERS} == "/dev/null" 246 @echo "Ethers source file not found -- skipping" 247.else 248 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 249 print $$2"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \ 250 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 251 @$(DBLOAD) -c 252 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 253 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 254.endif 255 256ethers.byaddr: $(ETHERS) 257 @echo "Updating $@..." 258.if ${ETHERS} == "/dev/null" 259 @echo "Ethers source file not found -- skipping" 260.else 261 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 262 print $$1"\t"$$0 }' $(ETHERS) | $(DBLOAD) -i $(ETHERS) \ 263 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 264 @$(DBLOAD) -c 265 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 266 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 267.endif 268 269 270bootparams: $(BOOTPARAMS) 271 @echo "Updating $@..." 272.if ${BOOTPARAMS} == "/dev/null" 273 @echo "Bootparams source file not found -- skipping" 274.else 275 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 276 print $$0 }' $(BOOTPARAMS) | $(DBLOAD) -i $(BOOTPARAMS) \ 277 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 278 @$(DBLOAD) -c 279 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 280 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 281.endif 282 283 284netgroup: $(NETGROUP) netgroup.byhost netgroup.byuser 285 @echo "Updating $@..." 286.if ${NETGROUP} == "/dev/null" 287 @echo "Netgroup source file not found -- skipping" 288.else 289 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 290 print $$0 }' $(NETGROUP) | $(DBLOAD) -i $(NETGROUP) \ 291 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 292 @$(DBLOAD) -c 293 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 294 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 295 @$(MAKE) -f ../Makefile netid 296.endif 297 298 299netgroup.byhost: $(NETGROUP) 300 @echo "Updating $@..." 301.if ${NETGROUP} == "/dev/null" 302 @echo "Netgroup source file not found -- skipping" 303.else 304 @$(REVNETGROUP) -h -f $(NETGROUP) | \ 305 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 306 print $$0 }' | $(DBLOAD) -i $(NETGROUP) \ 307 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 308 @$(DBLOAD) -c 309 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 310 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 311.endif 312 313 314netgroup.byuser: $(NETGROUP) 315 @echo "Updating $@..." 316.if ${NETGROUP} == "/dev/null" 317 @echo "Netgroup source file not found -- skipping" 318.else 319 @$(REVNETGROUP) -u -f $(NETGROUP) | \ 320 $(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 321 print $$0 }' | $(DBLOAD) -i $(NETGROUP) \ 322 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 323 @$(DBLOAD) -c 324 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 325 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 326.endif 327 328 329hosts.byname: $(HOSTS) 330 @echo "Updating $@..." 331 @$(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ 332 print $$n"\t"$$0 }' $(HOSTS) | $(DBLOAD) ${B} -i $(HOSTS) \ 333 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 334 @$(DBLOAD) -c 335 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 336 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 337 @$(MAKE) -f ../Makefile netid 338 339 340hosts.byaddr: $(HOSTS) 341 @echo "Updating $@..." 342 @$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $(HOSTS) \ 343 | $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP); \ 344 $(RMV) $(TMP) $@ 345 @$(DBLOAD) -c 346 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 347 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 348 @$(MAKE) -f ../Makefile netid 349 350 351networks.byname: $(NETWORKS) 352 @echo "Updating $@..." 353 @$(AWK) \ 354 '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 355 for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 356 print $$n"\t"$$0 \ 357 }' $(NETWORKS) \ 358 | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 359 $(RMV) $(TMP) $@ 360 @$(DBLOAD) -c 361 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 362 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 363 364 365networks.byaddr: $(NETWORKS) 366 @echo "Updating $@..." 367 @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(NETWORKS) \ 368 | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \ 369 $(RMV) $(TMP) $@ 370 @$(DBLOAD) -c 371 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 372 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 373 374 375protocols.byname: $(PROTOCOLS) 376 @echo "Updating $@..." 377 @$(AWK) \ 378 '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 379 for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 380 print $$n"\t"$$0 \ 381 }' $(PROTOCOLS) | $(DBLOAD) -i $(PROTOCOLS) \ 382 -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ 383 @$(DBLOAD) -c 384 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 385 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 386 387 388protocols.bynumber: $(PROTOCOLS) 389 @echo "Updating $@..." 390 @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(PROTOCOLS) \ 391 | $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP); \ 392 $(RMV) $(TMP) $@ 393 @$(DBLOAD) -c 394 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 395 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 396 397 398rpc.byname: $(RPC) 399 @echo "Updating $@..." 400 @$(AWK) \ 401 '$$1 !~ "^#.*" { print $$1"\t"$$0; \ 402 for (n=3; n<=NF && $$n !~ "^#.*"; n++) \ 403 print $$n"\t"$$0 \ 404 }' $(RPC) | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \ 405 $(RMV) $(TMP) $@ 406 @$(DBLOAD) -c 407 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 408 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 409 410 411rpc.bynumber: $(RPC) 412 @echo "Updating $@..." 413 @$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $(RPC) \ 414 | $(DBLOAD) -i $(RPC) -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 421services.byname: $(SERVICES) 422 @echo "Updating $@..." 423 @$(AWK) \ 424 '$$1 !~ "^#.*" { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \ 425 if (split($$2, t, "/")) { \ 426 printf("%s/%s", $$n, t[2]) }; \ 427 print "\t"$$0; \ 428 if (n == 1) n = 2; \ 429 } ; print $$2"\t"$$0 ; \ 430 }' $(SERVICES) \ 431 | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \ 432 $(RMV) $(TMP) $@ 433 @$(DBLOAD) -c 434 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 435 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 436 437shells.list: $(SHELLS) 438 @echo "Updating $@..." 439 @$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' \ 440 $(SHELLS) \ 441 | $(DBLOAD) -i $(SHELLS) -o $(YPMAPDIR)/$@ - $(TMP); \ 442 $(RMV) $(TMP) $@ 443 @$(DBLOAD) -c 444 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 445 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 446 447publickey.byname: $(PUBLICKEY) 448 @echo "Updating $@..." 449.if ${PUBLICKEY} == "/dev/null" 450 @echo "Publickey source file not found -- skipping" 451.else 452 @$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $(PUBLICKEY) \ 453 | $(DBLOAD) -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \ 454 $(RMV) $(TMP) $@ 455 @$(DBLOAD) -c 456 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 457 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 458.endif 459 460 461$(PASSWD): $(MASTER) 462 @echo "Creating new $@ file from $(MASTER)..." 463 @if [ ! $(UNSECURE) ]; then \ 464 $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 465 print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \ 466 > $(PASSWD) ; \ 467 else \ 468 $(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 469 print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $(MASTER) \ 470 > $(PASSWD) ; fi 471 472 473passwd.byname: $(PASSWD) 474 @echo "Updating $@..." 475 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 476 print $$1"\t"$$0 }' $(PASSWD) \ 477 | $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 478 $(RMV) $(TMP) $@ 479 @$(DBLOAD) -c 480 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 481 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 482 483 484passwd.byuid: $(PASSWD) 485 @echo "Updating $@..." 486 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 487 print $$3"\t"$$0 }' $(PASSWD) \ 488 | $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ 489 $(RMV) $(TMP) $@ 490 @$(DBLOAD) -c 491 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 492 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 493 @$(MAKE) -f ../Makefile netid 494 495 496group.byname: $(GROUP) 497 @echo "Updating $@..." 498 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 499 print $$1"\t"$$0 }' $(GROUP) \ 500 | $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 501 $(RMV) $(TMP) $@ 502 @$(DBLOAD) -c 503 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 504 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 505 506 507group.bygid: $(GROUP) 508 @echo "Updating $@..." 509 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 510 print $$3"\t"$$0 }' $(GROUP) \ 511 | $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \ 512 $(RMV) $(TMP) $@ 513 @$(DBLOAD) -c 514 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 515 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 516 @$(MAKE) -f ../Makefile netid 517 518 519netid.byname: $(GROUP) $(PASSWD) 520 @echo "Updating $@..." 521 @$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \ 522 -d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \ 523 $(RMV) $(TMP) $@ 524 @$(DBLOAD) -c 525 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 526 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 527 528 529master.passwd.byname: $(MASTER) 530 @echo "Updating $@..." 531.if ${MASTER} == "/dev/null" 532 @echo "Master.passwd source file not found -- skipping" 533.else 534 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 535 print $$1"\t"$$0 }' $(MASTER) \ 536 | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 537 $(RMV) $(TMP) $@ 538 @$(DBLOAD) -c 539 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 540 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 541.endif 542 543 544master.passwd.byuid: $(MASTER) 545 @echo "Updating $@..." 546.if ${MASTER} == "/dev/null" 547 @echo "Master.passwd source file not found -- skipping" 548.else 549 @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ 550 print $$3"\t"$$0 }' $(MASTER) \ 551 | $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \ 552 $(RMV) $(TMP) $@ 553 @$(DBLOAD) -c 554 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 555 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 556.endif 557 558 559amd.map: $(AMDHOST) 560 @echo "Updating $@..." 561 @$(AWK) '$$1 !~ "^#.*" { \ 562 for (i = 1; i <= NF; i++) \ 563 if (i == NF) { \ 564 if (substr($$i, length($$i), 1) == "\\") \ 565 printf("%s", substr($$i, 1, length($$i) - 1)); \ 566 else \ 567 printf("%s\n", $$i); \ 568 } \ 569 else \ 570 printf("%s ", $$i); \ 571 }' $(AMDHOST) | \ 572 $(DBLOAD) -i $(AMDHOST) -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 578