/[baselayout]/branches/bsd-porting/sbin/depscan.sh
Gentoo

Contents of /branches/bsd-porting/sbin/depscan.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1985 - (show annotations) (download) (as text)
Sat Apr 15 17:14:13 2006 UTC (8 years, 6 months ago) by vapier
File MIME type: text/x-sh
File size: 2115 byte(s)
improve wording in clock skew message #130040 by Gordon
1 #!/bin/bash
2 # Copyright 1999-2004 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 source /etc/init.d/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 ; 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 if [[ ${clock_screw} == 1 ]] ; then
54 ewarn "One of the files in /etc/{conf.d,init.d} or /etc/rc.conf"
55 ewarn "has a modification time in the future!"
56 fi
57
58 shift
59 fi
60
61 [[ ${update} == 0 ]] && exit 0
62
63 ebegin "Caching service dependencies"
64
65 # Clean out the non volatile directories ...
66 rm -rf "${svcdir}"/dep{cache,tree} "${svcdir}"/{broken,snapshot}/*
67
68 retval=0
69 SVCDIR="${svcdir}"
70 DEPTYPES="${deptypes}"
71 ORDTYPES="${ordtypes}"
72
73 export SVCDIR DEPTYPES ORDTYPES
74
75 cd /etc/init.d
76
77 /bin/gawk \
78 -f /lib/rcscripts/awk/functions.awk \
79 -f /lib/rcscripts/awk/cachedepends.awk || \
80 retval=1
81
82 bash "${svcdir}/depcache" | \
83 /bin/gawk \
84 -f /lib/rcscripts/awk/functions.awk \
85 -f /lib/rcscripts/awk/gendepends.awk || \
86 retval=1
87
88 touch "${svcdir}"/dep{cache,tree}
89 chmod 0644 "${svcdir}"/dep{cache,tree}
90
91 eend ${retval} "Failed to cache service dependencies"
92
93 exit ${retval}
94
95 # vim:ts=4

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20