/[gentoo-src]/rc-scripts/src/awk/cachedepends.awk
Gentoo

Diff of /rc-scripts/src/awk/cachedepends.awk

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.14 Revision 1.15
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# Author: Martin Schlemmer <azarah@gentoo.org> 3# Author: Martin Schlemmer <azarah@gentoo.org>
4# $Header: /var/cvsroot/gentoo-src/rc-scripts/src/awk/cachedepends.awk,v 1.14 2003/12/29 01:00:27 azarah Exp $ 4# $Header: /var/cvsroot/gentoo-src/rc-scripts/src/awk/cachedepends.awk,v 1.15 2004/02/26 17:29:43 azarah Exp $
5 5
6function print_start() { 6function print_start() {
7 print "source /sbin/functions.sh" >> (SVCDIR "/depcache") 7 print "source /sbin/functions.sh" >> (SVCDIR "/depcache")
8 print "" >> (SVCDIR "/depcache") 8 print "" >> (SVCDIR "/depcache")
9 print "need() {" >> (SVCDIR "/depcache") 9 print "need() {" >> (SVCDIR "/depcache")
30 print " echo \"PARALLEL $*\"; return 0" >> (SVCDIR "/depcache") 30 print " echo \"PARALLEL $*\"; return 0" >> (SVCDIR "/depcache")
31 print "}" >> (SVCDIR "/depcache") 31 print "}" >> (SVCDIR "/depcache")
32 print "" >> (SVCDIR "/depcache") 32 print "" >> (SVCDIR "/depcache")
33} 33}
34 34
35function print_header1() { 35function print_header1(mtime) {
36 print "#*** " MYFILENAME " ***" >> (SVCDIR "/depcache") 36 print "#*** " MYFILENAME " ***" >> (SVCDIR "/depcache")
37 print "" >> (SVCDIR "/depcache") 37 print "" >> (SVCDIR "/depcache")
38 print "myservice=\"" MYFILENAME "\"" >> (SVCDIR "/depcache") 38 print "myservice=\"" MYFILENAME "\"" >> (SVCDIR "/depcache")
39 print "myservice=\"${myservice##*/}\"" >> (SVCDIR "/depcache") 39 print "myservice=\"${myservice##*/}\"" >> (SVCDIR "/depcache")
40 print "echo \"RCSCRIPT ${myservice}\"" >> (SVCDIR "/depcache") 40 print "echo \"RCSCRIPT ${myservice}\"" >> (SVCDIR "/depcache")
41 print "" >> (SVCDIR "/depcache") 41 print "" >> (SVCDIR "/depcache")
42 print "echo \"MTIME " mtime "\"" >> (SVCDIR "/depcache")
43 print "" >> (SVCDIR "/depcache")
42} 44}
43 45
44function print_header2() { 46function print_header2(mtime) {
45 print "(" >> (SVCDIR "/depcache") 47 print "(" >> (SVCDIR "/depcache")
46 print " # Get settings for rc-script ..." >> (SVCDIR "/depcache") 48 print " # Get settings for rc-script ..." >> (SVCDIR "/depcache")
47 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" >> (SVCDIR "/depcache")
48 print "" >> (SVCDIR "/depcache") 50 print "" >> (SVCDIR "/depcache")
49 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}\"" >> (SVCDIR "/depcache")
105 107
106 for (count = 1;count <= RCCOUNT;count++) { 108 for (count = 1;count <= RCCOUNT;count++) {
107 109
108 MYFNR = 1 110 MYFNR = 1
109 MYFILENAME = RCSCRIPTS[count] 111 MYFILENAME = RCSCRIPTS[count]
112 STAT_DATA[1] = 1
110 113
111 while (((getline < (RCSCRIPTS[count])) > 0) && (!NEXTFILE)) { 114 while (((getline < (RCSCRIPTS[count])) > 0) && (!NEXTFILE)) {
112 115
113 # If line start with a '#' and is the first line 116 # If line start with a '#' and is the first line
114 if (($0 ~ /^[[:space:]]*#/) && (MYFNR == 1)) { 117 if (($0 ~ /^[[:space:]]*#/) && (MYFNR == 1)) {
122 125
123 ewarn(RCSCRIPTS[count] " is invalid (should not end with '.sh')") 126 ewarn(RCSCRIPTS[count] " is invalid (should not end with '.sh')")
124 NEXTFILE = 1 127 NEXTFILE = 1
125 continue 128 continue
126 } 129 }
130
131 if (stat(MYFILENAME, STAT_DATA) != 0)
132 ewarn("Could not stat \"" MYFILENAME "\"")
127 133
128 ISRCSCRIPT = 1 134 ISRCSCRIPT = 1
129 print_header1() 135 print_header1(STAT_DATA["mtime"])
130 } else { 136 } else {
131 137
132 NEXTFILE = 1 138 NEXTFILE = 1
133 continue 139 continue
134 } 140 }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

  ViewVC Help
Powered by ViewVC 1.1.20