# # @(#)make.script 1.1 86/02/05 SMI # @(#)make.script 2.1 86/04/16 NFSSRC # DIR =/etc DOM = `domainname` NOPUSH = "" ALIASES = /usr/lib/aliases all: passwd group hosts ethers networks rpc services protocols \ netgroup aliases passwd.time: $(DIR)/passwd -@if [ -f $(DIR)/passwd ]; then \ awk 'BEGIN { FS=":"; OFS="\t"; } /^[a-zA-Z0-9_]/ { print $$1, $$0 }' \ $(DIR)/passwd | makedbm - /etc/yp/$(DOM)/passwd.byname; \ awk 'BEGIN { FS=":"; OFS="\t"; } /^[a-zA-Z0-9_]/ { print $$3, $$0 }' \ $(DIR)/passwd | makedbm - /etc/yp/$(DOM)/passwd.byuid; \ touch passwd.time; \ echo "updated passwd"; \ if [ ! $(NOPUSH) ]; then \ /etc/yp/yppush passwd.byname; \ /etc/yp/yppush passwd.byuid; \ echo "pushed passwd"; \ else \ : ; \ fi \ else \ echo "couldn't find $(DIR)/passwd"; \ fi group.time: $(DIR)/group -@if [ -f $(DIR)/group ]; then \ awk 'BEGIN { FS=":"; OFS="\t"; } { print $$1, $$0 }' \ $(DIR)/group | makedbm - /etc/yp/$(DOM)/group.byname; \ awk 'BEGIN { FS=":"; OFS="\t"; } { print $$3, $$0 }' \ $(DIR)/group | makedbm - /etc/yp/$(DOM)/group.bygid; \ touch group.time; \ echo "updated group"; \ if [ ! $(NOPUSH) ]; then \ /etc/yp/yppush group.byname; \ /etc/yp/yppush group.bygid; \ echo "pushed group"; \ else \ : ; \ fi \ else \ echo "couldn't find $(DIR)/group"; \ fi hosts.time: $(DIR)/hosts -@if [ -f $(DIR)/hosts ]; then \ sed -e "/^#/d" -e s/#.*$$// $(DIR)/hosts | /etc/yp/stdhosts \ | awk '{for (i = 2; i <= NF; i++) print $$i, $$0}' \ | makedbm - /etc/yp/$(DOM)/hosts.byname; \ /etc/yp/stdhosts $(DIR)/hosts | \ awk 'BEGIN { OFS="\t"; } $$1 !~ /^#/ { print $$1, $$0 }' \ | makedbm - /etc/yp/$(DOM)/hosts.byaddr; \ touch hosts.time; \ echo "updated hosts"; \ if [ ! $(NOPUSH) ]; then \ /etc/yp/yppush hosts.byname; \ /etc/yp/yppush hosts.byaddr; \ echo "pushed hosts"; \ else \ : ; \ fi \ else \ echo "couldn't find $(DIR)/hosts"; \ fi ethers.time: $(DIR)/ethers -@if [ -f $(DIR)/ethers ]; then \ sed -e "/^#/d" -e s/#.*$$// $(DIR)/ethers \ | awk 'BEGIN { X["A"]="a"; X["B"]="b"; X["C"]="c"; X["D"]="d";X["E"]="e"; X["F"]="f"; } \ { for (i = 1; i <= length($$1); i++) \ if (substr($$1, i, 1) >= "A" && substr($$1, i, 1) <= "Z") \ printf("%s", X[substr($$1, i, 1)]) ; \ else \ printf("%s", substr($$1, i, 1)); printf(" "); \ print $$2}' \ |awk '{print $$1, $$0; for (i = 3;i <= NF;i++) print $$i,$$0}' \ | makedbm - /etc/yp/$(DOM)/ethers.byaddr; \ awk 'BEGIN { OFS="\t"; } $$1 !~ /^#/ { print $$2, $$0 }' \ $(DIR)/ethers | \ makedbm - /etc/yp/$(DOM)/ethers.byname;\ touch ethers.time; \ echo "updated ethers"; \ if [ ! $(NOPUSH) ]; then \ /etc/yp/yppush ethers.byname; \ /etc/yp/yppush ethers.byaddr; \ echo "pushed ethers"; \ else \ : ; \ fi \ else \ echo "couldn't find $(DIR)/ethers"; \ fi networks.time: $(DIR)/networks -@if [ -f $(DIR)/networks ]; then \ sed -e "/^#/d" -e s/#.*$$// $(DIR)/networks | awk \ '{print $$1, $$0; for (i = 3;i <= NF;i++) print $$i,$$0}' \ | makedbm - /etc/yp/$(DOM)/networks.byname; \ awk 'BEGIN { OFS="\t"; } $$1 !~ /^#/ { print $$2, $$0 }' \ $(DIR)/networks | makedbm - /etc/yp/$(DOM)/networks.byaddr;\ touch networks.time; \ echo "updated networks"; \ if [ ! $(NOPUSH) ]; then \ /etc/yp/yppush networks.byname; \ /etc/yp/yppush networks.byaddr; \ echo "pushed networks"; \ else \ : ; \ fi \ else \ echo "couldn't find $(DIR)/networks"; \ fi services.time: $(DIR)/services -@if [ -f $(DIR)/services ]; then \ awk 'BEGIN { OFS="\t"; } $$1 !~ /^#/ { print $$2, $$0 }' \ $(DIR)/services| makedbm - /etc/yp/$(DOM)/services.byname;\ touch services.time; \ echo "updated services"; \ if [ ! $(NOPUSH) ]; then \ /etc/yp/yppush services.byname; \ echo "pushed services"; \ else \ : ; \ fi \ else \ echo "couldn't find $(DIR)/services"; \ fi rpc.time: $(DIR)/rpc -@if [ -f $(DIR)/rpc ]; then \ awk 'BEGIN { OFS="\t"; } $$1 !~ /^#/ { print $$2, $$0 }' \ $(DIR)/rpc| makedbm - /etc/yp/$(DOM)/rpc.bynumber;\ touch rpc.time; \ echo "updated rpc"; \ if [ ! $(NOPUSH) ]; then \ /etc/yp/yppush rpc.bynumber; \ echo "pushed rpc"; \ else \ : ; \ fi \ else \ echo "couldn't find $(DIR)/rpc"; \ fi protocols.time: $(DIR)/protocols -@if [ -f $(DIR)/protocols ]; then \ awk 'BEGIN { OFS="\t"; } $$1 !~ /^#/ { print $$2, $$0 }' \ $(DIR)/protocols | makedbm - \ /etc/yp/$(DOM)/protocols.bynumber; \ sed -e "/^#/d" -e s/#.*$$// $(DIR)/protocols | awk \ '{print $$1,$$0; for (i = 3;i <= NF;i++) print $$i, $$0}' \ | makedbm - /etc/yp/$(DOM)/protocols.byname; \ touch protocols.time; \ echo "updated protocols"; \ if [ ! $(NOPUSH) ]; then \ /etc/yp/yppush protocols.byname; \ /etc/yp/yppush protocols.bynumber; \ echo "pushed protocols"; \ else \ : ; \ fi \ else \ echo "couldn't find $(DIR)/protocols"; \ fi netgroup.time: $(DIR)/netgroup -@if [ -f $(DIR)/netgroup ]; then \ makedbm $(DIR)/netgroup /etc/yp/$(DOM)/netgroup; \ revnetgroup -u | makedbm - /etc/yp/$(DOM)/netgroup.byuser; \ revnetgroup -h | makedbm - /etc/yp/$(DOM)/netgroup.byhost; \ touch netgroup.time; \ echo "updated netgroup"; \ if [ ! $(NOPUSH) ]; then \ /etc/yp/yppush netgroup; \ /etc/yp/yppush netgroup.byuser; \ /etc/yp/yppush netgroup.byhost; \ echo "pushed netgroup"; \ else \ : ; \ fi \ else \ echo "couldn't find $(DIR)/netgroup"; \ fi aliases.time: $(ALIASES) -@if [ -f $(ALIASES) ]; then \ cp $(ALIASES) /etc/yp/$(DOM)/mail.aliases; \ /usr/lib/sendmail -bi -oA/etc/yp/$(DOM)/mail.aliases; \ rm /etc/yp/$(DOM)/mail.aliases; \ touch aliases.time; \ echo "updated aliases"; \ if [ ! $(NOPUSH) ]; then \ /etc/yp/yppush mail.aliases; \ echo "pushed aliases"; \ else \ : ; \ fi \ else \ echo "couldn't find $(ALIASES)"; \ fi passwd: passwd.time group: group.time hosts: hosts.time ethers: ethers.time networks: networks.time rpc: rpc.time services: services.time protocols: protocols.time netgroup: netgroup.time aliases: aliases.time $(DIR)/passwd: $(DIR)/group: $(DIR)/hosts: $(DIR)/ethers: $(DIR)/networks: $(DIR)/rpc: $(DIR)/services: $(DIR)/protocols: $(DIR)/netgroup: $(ALIASES):