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

Contents of /baselayout-vserver/branches/rc-scripts-1_6/sbin/depscan.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 276 - (show annotations) (download) (as text)
Thu Mar 9 10:07:19 2006 UTC (12 years, 7 months ago) by phreak
File MIME type: text/x-sh
File size: 1751 byte(s)
Merging r1939
1 #!/bin/bash
2 # Copyright 1999-2004 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 . /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 started ; do
36 if [[ ! -d "${mysvcdir}/${x}" ]] ; then
37 if ! mkdir -p -m 0755 "${mysvcdir}/${x}" 2>/dev/null ; then
38 eerror "Could not create needed directory '${mysvcdir}/${x}'!"
39 fi
40 fi
41 done
42
43 # Only update if files have actually changed
44 if ! ${update} ; then
45 for config in /etc/conf.d /etc/init.d /etc/rc.conf ; do
46 if [[ ${config} -nt "${mysvcdir}/depcache" ]] ; then
47 update=true
48 break
49 fi
50 done
51 fi
52
53 ! ${update} && exit 0
54
55 ebegin "Caching service dependencies"
56
57 # Clean out the non volitile directories ...
58 rm -rf "${mysvcdir}"/dep{cache,tree} "${mysvcdir}"/{broken,snapshot}/*
59
60 retval=0
61 SVCDIR="${mysvcdir}"
62 DEPTYPES="${deptypes}"
63 ORDTYPES="${ordtypes}"
64
65 export SVCDIR DEPTYPES ORDTYPES
66
67 cd /etc/init.d
68
69 /bin/gawk \
70 -f /lib/rcscripts/awk/functions.awk \
71 -f /lib/rcscripts/awk/cachedepends.awk || \
72 retval=1
73
74 bash "${mysvcdir}/depcache" | \
75 /bin/gawk \
76 -f /lib/rcscripts/awk/functions.awk \
77 -f /lib/rcscripts/awk/gendepends.awk || \
78 retval=1
79
80 touch "${mysvcdir}"/dep{cache,tree}
81 chmod 0644 "${mysvcdir}"/dep{cache,tree}
82
83 eend ${retval} "Failed to cache service dependencies"
84
85 exit ${retval}
86
87 # vim:ts=4

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20