--- trunk/magellan-initscripts/etc/rc.d/init.d/functions 2005/10/21 14:50:13 273 +++ trunk/magellan-initscripts/etc/rc.d/init.d/functions 2005/10/21 15:21:41 274 @@ -1,5 +1,5 @@ #!/bin/bash -# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/functions,v 1.4 2005-07-03 21:30:58 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/functions,v 1.5 2005-10-21 15:21:41 niro Exp $ # Begin $rc_base/init.d/functions - Run Level Control Functions @@ -425,3 +425,27 @@ return 0 } + +# bool is_older_than(reference, files/dirs to check) +# +# return 0 if any of the files/dirs are newer than +# the reference file +# +# EXAMPLE: if is_older_than a.out *.o ; then ... +is_older_than() { + local x= + local ref="$1" + shift + + for x in "$@" + do + [[ ${x} -nt ${ref} ]] && return 0 + + if [[ -d ${x} ]] + then + is_older_than "${ref}" "${x}"/* && return 0 + fi + done + + return 1 +}