diff --git a/Shorewall/lib.cli-std b/Shorewall/lib.cli-std index a5a497674..4dd0e8149 100644 --- a/Shorewall/lib.cli-std +++ b/Shorewall/lib.cli-std @@ -381,36 +381,33 @@ uptodate() { [ -x $1 ] || return 1 local dir - local busybox local find + local quit + local maxdepth find=$(mywhich find) [ -n "${find}" ] || return 1 - [ -h "${find}" ] && busybox=Yes - find="${find} -L" + + if [ -h "${find}" ]; then + # + # 'Find' is provided by Busybox and doesn't support -quit. + # + quit= + else + quit=-quit + fi + + if [ "$AUTOMAKE" = recursive ]; then + maxdepth= + elif [ -z "$AUTOMAKE" ]; then + maxdepth="-maxdepth 1" + else + maxdepth="-maxdepth $AUTOMAKE" + fi for dir in $g_shorewalldir $(split $CONFIG_PATH); do - if [ -n "${busybox}" ]; then - # - # Busybox 'find' doesn't support -quit. - # - if [ $AUTOMAKE = recursive ]; then - if [ -n "$(${find} ${dir} -newer $1 -print)" ]; then - return 1; - fi - elif [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print)" ]; then - return 1; - fi - elif [ "$AUTOMAKE" = recursive ]; then - if [ -n "$(${find} ${dir} -newer $1 -print -quit)" ]; then - return 1; - fi - elif [ -z "$AUTOMAKE" ]; then - if [ -n "$(${find} ${dir} -maxdepth 1 -type f -newer $1 -print -quit)" ]; then - return 1; - fi - elif [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print -quit)" ]; then + if [ -n "$(${find} -L ${dir} ${maxdepth} -newer $1 -print ${quit})" ]; then return 1; fi done