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 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 73YPDIR = /var/yp 74YPMAPDIR = $(YPDIR)/$(DOMAIN) 75 76# These are the files from which the NIS databases are built. You may edit 77# these to taste in the event that you wish to keep your NIS source files 78# seperate from your NIS server's actual configuration files. Note that the 79# NIS passwd and master.passwd files are stored in /var/yp: the server's 80# real password database is not used by default. However, you may use 81# the real /etc/passwd and /etc/master.passwd files by: 82# 83# 84# - invoking yppasswdd without the -m option (yppasswdd will use 85# /etc/master.passwd if no alternate master.passwd file is specified 86# and do a 'pwd_mkdb' as needed). 87# - Specifying the location of the master.passwd file using the 88# MASTER_PASSWD variable, i.e.: 89# 90# # make MASTER_PASSWD=/path/to/some/other/master.passwd 91# 92# - (optionally): editing this Makefile to change the default location. 93# 94# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw 95# passwd file will be generated from the master.passwd file automagically. 96# 97ETHERS = $(YPSRCDIR)/ethers # ethernet addresses (for rarpd) 98BOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd) 99HOSTS = $(YPSRCDIR)/hosts 100NETWORKS = $(YPSRCDIR)/networks 101PROTOCOLS = $(YPSRCDIR)/protocols 102RPC = $(YPSRCDIR)/rpc 103SERVICES = $(YPSRCDIR)/services 104GROUP = $(YPSRCDIR)/group 105ALIASES = $(YPSRCDIR)/aliases 106NETGROUP = $(YPDIR)/netgroup 107PASSWD = $(YPDIR)/passwd 108.if !defined(MASTER_PASSWD) 109MASTER = $(YPDIR)/master.passwd 110.else 111MASTER = $(MASTER_PASSWD) 112.endif 113YPSERVERS = $(YPDIR)/ypservers # List of all NIS servers for a domain 114PUBLICKEY = $(YPSRCDIR)/publickey 115NETID = $(YPSRCDIR)/netid 116AMDHOST = $(YPSRCDIR)/amd.host 117 118target: 119 @$(RM) $(NFILE) 120 @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ 121 cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ 122 make -f ../Makefile all; echo "NIS Map update completed." 123 124# If you don't want some of these maps built, feel free to comment 125# them out from this list. 126# Note that we don't build the ethers or boorparams maps by default 127# since /etc/ethers and /etc/bootparams are not likely to be present 128# on all systems. 129# 130 131all: servers master.passwd passwd hosts group networks protocols rpc \ 132 services netid 133 # aliases publickey netgrp ethers bootparam amd.host 134 135ethers: ethers.byname ethers.byaddr 136bootparam: bootparams 137hosts: hosts.byname hosts.byaddr 138networks: networks.byaddr networks.byname 139protocols: protocols.bynumber protocols.byname 140rpc: rpc.byname rpc.bynumber 141services: services.byname 142passwd: passwd.byname passwd.byuid 143group: group.byname group.bygid 144netgrp: netgroup 145netid: netid.byname 146servers: ypservers 147publickey: publickey.byname 148aliases: mail.aliases 149 150master.passwd: master.passwd.byname master.passwd.byuid 151 152# 153# This is a special target used only when doing in-place updates with 154# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd 155# server and won't need to be remade. They will have to be pushed to the 156# slaves however. Calling this target implicitly insures that this will 157# happen. 158# 159pushpw: 160 @$(DBLOAD) -c 161 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi 162 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi 163 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi 164 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi 165 166mail.aliases: $(ALIASES) 167 @echo "Updating $@..." 168 @echo $@.$$$$ > $(NFILE) 169 @$(NEWALIASES) -oA$(ALIASES) 170 @$(MKDB) -u $(ALIASES).db \ 171 | $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP) 172 @$(MV) $(TMP) $@ 173 @$(DBLOAD) -c 174 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 175 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 176 177 178ypservers: $(YPSERVERS) 179 @echo "Updating $@..." 180 @echo $@.$$$$ > $(NFILE) 181 $(CAT) $(YPSERVERS) | \ 182 $(AWK) '{ if ($$1 != "" && $$1 != "#") print $$0"\t"$$0 }' $^ \ 183 | $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP) 184 @$(MV) $(TMP) $@ 185 @$(DBLOAD) -c 186 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 187 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 188 189 190ethers.byname: $(ETHERS) 191 @echo "Updating $@..." 192 @echo $@.$$$$ > $(NFILE) 193 $(CAT) $(ETHERS) | \ 194 $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 195 print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 196 -o $(YPMAPDIR)/$@ - $(TMP) 197 @$(MV) $(TMP) $@ 198 @$(DBLOAD) -c 199 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 200 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 201 202 203ethers.byaddr: $(ETHERS) 204 @echo "Updating $@..." 205 @echo $@.$$$$ > $(NFILE) 206 $(CAT) $(ETHERS) | \ 207 $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 208 print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \ 209 -o $(YPMAPDIR)/$@ - $(TMP) 210 @$(MV) $(TMP) $@ 211 @$(DBLOAD) -c 212 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 213 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 214 215 216bootparams: $(BOOTPARAMS) 217 @echo "Updating $@..." 218 @echo $@.$$$$ > $(NFILE) 219 $(CAT) $(BOOTPARAMS) | \ 220 $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 221 print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \ 222 -o $(YPMAPDIR)/$@ - $(TMP) 223 @$(MV) $(TMP) $@ 224 @$(DBLOAD) -c 225 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 226 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 227 228 229netgroup: $(NETGROUP) netgroup.byhost netgroup.byuser 230 @echo "Updating $@..." 231 @echo $@.$$$$ > $(NFILE) 232 $(CAT) $(NETGROUP) | \ 233 $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 234 print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 235 -o $(YPMAPDIR)/$@ - $(TMP) 236 @$(MV) $(TMP) $@ 237 @$(DBLOAD) -c 238 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 239 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 240 @$(MAKE) -f ../Makefile netid 241 242 243netgroup.byhost: $(NETGROUP) 244 @echo "Updating $@..." 245 @echo $@.$$$$ > $(NFILE) 246 $(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \ 247 $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 248 print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 249 -o $(YPMAPDIR)/$@ - $(TMP) 250 @$(MV) $(TMP) $@ 251 @$(DBLOAD) -c 252 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 253 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 254 255 256netgroup.byuser: $(NETGROUP) 257 @echo "Updating $@..." 258 @echo $@.$$$$ > $(NFILE) 259 $(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \ 260 $(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \ 261 print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \ 262 -o $(YPMAPDIR)/$@ - $(TMP) 263 @$(MV) $(TMP) $@ 264 @$(DBLOAD) -c 265 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 266 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 267 268 269hosts.byname: $(HOSTS) 270 @echo "Updating $@..." 271 @echo $@.$$$$ > $(NFILE) 272 $(CAT) $(HOSTS) | \ 273 $(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "#"; n++) \ 274 print $$n"\t"$$0 }' $^ | $(DBLOAD) ${B} -i $(HOSTS) \ 275 -o $(YPMAPDIR)/$@ - $(TMP) 276 @$(MV) $(TMP) $@ 277 @$(DBLOAD) -c 278 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 279 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 280 @$(MAKE) -f ../Makefile netid 281 282 283hosts.byaddr: $(HOSTS) 284 @echo "Updating $@..." 285 @echo $@.$$$$ > $(NFILE) 286 $(CAT) $(HOSTS) | \ 287 $(AWK) '$$1 !~ "#" { print $$1"\t"$$0 }' $^ \ 288 | $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP) 289 @$(MV) $(TMP) $@ 290 @$(DBLOAD) -c 291 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 292 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 293 @$(MAKE) -f ../Makefile netid 294 295 296networks.byname: $(NETWORKS) 297 @echo "Updating $@..." 298 @echo $@.$$$$ > $(NFILE) 299 $(CAT) $(NETWORKS) | \ 300 $(AWK) \ 301 '$$1 !~ "#" { print $$1"\t"$$0; \ 302 for (n=3; n<=NF && $$n !~ "#"; n++) \ 303 print $$n"\t"$$0 \ 304 }' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP) 305 @$(MV) $(TMP) $@ 306 @$(DBLOAD) -c 307 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 308 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 309 310 311networks.byaddr: $(NETWORKS) 312 @echo "Updating $@..." 313 @echo $@.$$$$ > $(NFILE) 314 $(CAT) $(NETWORKS) | \ 315 $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \ 316 | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP) 317 @$(MV) $(TMP) $@ 318 @$(DBLOAD) -c 319 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 320 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 321 322 323protocols.byname: $(PROTOCOLS) 324 @echo "Updating $@..." 325 @echo $@.$$$$ > $(NFILE) 326 $(CAT) $(PROTOCOLS) | \ 327 $(AWK) \ 328 '$$1 !~ "#" { print $$1"\t"$$0; \ 329 for (n=3; n<=NF && $$n !~ "#"; n++) \ 330 print $$n"\t"$$0 \ 331 }' $^ | $(DBLOAD) -i $(PROTOCOLS) \ 332 -o $(YPMAPDIR)/$@ - $(TMP) 333 @$(MV) $(TMP) $@ 334 @$(DBLOAD) -c 335 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 336 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 337 338 339protocols.bynumber: $(PROTOCOLS) 340 @echo "Updating $@..." 341 @echo $@.$$$$ > $(NFILE) 342 $(CAT) $(PROTOCOLS) | \ 343 $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \ 344 | $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP) 345 @$(MV) $(TMP) $@ 346 @$(DBLOAD) -c 347 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 348 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 349 350 351rpc.byname: $(RPC) 352 @echo "Updating $@..." 353 @echo $@.$$$$ > $(NFILE) 354 $(CAT) $(RPC) | \ 355 $(AWK) \ 356 '$$1 !~ "#" { print $$1"\t"$$0; \ 357 for (n=3; n<=NF && $$n !~ "#"; n++) \ 358 print $$n"\t"$$0 \ 359 }' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP) 360 @$(MV) $(TMP) $@ 361 @$(DBLOAD) -c 362 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 363 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 364 365 366rpc.bynumber: $(RPC) 367 @echo "Updating $@..." 368 @echo $@.$$$$ > $(NFILE) 369 $(CAT) $(RPC) | \ 370 $(AWK) '$$1 !~ "#" { print $$2"\t"$$0 }' $^ \ 371 | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP) 372 @$(MV) $(TMP) $@ 373 @$(DBLOAD) -c 374 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 375 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 376 377 378services.byname: $(SERVICES) 379 @echo "Updating $@..." 380 @echo $@.$$$$ > $(NFILE) 381 $(CAT) $(SERVICES) | \ 382 $(AWK) \ 383 '$$1 !~ "#" { for (n=1; n<=NF && $$n !~ "#"; n++) { \ 384 if (index($$2,"udp")) { printf("%s/udp",$$n) } \ 385 else { printf("%s/tcp",$$n) }; print "\t"$$0 ; \ 386 if (n == 1) n = 2; \ 387 } ; print $$2"\t"$$0 ; \ 388 }' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP) 389 @$(MV) $(TMP) $@ 390 @$(DBLOAD) -c 391 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 392 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 393 394 395publickey.byname: $(PUBLICKEY) 396 @echo "Updating $@..." 397 @echo $@.$$$$ > $(NFILE) 398 $(CAT) $(PUBLICKEY) | \ 399 $(AWK) '$$1 !~ "#" { print $$1"\t"$$2 }' $^ \ 400 | $(DBLOAD) -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP) 401 @$(MV) $(TMP) $@ 402 @$(DBLOAD) -c 403 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 404 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 405 406 407$(PASSWD): $(MASTER) 408 @echo "Creating new $@ file from $(MASTER)..." 409 @if [ ! $(UNSECURE) ]; then \ 410 $(RCAT) $(MASTER) | \ 411 $(AWK) -F: '{if ($$1 != "+") \ 412 print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 413 > $(PASSWD) ; \ 414 else $(RCAT) $(MASTER) | \ 415 $(AWK) -F: '{if ($$1 != "+") \ 416 print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \ 417 > $(PASSWD) ; fi 418 419 420passwd.byname: $(PASSWD) 421 @echo "Updating $@..." 422 @echo $@.$$$$ > $(NFILE) 423 $(CAT) $(PASSWD) | \ 424 $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 425 | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP) 426 @$(MV) $(TMP) $@ 427 @$(DBLOAD) -c 428 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 429 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 430 431 432passwd.byuid: $(PASSWD) 433 @echo "Updating $@..." 434 @echo $@.$$$$ > $(NFILE) 435 $(CAT) $(PASSWD) | \ 436 $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 437 | $(DBLOAD) -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP) 438 @$(MV) $(TMP) $@ 439 @$(DBLOAD) -c 440 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 441 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 442 @$(MAKE) -f ../Makefile netid 443 444 445group.byname: $(GROUP) 446 @echo "Updating $@..." 447 @echo $@.$$$$ > $(NFILE) 448 $(CAT) $(GROUP) | \ 449 $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 450 | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP) 451 @$(MV) $(TMP) $@ 452 @$(DBLOAD) -c 453 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 454 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 455 456 457group.bygid: $(GROUP) 458 @echo "Updating $@..." 459 @echo $@.$$$$ > $(NFILE) 460 $(CAT) $(GROUP) | \ 461 $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 462 | $(DBLOAD) -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP) 463 @$(MV) $(TMP) $@ 464 @$(DBLOAD) -c 465 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 466 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 467 @$(MAKE) -f ../Makefile netid 468 469 470netid.byname: $(GROUP) $(PASSWD) 471 @echo "Updating $@..." 472 @echo $@.$$$$ > $(NFILE) 473 @$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \ 474 -d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP) 475 @$(MV) $(TMP) $@ 476 @$(DBLOAD) -c 477 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 478 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 479 480 481master.passwd.byname: $(MASTER) 482 @echo "Updating $@..." 483 @echo $@.$$$$ > $(NFILE) 484 $(CAT) $(MASTER) | \ 485 $(AWK) -F: '{ if ($$1 != "+") print $$1"\t"$$0 }' $^ \ 486 | $(DBLOAD) ${S} -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP) 487 @$(MV) $(TMP) $@ 488 @$(DBLOAD) -c 489 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 490 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 491 492 493master.passwd.byuid: $(MASTER) 494 @echo "Updating $@..." 495 @echo $@.$$$$ > $(NFILE) 496 $(CAT) $(MASTER) | \ 497 $(AWK) -F: '{ if ($$1 != "+") print $$3"\t"$$0 }' $^ \ 498 | $(DBLOAD) ${S} -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP) 499 @$(MV) $(TMP) $@ 500 @$(DBLOAD) -c 501 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 502 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 503 504amd.host: $(AMDHOST) 505 @echo "Updating $@..." 506 @echo $@.$$$$ > $(NFILE) 507 $(CAT) $(AMDHOST) | \ 508 $(AWK) '$$1 !~ "#" { \ 509 for (i = 1; i <= NF; i++) \ 510 if (i == NF) { \ 511 if (substr($$i, length($$i), 1) == "\\") \ 512 printf("%s", substr($$i, 1, length($$i) - 1)); \ 513 else \ 514 printf("%s\n", $$i); \ 515 } \ 516 else \ 517 printf("%s ", $$i); \ 518 }' | \ 519 $(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP) 520 @$(MV) $(TMP) $@ 521 @$(DBLOAD) -c 522 @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi 523 @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi 524 525