From 059a9bc2bb95ccc3a5f6b8f40819813380523d7e Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Thu, 26 Oct 1995 18:00:35 +0000 Subject: [PATCH] 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.) --- gnu/usr.sbin/ypserv/Makefile.yp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/gnu/usr.sbin/ypserv/Makefile.yp b/gnu/usr.sbin/ypserv/Makefile.yp index 06fa8a28287b..beb46e83b3e1 100644 --- a/gnu/usr.sbin/ypserv/Makefile.yp +++ b/gnu/usr.sbin/ypserv/Makefile.yp @@ -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) $@