| 1 |
azarah |
161 |
#!/bin/bash
|
| 2 |
vapier |
541 |
# Copyright 1999-2004 Gentoo Foundation
|
| 3 |
azarah |
266 |
# Distributed under the terms of the GNU General Public License v2
|
| 4 |
azarah |
161 |
# $Header$
|
| 5 |
|
|
|
| 6 |
azarah |
258 |
source /etc/init.d/functions.sh
|
| 7 |
azarah |
161 |
|
| 8 |
uberlord |
1179 |
if [[ ! -d ${svcdir} ]]; then
|
| 9 |
|
|
if ! mkdir -p -m 0755 "${svcdir}" 2>/dev/null ; then
|
| 10 |
|
|
eerror "Could not create needed directory '${svcdir}'!"
|
| 11 |
azarah |
652 |
fi
|
| 12 |
|
|
fi
|
| 13 |
|
|
|
| 14 |
uberlord |
1179 |
for x in softscripts snapshot options \
|
| 15 |
uberlord |
1181 |
started starting inactive stopping failed \
|
| 16 |
uberlord |
1179 |
exclusive exitcodes ; do
|
| 17 |
azarah |
1182 |
if [[ ! -d "${svcdir}/${x}" ]] ; then
|
| 18 |
uberlord |
1179 |
if ! mkdir -p -m 0755 "${svcdir}/${x}" 2>/dev/null ; then
|
| 19 |
|
|
eerror "Could not create needed directory '${svcdir}/${x}'!"
|
| 20 |
azarah |
652 |
fi
|
| 21 |
|
|
fi
|
| 22 |
|
|
done
|
| 23 |
|
|
|
| 24 |
vapier |
624 |
# Only update if files have actually changed
|
| 25 |
|
|
update=1
|
| 26 |
uberlord |
1179 |
if [[ $1 == "-u" ]]; then
|
| 27 |
vapier |
624 |
update=0
|
| 28 |
|
|
for config in /etc/conf.d /etc/init.d /etc/rc.conf
|
| 29 |
|
|
do
|
| 30 |
azarah |
1182 |
if is_older_than "${svcdir}/depcache" ${config} ; then
|
| 31 |
vapier |
624 |
update=1
|
| 32 |
|
|
break
|
| 33 |
|
|
fi
|
| 34 |
|
|
done
|
| 35 |
|
|
shift
|
| 36 |
|
|
fi
|
| 37 |
uberlord |
1179 |
[[ ${update} == 0 ]] && exit 0
|
| 38 |
vapier |
624 |
|
| 39 |
azarah |
161 |
ebegin "Caching service dependencies"
|
| 40 |
|
|
|
| 41 |
azarah |
359 |
# Clean out the non volitile directories ...
|
| 42 |
vapier |
624 |
rm -rf "${svcdir}"/dep{cache,tree} "${svcdir}"/{broken,snapshot}/*
|
| 43 |
azarah |
359 |
|
| 44 |
azarah |
442 |
retval=0
|
| 45 |
azarah |
454 |
SVCDIR="${svcdir}"
|
| 46 |
|
|
DEPTYPES="${deptypes}"
|
| 47 |
|
|
ORDTYPES="${ordtypes}"
|
| 48 |
azarah |
442 |
|
| 49 |
azarah |
454 |
export SVCDIR DEPTYPES ORDTYPES
|
| 50 |
|
|
|
| 51 |
azarah |
258 |
cd /etc/init.d
|
| 52 |
azarah |
161 |
|
| 53 |
azarah |
454 |
/bin/gawk \
|
| 54 |
azarah |
359 |
-f /lib/rcscripts/awk/functions.awk \
|
| 55 |
azarah |
442 |
-f /lib/rcscripts/awk/cachedepends.awk || \
|
| 56 |
|
|
retval=1
|
| 57 |
|
|
|
| 58 |
|
|
bash "${svcdir}/depcache" | \
|
| 59 |
azarah |
454 |
/bin/gawk \
|
| 60 |
azarah |
359 |
-f /lib/rcscripts/awk/functions.awk \
|
| 61 |
azarah |
442 |
-f /lib/rcscripts/awk/gendepends.awk || \
|
| 62 |
|
|
retval=1
|
| 63 |
azarah |
359 |
|
| 64 |
vapier |
624 |
touch -m "${svcdir}"/dep{cache,tree}
|
| 65 |
|
|
|
| 66 |
vapier |
589 |
eend ${retval} "Failed to cache service dependencies"
|
| 67 |
azarah |
161 |
|
| 68 |
azarah |
442 |
exit ${retval}
|
| 69 |
azarah |
261 |
|
| 70 |
|
|
# vim:ts=4
|