Index: sbin/rc =================================================================== --- sbin/rc (revision 1934) +++ sbin/rc (working copy) @@ -407,7 +407,7 @@ grep -ve '\(depcache\|deptree\|envcache\)') # Update the dependency cache - /sbin/depscan.sh -u + /sbin/depscan.sh # Now that the dependency cache are up to date, make sure these # are marked as started ... Index: sbin/depscan.sh =================================================================== --- sbin/depscan.sh (revision 1934) +++ sbin/depscan.sh (working copy) @@ -1,58 +1,64 @@ #!/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/files/baselayout-1.11.14-depscan.patch,v 1.1 2006/03/02 17:37:20 uberlord Exp $ -source /etc/init.d/functions.sh +. /sbin/functions.sh +mysvcdir="${svcdir}" +update=false -if [[ $1 == "--debug" ]] ; then +while [[ -n $1 ]] ; do + case "$1" in + --debug|-d) + set -x + ;; + --svcdir|-s) + if [[ -z $2 || $2 == -* ]] ; then + eerror "No svcdir specified" + else + shift + mysvcdir="$1" + fi + ;; + --update|-u) + update=true + ;; + esac shift - set -x -fi +done -if [ ! -d "${svcdir}" ] -then - if ! mkdir -p -m 0755 "${svcdir}" 2>/dev/null - then - eerror " Could not create needed directory '${svcdir}'!" +if [[ ! -d ${mysvcdir} ]] ; then + if ! mkdir -p -m 0755 "${mysvcdir}" 2>/dev/null ; then + eerror "Could not create needed directory '${mysvcdir}'!" fi fi -for x in softscripts snapshot options started -do - if [ ! -d "${svcdir}/${x}" ] - then - if ! mkdir -p -m 0755 "${svcdir}/${x}" 2>/dev/null - then - eerror " Could not create needed directory '${svcdir}/${x}'!" +for x in softscripts snapshot options started ; do + if [[ ! -d "${mysvcdir}/${x}" ]] ; then + if ! mkdir -p -m 0755 "${mysvcdir}/${x}" 2>/dev/null ; then + eerror "Could not create needed directory '${mysvcdir}/${x}'!" fi fi done # Only update if files have actually changed -update=1 -if [ "$1" == "-u" ] -then - update=0 - for config in /etc/conf.d /etc/init.d /etc/rc.conf - do - if [ "${config}" -nt "${svcdir}/depcache" ] - then - update=1 +if ! ${update} ; then + for config in /etc/conf.d /etc/init.d /etc/rc.conf ; do + if [[ ${config} -nt "${mysvcdir}/depcache" ]] ; then + update=true break fi done - shift fi -[ ${update} -eq 0 ] && exit 0 +! ${update} && exit 0 + ebegin "Caching service dependencies" # Clean out the non volitile directories ... -rm -rf "${svcdir}"/dep{cache,tree} "${svcdir}"/{broken,snapshot}/* +rm -rf "${mysvcdir}"/dep{cache,tree} "${mysvcdir}"/{broken,snapshot}/* retval=0 -SVCDIR="${svcdir}" +SVCDIR="${mysvcdir}" DEPTYPES="${deptypes}" ORDTYPES="${ordtypes}" @@ -65,17 +71,17 @@ -f /lib/rcscripts/awk/cachedepends.awk || \ retval=1 -bash "${svcdir}/depcache" | \ +bash "${mysvcdir}/depcache" | \ /bin/gawk \ -f /lib/rcscripts/awk/functions.awk \ -f /lib/rcscripts/awk/gendepends.awk || \ retval=1 -touch -m "${svcdir}"/dep{cache,tree} +touch "${mysvcdir}"/dep{cache,tree} +chmod 0644 "${mysvcdir}"/dep{cache,tree} eend ${retval} "Failed to cache service dependencies" exit ${retval} - # vim:ts=4 Index: sbin/rc-services.sh =================================================================== --- sbin/rc-services.sh (revision 1934) +++ sbin/rc-services.sh (working copy) @@ -10,7 +10,7 @@ if [ "${RC_GOT_DEPTREE_INFO}" != "yes" ] then - if ! /sbin/depscan.sh -u + if ! /sbin/depscan.sh then echo eerror "Error running '/sbin/depscan.sh'!"