Lines 4-76
Link Here
|
4 |
# $Header: /home/cvsroot/gentoo-src/rc-scripts/src/awk/cachedepends.awk,v 1.15 2004/02/26 17:29:43 azarah Exp $ |
4 |
# $Header: /home/cvsroot/gentoo-src/rc-scripts/src/awk/cachedepends.awk,v 1.15 2004/02/26 17:29:43 azarah Exp $ |
5 |
|
5 |
|
6 |
function print_start() { |
6 |
function print_start() { |
7 |
print "source /sbin/functions.sh" >> (SVCDIR "/depcache") |
7 |
print "source /sbin/functions.sh" >> tempfile |
8 |
print "" >> (SVCDIR "/depcache") |
8 |
print "" >> tempfile |
9 |
print "need() {" >> (SVCDIR "/depcache") |
9 |
print "need() {" >> tempfile |
10 |
print " echo \"NEED $*\"; return 0" >> (SVCDIR "/depcache") |
10 |
print " echo \"NEED $*\"; return 0" >> tempfile |
11 |
print "}" >> (SVCDIR "/depcache") |
11 |
print "}" >> tempfile |
12 |
print "" >> (SVCDIR "/depcache") |
12 |
print "" >> tempfile |
13 |
print "use() {" >> (SVCDIR "/depcache") |
13 |
print "use() {" >> tempfile |
14 |
print " echo \"USE $*\"; return 0" >> (SVCDIR "/depcache") |
14 |
print " echo \"USE $*\"; return 0" >> tempfile |
15 |
print "}" >> (SVCDIR "/depcache") |
15 |
print "}" >> tempfile |
16 |
print "" >> (SVCDIR "/depcache") |
16 |
print "" >> tempfile |
17 |
print "before() {" >> (SVCDIR "/depcache") |
17 |
print "before() {" >> tempfile |
18 |
print " echo \"BEFORE $*\"; return 0" >> (SVCDIR "/depcache") |
18 |
print " echo \"BEFORE $*\"; return 0" >> tempfile |
19 |
print "}" >> (SVCDIR "/depcache") |
19 |
print "}" >> tempfile |
20 |
print "" >> (SVCDIR "/depcache") |
20 |
print "" >> tempfile |
21 |
print "after() {" >> (SVCDIR "/depcache") |
21 |
print "after() {" >> tempfile |
22 |
print " echo \"AFTER $*\"; return 0" >> (SVCDIR "/depcache") |
22 |
print " echo \"AFTER $*\"; return 0" >> tempfile |
23 |
print "}" >> (SVCDIR "/depcache") |
23 |
print "}" >> tempfile |
24 |
print "" >> (SVCDIR "/depcache") |
24 |
print "" >> tempfile |
25 |
print "provide() {" >> (SVCDIR "/depcache") |
25 |
print "provide() {" >> tempfile |
26 |
print " echo \"PROVIDE $*\"; return 0" >> (SVCDIR "/depcache") |
26 |
print " echo \"PROVIDE $*\"; return 0" >> tempfile |
27 |
print "}" >> (SVCDIR "/depcache") |
27 |
print "}" >> tempfile |
28 |
print "" >> (SVCDIR "/depcache") |
28 |
print "" >> tempfile |
29 |
print "parallel() {" >> (SVCDIR "/depcache") |
29 |
print "parallel() {" >> tempfile |
30 |
print " echo \"PARALLEL $*\"; return 0" >> (SVCDIR "/depcache") |
30 |
print " echo \"PARALLEL $*\"; return 0" >> tempfile |
31 |
print "}" >> (SVCDIR "/depcache") |
31 |
print "}" >> tempfile |
32 |
print "" >> (SVCDIR "/depcache") |
32 |
print "" >> tempfile |
33 |
} |
33 |
} |
34 |
|
34 |
|
35 |
function print_header1(mtime) { |
35 |
function print_header1(mtime) { |
36 |
print "#*** " MYFILENAME " ***" >> (SVCDIR "/depcache") |
36 |
print "#*** " MYFILENAME " ***" >> tempfile |
37 |
print "" >> (SVCDIR "/depcache") |
37 |
print "" >> tempfile |
38 |
print "myservice=\"" MYFILENAME "\"" >> (SVCDIR "/depcache") |
38 |
print "myservice=\"" MYFILENAME "\"" >> tempfile |
39 |
print "myservice=\"${myservice##*/}\"" >> (SVCDIR "/depcache") |
39 |
print "myservice=\"${myservice##*/}\"" >> tempfile |
40 |
print "echo \"RCSCRIPT ${myservice}\"" >> (SVCDIR "/depcache") |
40 |
print "echo \"RCSCRIPT ${myservice}\"" >> tempfile |
41 |
print "" >> (SVCDIR "/depcache") |
41 |
print "" >> tempfile |
42 |
print "echo \"MTIME " mtime "\"" >> (SVCDIR "/depcache") |
42 |
print "echo \"MTIME " mtime "\"" >> tempfile |
43 |
print "" >> (SVCDIR "/depcache") |
43 |
print "" >> tempfile |
44 |
} |
44 |
} |
45 |
|
45 |
|
46 |
function print_header2(mtime) { |
46 |
function print_header2(mtime) { |
47 |
print "(" >> (SVCDIR "/depcache") |
47 |
print "(" >> tempfile |
48 |
print " # Get settings for rc-script ..." >> (SVCDIR "/depcache") |
48 |
print " # Get settings for rc-script ..." >> tempfile |
49 |
print " [ -e /etc/conf.d/basic ] && source /etc/conf.d/basic" >> (SVCDIR "/depcache") |
49 |
print " [ -e /etc/conf.d/basic ] && source /etc/conf.d/basic" >> tempfile |
50 |
print "" >> (SVCDIR "/depcache") |
50 |
print "" >> tempfile |
51 |
print " [ -e \"/etc/conf.d/${myservice}\" ] && source \"/etc/conf.d/${myservice}\"" >> (SVCDIR "/depcache") |
51 |
print " [ -e \"/etc/conf.d/${myservice}\" ] && source \"/etc/conf.d/${myservice}\"" >> tempfile |
52 |
print "" >> (SVCDIR "/depcache") |
52 |
print "" >> tempfile |
53 |
print " [ -e /etc/conf.d/net ] && \\" >> (SVCDIR "/depcache") |
53 |
print " [ -e /etc/conf.d/net ] && \\" >> tempfile |
54 |
print " [ \"${myservice%%.*}\" = \"net\" ] && \\" >> (SVCDIR "/depcache") |
54 |
print " [ \"${myservice%%.*}\" = \"net\" ] && \\" >> tempfile |
55 |
print " [ \"${myservice##*.}\" != \"${myservice}\" ] && source /etc/conf.d/net" >> (SVCDIR "/depcache") |
55 |
print " [ \"${myservice##*.}\" != \"${myservice}\" ] && source /etc/conf.d/net" >> tempfile |
56 |
print "" >> (SVCDIR "/depcache") |
56 |
print "" >> tempfile |
57 |
print " [ -e /etc/rc.conf ] && source /etc/rc.conf" >> (SVCDIR "/depcache") |
57 |
print " [ -e /etc/rc.conf ] && source /etc/rc.conf" >> tempfile |
58 |
print "" >> (SVCDIR "/depcache") |
58 |
print "" >> tempfile |
59 |
print " depend() {" >> (SVCDIR "/depcache") |
59 |
print " depend() {" >> tempfile |
60 |
print " return 0" >> (SVCDIR "/depcache") |
60 |
print " return 0" >> tempfile |
61 |
print " }" >> (SVCDIR "/depcache") |
61 |
print " }" >> tempfile |
62 |
print "" >> (SVCDIR "/depcache") |
62 |
print "" >> tempfile |
63 |
} |
63 |
} |
64 |
|
64 |
|
65 |
function print_end() { |
65 |
function print_end() { |
66 |
print "" >> (SVCDIR "/depcache") |
66 |
print "" >> tempfile |
67 |
print " depend" >> (SVCDIR "/depcache") |
67 |
print " depend" >> tempfile |
68 |
print ")" >> (SVCDIR "/depcache") |
68 |
print ")" >> tempfile |
69 |
print "" >> (SVCDIR "/depcache") |
69 |
print "" >> tempfile |
70 |
} |
70 |
} |
71 |
|
71 |
|
72 |
BEGIN { |
72 |
BEGIN { |
73 |
|
73 |
|
|
|
74 |
tempfile = "/tmp/depcache_" tempnum ".tmp" |
75 |
|
74 |
extension("/lib/rcscripts/filefuncs.so", "dlload") |
76 |
extension("/lib/rcscripts/filefuncs.so", "dlload") |
75 |
|
77 |
|
76 |
# Get our environment variables |
78 |
# Get our environment variables |
Lines 149-155
Link Here
|
149 |
GOTDEPEND = 1 |
151 |
GOTDEPEND = 1 |
150 |
|
152 |
|
151 |
print_header2() |
153 |
print_header2() |
152 |
print " # Actual depend() function ..." >> (SVCDIR "/depcache") |
154 |
print " # Actual depend() function ..." >> tempfile |
153 |
} |
155 |
} |
154 |
|
156 |
|
155 |
# We have the depend function... |
157 |
# We have the depend function... |
Lines 167-176
Link Here
|
167 |
# Make sure depend() contain something, else bash |
169 |
# Make sure depend() contain something, else bash |
168 |
# errors out (empty function). |
170 |
# errors out (empty function). |
169 |
if ((SBCOUNT > 0) && (COUNT == 0)) |
171 |
if ((SBCOUNT > 0) && (COUNT == 0)) |
170 |
print " \treturn 0" >> (SVCDIR "/depcache") |
172 |
print " \treturn 0" >> tempfile |
171 |
|
173 |
|
172 |
# Print the depend() function |
174 |
# Print the depend() function |
173 |
print " " $0 >> (SVCDIR "/depcache") |
175 |
print " " $0 >> tempfile |
174 |
|
176 |
|
175 |
# If COUNT=0, and SBCOUNT>0, it means we have read |
177 |
# If COUNT=0, and SBCOUNT>0, it means we have read |
176 |
# all matching '{' and '}' for depend(), so stop. |
178 |
# all matching '{' and '}' for depend(), so stop. |
Lines 197-202
Link Here
|
197 |
NEXTFILE = 0 |
199 |
NEXTFILE = 0 |
198 |
|
200 |
|
199 |
} |
201 |
} |
|
|
202 |
dosystem("mv -f " tempfile " " SVCDIR "/depcache") |
200 |
} |
203 |
} |
201 |
|
204 |
|
202 |
|
205 |
|