/[baselayout]/trunk/sbin/depscan.sh
Gentoo

Contents of /trunk/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 ago) by vapier
File MIME type: text/x-sh
File size: 2406 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 /sbin/functions.sh
6 mysvcdir="${svcdir}"
7 update=false
8
9 while [[ -n $1 ]] ; do
10 case "$1" in
11 --debug|-d)
12 set -x
13 ;;
14 --svcdir|-s)
15 if [[ -z $2 || $2 == -* ]] ; then
16 eerror "No svcdir specified"
17 else
18 shift
19 mysvcdir="$1"
20 fi
21 ;;
22 --update|-u)
23 update=true
24 ;;
25 esac
26 shift
27 done
28
29 if [[ ! -d ${mysvcdir} ]] ; then
30 if ! mkdir -p -m 0755 "${mysvcdir}" 2>/dev/null ; then
31 eerror "Could not create needed directory '${mysvcdir}'!"
32 fi
33 fi
34
35 for x in softscripts snapshot options daemons \
36 started starting inactive wasinactive stopping failed \
37 exclusive exitcodes scheduled ; do
38 if [[ ! -d "${mysvcdir}/${x}" ]] ; then
39 if ! mkdir -p -m 0755 "${mysvcdir}/${x}" 2>/dev/null ; then
40 eerror "Could not create needed directory '${mysvcdir}/${x}'!"
41 fi
42 fi
43 done
44
45 # Only update if files have actually changed
46 if ! ${update} ; then
47 clock_screw=0
48 mtime_test="${mysvcdir}/mtime-test.$$"
49
50 # If its not there, we have to update, and make sure its present
51 # for next mtime testing
52 if [[ ! -e "${mysvcdir}/depcache" ]] ; then
53 update=true
54 touch "${mysvcdir}/depcache"
55 fi
56
57 touch "${mtime_test}"
58 for config in /etc/conf.d /etc/init.d /etc/rc.conf
59 do
60 ! ${update} \
61 && is_older_than "${mysvcdir}/depcache" "${config}" \
62 && update=true
63
64 is_older_than "${mtime_test}" "${config}" && clock_screw=1
65 done
66 rm -f "${mtime_test}"
67
68 if [[ ${clock_screw} == 1 ]] ; then
69 ewarn "One of the files in /etc/{conf.d,init.d} or /etc/rc.conf"
70 ewarn "has a modification time in the future!"
71 fi
72
73 shift
74 fi
75
76 ! ${update} && [[ -e "${mysvcdir}/deptree" ]] && exit 0
77
78 ebegin "Caching service dependencies"
79
80 # Clean out the non volatile directories ...
81 rm -rf "${mysvcdir}"/dep{cache,tree} "${mysvcdir}"/{broken,snapshot}/*
82
83 retval=0
84 SVCDIR="${mysvcdir}"
85 DEPTYPES="${deptypes}"
86 ORDTYPES="${ordtypes}"
87
88 export SVCDIR DEPTYPES ORDTYPES
89
90 cd /etc/init.d
91
92 /bin/gawk \
93 -f /lib/rcscripts/awk/functions.awk \
94 -f /lib/rcscripts/awk/cachedepends.awk || \
95 retval=1
96
97 bash "${mysvcdir}/depcache" | \
98 /bin/gawk \
99 -f /lib/rcscripts/awk/functions.awk \
100 -f /lib/rcscripts/awk/gendepends.awk || \
101 retval=1
102
103 touch "${mysvcdir}"/dep{cache,tree}
104 chmod 0644 "${mysvcdir}"/dep{cache,tree}
105
106 eend ${retval} "Failed to cache service dependencies"
107
108 exit ${retval}
109
110 # 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