| 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 |
if [ ! -d "${svcdir}" ]
|
| 9 |
then
|
| 10 |
if ! mkdir -p -m 0755 "${svcdir}" 2>/dev/null
|
| 11 |
then
|
| 12 |
eerror " Could not create needed directory '${svcdir}'!"
|
| 13 |
fi
|
| 14 |
fi
|
| 15 |
|
| 16 |
for x in softscripts snapshot options started starting inactive stopping
|
| 17 |
do
|
| 18 |
if [ ! -d "${svcdir}/${x}" ]
|
| 19 |
then
|
| 20 |
if ! mkdir -p -m 0755 "${svcdir}/${x}" 2>/dev/null
|
| 21 |
then
|
| 22 |
eerror " Could not create needed directory '${svcdir}/${x}'!"
|
| 23 |
fi
|
| 24 |
fi
|
| 25 |
done
|
| 26 |
|
| 27 |
# Only update if files have actually changed
|
| 28 |
update=1
|
| 29 |
if [ "$1" == "-u" ]
|
| 30 |
then
|
| 31 |
update=0
|
| 32 |
for config in /etc/conf.d /etc/init.d /etc/rc.conf
|
| 33 |
do
|
| 34 |
if [ "${config}" -nt "${svcdir}/depcache" ]
|
| 35 |
then
|
| 36 |
update=1
|
| 37 |
break
|
| 38 |
fi
|
| 39 |
done
|
| 40 |
shift
|
| 41 |
fi
|
| 42 |
[ ${update} -eq 0 ] && exit 0
|
| 43 |
|
| 44 |
ebegin "Caching service dependencies"
|
| 45 |
|
| 46 |
# Clean out the non volitile directories ...
|
| 47 |
rm -rf "${svcdir}"/dep{cache,tree} "${svcdir}"/{broken,snapshot}/*
|
| 48 |
|
| 49 |
retval=0
|
| 50 |
SVCDIR="${svcdir}"
|
| 51 |
DEPTYPES="${deptypes}"
|
| 52 |
ORDTYPES="${ordtypes}"
|
| 53 |
|
| 54 |
export SVCDIR DEPTYPES ORDTYPES
|
| 55 |
|
| 56 |
cd /etc/init.d
|
| 57 |
|
| 58 |
/bin/gawk \
|
| 59 |
-f /lib/rcscripts/awk/functions.awk \
|
| 60 |
-f /lib/rcscripts/awk/cachedepends.awk || \
|
| 61 |
retval=1
|
| 62 |
|
| 63 |
bash "${svcdir}/depcache" | \
|
| 64 |
/bin/gawk \
|
| 65 |
-f /lib/rcscripts/awk/functions.awk \
|
| 66 |
-f /lib/rcscripts/awk/gendepends.awk || \
|
| 67 |
retval=1
|
| 68 |
|
| 69 |
touch -m "${svcdir}"/dep{cache,tree}
|
| 70 |
|
| 71 |
eend ${retval} "Failed to cache service dependencies"
|
| 72 |
|
| 73 |
exit ${retval}
|
| 74 |
|
| 75 |
|
| 76 |
# vim:ts=4
|