diff options
Diffstat (limited to 'sbin/depscan.sh')
-rwxr-xr-x | sbin/depscan.sh | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/sbin/depscan.sh b/sbin/depscan.sh index ed16100..e9454a1 100755 --- a/sbin/depscan.sh +++ b/sbin/depscan.sh @@ -1,9 +1,37 @@ #!/bin/bash -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source /sbin/functions.sh -mysvcdir="${svcdir}" +if [[ ${BOOT} == "yes" ]] ; then + trap ":" INT QUIT TSTP +fi + +argv0=${0##*/} +source /etc/init.d/functions.sh || { + echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2 + exit 1 +} +esyslog() { :; } + +usage() { + cat <<-EOF + Usage: ${argv0} [options] + + Rebuild Gentoo init.d service dependency tree. + + Options: + -d, --debug Turn on debug output + -s, --svcdir Specify svcdir (default: ${svcdir}) + -u, --update Force update even if mtimes are OK + -h, --help Show this help cruft + EOF + [[ -z $@ ]] && exit 0 + echo + eerror "$*" + exit 1 +} + +mysvcdir=${svcdir} update=false while [[ -n $1 ]] ; do @@ -22,6 +50,12 @@ while [[ -n $1 ]] ; do --update|-u) update=true ;; + --help|-h) + usage + ;; + *) + usage "Invalid option '$1'" + ;; esac shift done @@ -44,14 +78,14 @@ done # Only update if files have actually changed if ! ${update} ; then - clock_screw=false + clock_screw=0 mtime_test="${mysvcdir}/mtime-test.$$" # If its not there, we have to update, and make sure its present # for next mtime testing if [[ ! -e "${mysvcdir}/depcache" ]] ; then - update=true - touch "${mysvcdir}/depcache" + update=true + touch "${mysvcdir}/depcache" fi touch "${mtime_test}" @@ -61,12 +95,14 @@ if ! ${update} ; then && is_older_than "${mysvcdir}/depcache" "${config}" \ && update=true - is_older_than "${mtime_test}" "${config}" && clock_screw=true + is_older_than "${mtime_test}" "${config}" && clock_screw=1 done rm -f "${mtime_test}" - ${clock_screw} && \ - ewarn "Some file in '/etc/{conf.d,init.d}' have Modification time in the future!" + if [[ ${clock_screw} == 1 ]] ; then + ewarn "One of the files in /etc/{conf.d,init.d} or /etc/rc.conf" + ewarn "has a modification time in the future!" + fi shift fi @@ -75,7 +111,7 @@ fi ebegin "Caching service dependencies" -# Clean out the non volitile directories ... +# Clean out the non volatile directories ... rm -rf "${mysvcdir}"/dep{cache,tree} "${mysvcdir}"/{broken,snapshot}/* retval=0 |