/[vps]/baselayout-vserver/branches/baselayout-1_12/sbin/depscan.sh
Gentoo

Contents of /baselayout-vserver/branches/baselayout-1_12/sbin/depscan.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 201 - (show annotations) (download) (as text)
Tue Jan 10 16:48:26 2006 UTC (8 years, 11 months ago) by phreak
File MIME type: text/x-sh
File size: 2077 byte(s)
Merging r1799
1 #!/bin/bash
2 # Copyright 1999-2004 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 source /sbin/functions.sh
6
7 if [[ $1 == "--debug" ]] ; then
8 shift
9 set -x
10 fi
11
12 if [[ ! -d ${svcdir} ]] ; then
13 if ! mkdir -p -m 0755 "${svcdir}" 2>/dev/null ; then
14 eerror "Could not create needed directory '${svcdir}'!"
15 fi
16 fi
17
18 for x in softscripts snapshot options daemons \
19 started starting inactive stopping failed \
20 exclusive exitcodes restart ; do
21 if [[ ! -d "${svcdir}/${x}" ]] ; then
22 if ! mkdir -p -m 0755 "${svcdir}/${x}" 2>/dev/null ; then
23 eerror "Could not create needed directory '${svcdir}/${x}'!"
24 fi
25 fi
26 done
27
28 # Only update if files have actually changed
29 update=1
30
31 if [[ $1 == "-u" ]] ; then
32 update=0
33 clock_screw=0
34 mtime_test="${svcdir}/mtime-test.$$"
35
36 # If its not there, we have to update, and make sure its present
37 # for next mtime testing
38 if [[ ! -e ${svcdir}/depcache ]] ; then
39 update=1
40 touch "${svcdir}/depcache"
41 fi
42
43 touch "${mtime_test}"
44 for config in /etc/conf.d /etc/init.d /etc/rc.conf
45 do
46 [[ ${update} == 0 ]] && \
47 is_older_than "${svcdir}/depcache" "${config}" && update=1
48
49 is_older_than "${mtime_test}" "${config}" && clock_screw=1
50 done
51 rm -f "${mtime_test}"
52
53 [[ ${clock_screw} == 1 ]] && \
54 ewarn "Some file in '/etc/{conf.d,init.d}' have Modification time in the future!"
55
56 shift
57 fi
58
59 [[ ${update} == 0 ]] && exit 0
60
61 ebegin "Caching service dependencies"
62
63 # Clean out the non volitile directories ...
64 rm -rf "${svcdir}"/dep{cache,tree} "${svcdir}"/{broken,snapshot}/*
65
66 retval=0
67 SVCDIR="${svcdir}"
68 DEPTYPES="${deptypes}"
69 ORDTYPES="${ordtypes}"
70
71 export SVCDIR DEPTYPES ORDTYPES
72
73 cd /etc/init.d
74
75 /bin/gawk \
76 -f /lib/rcscripts/awk/functions.awk \
77 -f /lib/rcscripts/awk/cachedepends.awk || \
78 retval=1
79
80 bash "${svcdir}/depcache" | \
81 /bin/gawk \
82 -f /lib/rcscripts/awk/functions.awk \
83 -f /lib/rcscripts/awk/gendepends.awk || \
84 retval=1
85
86 touch "${svcdir}"/dep{cache,tree}
87 chmod 0644 "${svcdir}"/dep{cache,tree}
88
89 eend ${retval} "Failed to cache service dependencies"
90
91 exit ${retval}
92
93 # vim:ts=4

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20