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