Merge branch 'busybox-shell-fixes/v1' into 'master'

lib.cli-std: fix two shell errors when AUTOMAKE is false

See merge request shorewall/code!14
This commit is contained in:
Tom Eastep 2024-04-16 03:05:57 +00:00
commit 2673e6e60c

View File

@ -381,36 +381,33 @@ uptodate() {
[ -x $1 ] || return 1 [ -x $1 ] || return 1
local dir local dir
local busybox
local find local find
local quit
local maxdepth
find=$(mywhich find) find=$(mywhich find)
[ -n "${find}" ] || return 1 [ -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 for dir in $g_shorewalldir $(split $CONFIG_PATH); do
if [ -n "${busybox}" ]; then if [ -n "$(${find} -L ${dir} ${maxdepth} -newer $1 -print ${quit})" ]; 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
return 1; return 1;
fi fi
done done