/[baselayout]/branches/rc-scripts-1_6/sbin/depscan.sh
Gentoo

Contents of /branches/rc-scripts-1_6/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: 1968 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 # $Header$
5
6 source /etc/init.d/functions.sh
7
8 mysvcdir="${svcdir}"
9 update=false
10
11 while [[ -n $1 ]] ; do
12 case "$1" in
13 --debug|-d)
14 set -x
15 ;;
16 --svcdir|-s)
17 if [[ -z $2 || $2 == -* ]] ; then
18 eerror "No svcdir specified"
19 else
20 shift
21 mysvcdir="$1"
22 fi
23 ;;
24 --update|-u)
25 update=true
26 ;;
27 esac
28 shift
29 done
30
31 if [[ ! -d ${mysvcdir} ]] ; then
32 if ! mkdir -p -m 0755 "${mysvcdir}" 2>/dev/null ; then
33 eerror "Could not create needed directory '${mysvcdir}'!"
34 fi
35 fi
36
37 for x in softscripts snapshot options started ; 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 # If its not there, we have to update, and make sure its present
48 # for next mtime testing
49 if [[ ! -e "${mysvcdir}/depcache" ]] ; then
50 update=true
51 touch "${mysvcdir}/depcache"
52 fi
53
54 for config in /etc/conf.d /etc/init.d /etc/rc.conf
55 do
56 ! ${update} \
57 && is_older_than "${mysvcdir}/depcache" "${config}" \
58 && update=true
59 done
60 fi
61
62 ! ${update} && exit 0
63
64 ebegin "Caching service dependencies"
65
66 # Clean out the non volatile directories ...
67 rm -rf "${mysvcdir}"/dep{cache,tree} "${mysvcdir}"/{broken,snapshot}/*
68
69 retval=0
70 SVCDIR="${mysvcdir}"
71 DEPTYPES="${deptypes}"
72 ORDTYPES="${ordtypes}"
73
74 export SVCDIR DEPTYPES ORDTYPES
75
76 cd /etc/init.d
77
78 /bin/gawk \
79 -f /lib/rcscripts/awk/functions.awk \
80 -f /lib/rcscripts/awk/cachedepends.awk || \
81 retval=1
82
83 bash "${mysvcdir}/depcache" | \
84 /bin/gawk \
85 -f /lib/rcscripts/awk/functions.awk \
86 -f /lib/rcscripts/awk/gendepends.awk || \
87 retval=1
88
89 touch "${mysvcdir}"/dep{cache,tree}
90 chmod 0644 "${mysvcdir}"/dep{cache,tree}
91
92 eend ${retval} "Failed to cache service dependencies"
93
94 exit ${retval}
95
96 # 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