1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00
freebsd/usr.sbin/ypserv/Makefile.yp
Robert Drehmel 80fc33c35f Add a target for the creation of a /etc/shells map and add it to
the maps which are built by default.
2003-03-21 11:44:03 +00:00

600 lines
18 KiB
Makefile

#
# Makefile for the NIS databases
#
# $FreeBSD$
#
# This Makefile should only be run on the NIS master server of a domain.
# All updated maps will be pushed to all NIS slave servers listed in the
# /var/yp/ypservers file. Please make sure that the hostnames of all
# NIS servers in your domain are listed in /var/yp/ypservers.
#
# This Makefile can be modified to support more NIS maps if desired.
#
# If this machine is an NIS master, comment out this next line so
# that changes to the NIS maps can be propagated to the slave servers.
# (By default we assume that we are only serving a small domain with
# only one server.)
#
NOPUSH = "True"
# If you want to use a FreeBSD NIS server to serve non-FreeBSD clients
# (i.e. clients who expect the password field in the passwd maps to be
# valid) then uncomment this line. This will cause $YPDIR/passwd to
# be generated with valid password fields. This is insecure: FreeBSD
# normally only serves the master.passwd maps (which have real encrypted
# passwords in them) to the superuser on other FreeBSD machines, but
# non-FreeBSD clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX,
# etc...) will only work properly in 'unsecure' mode.
#
#UNSECURE = "True"
# The following line encodes the YP_INTERDOMAIN key into the hosts.byname
# and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve
# hosts not in the current domain. Commenting this line out will disable
# the DNS lookups.
B=-b
# Normally, the master.passwd.* maps are guarded against access from
# non-privileged users. By commenting out the following line, the YP_SECURE
# key will be removed from these maps, allowing anyone to access them.
S=-s
# These are commands which this Makefile needs to properly rebuild the
# NIS databases. Don't change these unless you have a good reason. Also
# be sure not to place an @ in front of /usr/bin/awk: it isn't necessary
# and it'll break everything in sight.
#
AWK = /usr/bin/awk
RM = @/bin/rm -f
MV = @/bin/mv -f
RMV = /bin/mv -f
RCAT = /bin/cat
CAT = @$(RCAT)
MKDB = /usr/sbin/yp_mkdb
DBLOAD = $(MKDB) -m `hostname`
MKNETID = /usr/libexec/mknetid
NEWALIASES = /usr/bin/newaliases
YPPUSH = /usr/sbin/yppush
.if !defined(UPDATE_DOMAIN)
DOMAIN = `/bin/domainname`
.else
DOMAIN = $(UPDATE_DOMAIN)
.endif
REVNETGROUP = /usr/libexec/revnetgroup
TMP = `echo $@.$$$$`
# It is advisable to create a separate directory to contain the
# source files used to generate your NIS maps. If you intend to
# support multiple domains, something like /src/dir/$DOMAIN
# would work well.
YPSRCDIR = /etc
.if !defined(YP_DIR)
YPDIR = /var/yp
.else
YPDIR = $(YP_DIR)
.endif
YPMAPDIR = $(YPDIR)/$(DOMAIN)
# These are the files from which the NIS databases are built. You may edit
# these to taste in the event that you wish to keep your NIS source files
# separate from your NIS server's actual configuration files. Note that the
# NIS passwd and master.passwd files are stored in /var/yp: the server's
# real password database is not used by default. However, you may use
# the real /etc/passwd and /etc/master.passwd files by:
#
#
# - invoking yppasswdd with `-t /etc/master.passwd' (yppasswdd will do a
# 'pwd_mkdb' as needed if /etc/master.passwd is thus specified).
# - Specifying the location of the master.passwd file using the
# MASTER_PASSWD variable, i.e.:
#
# # make MASTER_PASSWD=/path/to/some/other/master.passwd
#
# - (optionally): editing this Makefile to change the default location.
#
# To add a user, edit $(YPDIR)/master.passwd and type 'make'. The raw
# passwd file will be generated from the master.passwd file automagically.
#
ETHERS = $(YPSRCDIR)/ethers # ethernet addresses (for rarpd)
BOOTPARAMS= $(YPSRCDIR)/bootparams # for booting Sun boxes (bootparamd)
HOSTS = $(YPSRCDIR)/hosts
NETWORKS = $(YPSRCDIR)/networks
PROTOCOLS = $(YPSRCDIR)/protocols
RPC = $(YPSRCDIR)/rpc
SERVICES = $(YPSRCDIR)/services
SHELLS = $(YPSRCDIR)/shells
GROUP = $(YPSRCDIR)/group
ALIASES = $(YPSRCDIR)/mail/aliases
NETGROUP = $(YPDIR)/netgroup
PASSWD = $(YPDIR)/passwd
.if !defined(MASTER_PASSWD)
MASTER = $(YPDIR)/master.passwd
.else
MASTER = $(MASTER_PASSWD)
.endif
YPSERVERS = $(YPDIR)/ypservers # List of all NIS servers for a domain
PUBLICKEY = $(YPSRCDIR)/publickey
NETID = $(YPSRCDIR)/netid
AMDHOST = $(YPSRCDIR)/amd.map
# List of maps that are always built.
# If you want to omit some of them, feel free to comment
# them out from this list.
TARGETS= servers hosts networks protocols rpc services shells group
#TARGETS+= aliases
# Sanity checks: filter out targets we can't build
# Note that we don't build the ethers or boorparams maps by default
# since /etc/ethers and /etc/bootparams are not likely to be present
# on all systems.
.if exists($(ETHERS))
TARGETS+= ethers
.else
ETHERS= /dev/null
.endif
.if exists($(BOOTPARAMS))
TARGETS+= bootparams
.else
BOOTPARAMS= /dev/null
.endif
.if exists($(NETGROUP))
TARGETS+= netgrp
.else
NETGROUP= /dev/null
.endif
.if exists($(MASTER))
TARGETS+= passwd master.passwd netid
.else
MASTER= /dev/null
TARGETS+= nopass
.endif
.if exists($(PUBLICKEY))
TARGETS+= publickey
.else
PUBLICKEY= /dev/null
.endif
.if exists($(AMDHOST))
TARGETS+= amd.map
.else
AMDHOST= /dev/null
.endif
target:
@if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \
cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \
make -f ../Makefile all; echo "NIS Map update completed."
all: $(TARGETS)
ethers: ethers.byname ethers.byaddr
bootparam: bootparams
hosts: hosts.byname hosts.byaddr
networks: networks.byaddr networks.byname
protocols: protocols.bynumber protocols.byname
rpc: rpc.byname rpc.bynumber
services: services.byname
shells: shells.list
passwd: passwd.byname passwd.byuid
group: group.byname group.bygid
netgrp: netgroup
netid: netid.byname
servers: ypservers
publickey: publickey.byname
aliases: mail.aliases
master.passwd: master.passwd.byname master.passwd.byuid
#
# This is a special target used only when doing in-place updates with
# rpc.yppasswdd. In this case, the maps will be updated by the rpc.yppasswdd
# server and won't need to be remade. They will have to be pushed to the
# slaves however. Calling this target implicitly insures that this will
# happen.
#
pushpw:
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi
pushmap:
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $(PUSHMAP) ; fi
nopass:
@echo ""
@echo " ********WARNING********"
@echo " Couldn't find the master.passwd source file. This file"
@echo " is needed to generate the master.passwd and passwd maps."
@echo " The default location is /var/yp/master.passwd. You should"
@echo " edit /var/yp/Makefile and set the MASTER variable to point"
@echo " to the source file you wish to use for building the passwd"
@echo " maps, or else invoke make(1) in the following manner:"
@echo ""
@echo " make MASTER_PASSWD=/path/to/master.passwd"
@echo ""
mail.aliases: $(ALIASES)
@echo "Updating $@..."
@$(NEWALIASES) -oA$(ALIASES)
@$(MKDB) -u $(ALIASES).db \
| $(DBLOAD) -i $(ALIASES) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
ypservers: $(YPSERVERS)
@echo "Updating $@..."
$(CAT) $(YPSERVERS) | \
$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' $^ \
| $(DBLOAD) -i $(YPSERVERS) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
ethers.byname: $(ETHERS)
@echo "Updating $@..."
.if ${ETHERS} == "/dev/null"
@echo "Ethers source file not found -- skipping"
.else
$(CAT) $(ETHERS) | \
$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$2"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \
-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
.endif
ethers.byaddr: $(ETHERS)
@echo "Updating $@..."
.if ${ETHERS} == "/dev/null"
@echo "Ethers source file not found -- skipping"
.else
$(CAT) $(ETHERS) | \
$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$1"\t"$$0 }' $^ | $(DBLOAD) -i $(ETHERS) \
-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
.endif
bootparams: $(BOOTPARAMS)
@echo "Updating $@..."
.if ${BOOTPARAMS} == "/dev/null"
@echo "Bootparams source file not found -- skipping"
.else
$(CAT) $(BOOTPARAMS) | \
$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$0 }' $^ | $(DBLOAD) -i $(BOOTPARAMS) \
-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
.endif
netgroup: $(NETGROUP) netgroup.byhost netgroup.byuser
@echo "Updating $@..."
.if ${NETGROUP} == "/dev/null"
@echo "Netgroup source file not found -- skipping"
.else
$(CAT) $(NETGROUP) | \
$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
@$(MAKE) -f ../Makefile netid
.endif
netgroup.byhost: $(NETGROUP)
@echo "Updating $@..."
.if ${NETGROUP} == "/dev/null"
@echo "Netgroup source file not found -- skipping"
.else
$(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \
$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
.endif
netgroup.byuser: $(NETGROUP)
@echo "Updating $@..."
.if ${NETGROUP} == "/dev/null"
@echo "Netgroup source file not found -- skipping"
.else
$(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \
$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
.endif
hosts.byname: $(HOSTS)
@echo "Updating $@..."
$(CAT) $(HOSTS) | \
$(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \
print $$n"\t"$$0 }' $^ | $(DBLOAD) ${B} -i $(HOSTS) \
-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
@$(MAKE) -f ../Makefile netid
hosts.byaddr: $(HOSTS)
@echo "Updating $@..."
$(CAT) $(HOSTS) | \
$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $^ \
| $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
@$(MAKE) -f ../Makefile netid
networks.byname: $(NETWORKS)
@echo "Updating $@..."
$(CAT) $(NETWORKS) | \
$(AWK) \
'$$1 !~ "^#.*" { print $$1"\t"$$0; \
for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
print $$n"\t"$$0 \
}' $^ | $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
networks.byaddr: $(NETWORKS)
@echo "Updating $@..."
$(CAT) $(NETWORKS) | \
$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \
| $(DBLOAD) -i $(NETWORKS) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
protocols.byname: $(PROTOCOLS)
@echo "Updating $@..."
$(CAT) $(PROTOCOLS) | \
$(AWK) \
'$$1 !~ "^#.*" { print $$1"\t"$$0; \
for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
print $$n"\t"$$0 \
}' $^ | $(DBLOAD) -i $(PROTOCOLS) \
-o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
protocols.bynumber: $(PROTOCOLS)
@echo "Updating $@..."
$(CAT) $(PROTOCOLS) | \
$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \
| $(DBLOAD) -i $(PROTOCOLS) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
rpc.byname: $(RPC)
@echo "Updating $@..."
$(CAT) $(RPC) | \
$(AWK) \
'$$1 !~ "^#.*" { print $$1"\t"$$0; \
for (n=3; n<=NF && $$n !~ "^#.*"; n++) \
print $$n"\t"$$0 \
}' $^ | $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
rpc.bynumber: $(RPC)
@echo "Updating $@..."
$(CAT) $(RPC) | \
$(AWK) '$$1 !~ "^#.*" { print $$2"\t"$$0 }' $^ \
| $(DBLOAD) -i $(RPC) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
services.byname: $(SERVICES)
@echo "Updating $@..."
$(CAT) $(SERVICES) | \
$(AWK) \
'$$1 !~ "^#.*" { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \
if (split($$2, t, "/")) { \
printf("%s/%s", $$n, t[2]) }; \
print "\t"$$0; \
if (n == 1) n = 2; \
} ; print $$2"\t"$$0 ; \
}' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
shells.list: $(SHELLS)
@echo "Updating $@..."
$(CAT) $(SHELLS) | \
$(AWK) '{ if ($$1 != "" && $$1 !~ "^#.*") print $$0"\t"$$0 }' $^ | \
$(DBLOAD) -i $(SHELLS) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
publickey.byname: $(PUBLICKEY)
@echo "Updating $@..."
.if ${PUBLICKEY} == "/dev/null"
@echo "Publickey source file not found -- skipping"
.else
$(CAT) $(PUBLICKEY) | \
$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$2 }' $^ \
| $(DBLOAD) -i $(PUBLICKEY) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
.endif
$(PASSWD): $(MASTER)
@echo "Creating new $@ file from $(MASTER)..."
@if [ ! $(UNSECURE) ]; then \
$(RCAT) $(MASTER) | \
$(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$1":*:"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
> $(PASSWD) ; \
else $(RCAT) $(MASTER) | \
$(AWK) -F: '{if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$1":"$$2":"$$3":"$$4":"$$8":"$$9":"$$10}' $^ \
> $(PASSWD) ; fi
passwd.byname: $(PASSWD)
@echo "Updating $@..."
$(CAT) $(PASSWD) | \
$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$1"\t"$$0 }' $^ \
| $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
passwd.byuid: $(PASSWD)
@echo "Updating $@..."
$(CAT) $(PASSWD) | \
$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$3"\t"$$0 }' $^ \
| $(DBLOAD) -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
@$(MAKE) -f ../Makefile netid
group.byname: $(GROUP)
@echo "Updating $@..."
$(CAT) $(GROUP) | \
$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$1"\t"$$0 }' $^ \
| $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
group.bygid: $(GROUP)
@echo "Updating $@..."
$(CAT) $(GROUP) | \
$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$3"\t"$$0 }' $^ \
| $(DBLOAD) -f -i $(GROUP) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
@$(MAKE) -f ../Makefile netid
netid.byname: $(GROUP) $(PASSWD)
@echo "Updating $@..."
@$(MKNETID) -q -p $(PASSWD) -g $(GROUP) -h $(HOSTS) -n $(NETID) \
-d $(DOMAIN) | $(DBLOAD) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
master.passwd.byname: $(MASTER)
@echo "Updating $@..."
.if ${MASTER} == "/dev/null"
@echo "Master.passwd source file not found -- skipping"
.else
$(CAT) $(MASTER) | \
$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$1"\t"$$0 }' $^ \
| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
.endif
master.passwd.byuid: $(MASTER)
@echo "Updating $@..."
.if ${MASTER} == "/dev/null"
@echo "Master.passwd source file not found -- skipping"
.else
$(CAT) $(MASTER) | \
$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \
print $$3"\t"$$0 }' $^ \
| $(DBLOAD) ${S} -f -i $(MASTER) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
.endif
amd.map: $(AMDHOST)
@echo "Updating $@..."
$(CAT) $(AMDHOST) | \
$(AWK) '$$1 !~ "^#.*" { \
for (i = 1; i <= NF; i++) \
if (i == NF) { \
if (substr($$i, length($$i), 1) == "\\") \
printf("%s", substr($$i, 1, length($$i) - 1)); \
else \
printf("%s\n", $$i); \
} \
else \
printf("%s ", $$i); \
}' | \
$(DBLOAD) -i $(AMDHOST) -o $(YPMAPDIR)/$@ - $(TMP); \
$(RMV) $(TMP) $@
@$(DBLOAD) -c
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi