1 DATABASES = $(wildcard /etc/passwd /etc/group /etc/ethers /etc/protocols \
2 /etc/rpc /etc/services /etc/shadow /etc/netgroup)
7 MAKEDB = makedb --quiet
9 all: $(patsubst %,$(VAR_DB)/%.db,$(notdir $(DATABASES)))
12 $(VAR_DB)/passwd.db: /etc/passwd
13 @echo -n "$(patsubst %.db,%,$(@F))... "
14 @$(AWK) 'BEGIN { FS=":"; OFS=":" } \
15 /^[^#]/ { printf ".%s ", $$1; print; \
17 { printf "=%s ", $$3; print } }' $^ | \
21 $(VAR_DB)/group.db: /etc/group
22 @echo -n "$(patsubst %.db,%,$(@F))... "
23 @$(AWK) 'BEGIN { FS=":"; OFS=":" } \
24 /^[^#]/ { printf ".%s ", $$1; print; \
25 printf "=%s ", $$3; print }' $^ | \
29 $(VAR_DB)/ethers.db: /etc/ethers
30 @echo -n "$(patsubst %.db,%,$(@F))... "
31 @$(AWK) '/^[^#]/ { printf ".%s ", $$1; print; \
32 printf "=%s ", $$2; print }' $^ | \
36 $(VAR_DB)/protocols.db: /etc/protocols
37 @echo -n "$(patsubst %.db,%,$(@F))... "
38 @$(AWK) '/^[^#]/ { printf ".%s ", $$1; print; \
39 printf "=%s ", $$2; print; \
40 for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \
41 { printf ".%s ", $$i; print } }' $^ | \
45 $(VAR_DB)/rpc.db: /etc/rpc
46 @echo -n "$(patsubst %.db,%,$(@F))... "
47 @$(AWK) '/^[^#]/ { printf ".%s ", $$1; print; \
48 printf "=%s ", $$2; print; \
49 for (i = 3; i <= NF && !($$i ~ /^#/); ++i) \
50 { printf ".%s ", $$i; print } }' $^ | \
54 $(VAR_DB)/services.db: /etc/services
55 @echo -n "$(patsubst %.db,%,$(@F))... "
56 @$(AWK) 'BEGIN { FS="[ \t/]+" } \
57 /^[^#]/ { printf ".%s/%s ", $$1, $$3; print; \
58 printf "=%s/%s ", $$2, $$3; print; \
59 for (i = 4; i <= NF && !($$i ~ /^#/); ++i) \
60 { printf ".%s/%s ", $$i, $$3; print } }' $^ | \
64 $(VAR_DB)/shadow.db: /etc/shadow
65 @echo -n "$(patsubst %.db,%,$(@F))... "
66 @$(AWK) 'BEGIN { FS=":"; OFS=":" } \
67 /^[^#]/ { printf ".%s ", $$1; print }' $^ | \
71 $(VAR_DB)/netgroup.db: /etc/netgroup
72 @echo -n "$(patsubst %.db,%,$(@F))... "
73 @$(AWK) '/^[^#]/ { end=sub(/\\/, " "); \
74 gsub(/[ \t]+/, " "); \
75 if(end == 1) printf "%s", $$0; else print }' $^ | \