Add preliminary support for netgroup.byuser and netgroup.byhosts maps.

(I have to make another pass through here soon; awk doesn't handle
lines broken up with '\', which can sometimes appear in netgroup maps.)
This commit is contained in:
Bill Paul 1995-10-26 18:00:35 +00:00
parent 0b8ab5c8e1
commit 059a9bc2bb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11818

View File

@ -43,6 +43,7 @@ DBLOAD = /usr/sbin/yp_mkdb -m `hostname`
MKNETID = /usr/libexec/mknetid
YPPUSH = /usr/bin/yppush
DOMAIN = `/bin/domainname`
REVNETGROUP = /usr/libexec/revnetgroup
YPSRCDIR = /etc
YPDIR = /var/yp
@ -161,7 +162,7 @@ bootparams: $(BOOTPARAMS)
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
netgroup: $(NETGROUP)
netgroup: $(NETGROUP) netgroup.byhost netgroup.byuser
@echo "Updating $@..."
$(RM) $@
$(CAT) $(NETGROUP) | \
@ -173,6 +174,28 @@ netgroup: $(NETGROUP)
@$(MAKE) -f ../Makefile netid
netgroup.byhost: $(NETGROUP)
@echo "Updating $@..."
$(RM) $@
$(CAT) $(NETGROUP) | $(REVNETGROUP) -h -f $(NETGROUP) | \
$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
-o $(YPMAPDIR)/$@ - $@
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
netgroup.byuser: $(NETGROUP)
@echo "Updating $@..."
$(RM) $@
$(CAT) $(NETGROUP) | $(REVNETGROUP) -u -f $(NETGROUP) | \
$(AWK) '{ if ($$1 != "" && $$1 != "#" && $$1 != "+") \
print $$0 }' $^ | $(DBLOAD) -i $(NETGROUP) \
-o $(YPMAPDIR)/$@ - $@
@if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi
@if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi
hosts.byname: $(HOSTS)
@echo "Updating $@..."
$(RM) $@