Allow AUTOMAKE=<depth> to specify search depth

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2018-03-03 10:09:10 -08:00
parent 9e002a7689
commit 02ed6f26a9
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10
3 changed files with 27 additions and 4 deletions

View File

@ -6593,7 +6593,7 @@ sub get_configuration( $$$ ) {
default_yes_no 'MANGLE_ENABLED' , have_capability( 'MANGLE_ENABLED' ) ? 'Yes' : '';
default_yes_no 'USE_DEFAULT_RT' , '';
default_yes_no 'RESTORE_DEFAULT_ROUTE' , 'Yes';
default_yes_no 'AUTOMAKE' , '';
default_yes_no 'AUTOMAKE' , '' unless ( $val = $config{AUTOMAKE} ) && $val =~ /^\d{1,2}$/;
default_yes_no 'TRACK_PROVIDERS' , 'Yes';
default_yes_no 'BALANCE_PROVIDERS' , $config{USE_DEFAULT_RT} ? 'Yes' : '';
default_yes_no 'USE_NFLOG_SIZE' , '';

View File

@ -281,10 +281,15 @@ get_config() {
case $AUTOMAKE in
Yes|yes)
AUTOMAKE=1
;;
No|no)
AUTOMAKE=
;;
[1-9])
;;
[1-9][0-9])
;;
*)
if [ -n "$AUTOMAKE" ]; then
fatal_error "Invalid AUTOMAKE setting ($AUTOMAKE)"
@ -397,10 +402,10 @@ uptodate() {
#
# Busybox 'find' doesn't support -quit.
#
if [ -n "$(${find} ${dir} -maxdepth 1 -type f -newer $1 -print)" ]; then
if [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print)" ]; then
return 1;
fi
elif [ -n "$(${find} ${dir} -maxdepth 1 -type f -newer $1 -print -quit)" ]; then
elif [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print -quit)" ]; then
return 1;
fi
done

View File

@ -463,7 +463,8 @@
<varlistentry>
<term><emphasis role="bold">AUTOMAKE=</emphasis>[<emphasis
role="bold">Yes</emphasis>|<emphasis role="bold">No</emphasis>]</term>
role="bold">Yes</emphasis>|<emphasis
role="bold">No</emphasis>|<replaceable>depth</replaceable>]</term>
<listitem>
<para>If set, the behavior of the <command>start</command>,
@ -481,6 +482,23 @@
<command>restart</command> command includes a directory name
(e.g.,<command> shorewall restart
/etc/shorewall.new</command>).</para>
<para>When AUTOMAKE=Yes, each directory in the CONFIG_PATH was
originally searched recursively for files newer than the compiled
script. That was changed in Shorewall 5.1.10.2 such that only the
listed directories themselves were searched. That broke some
configurations that played tricks with embedded SHELL such as
"<command>SHELL cat /etc/shorewall/rules.d/loc/*.rules".</command>
Prior to 5.1.10.2, a change to a file in or adding a file to
/etc/shorewall/rules.d/loc/ would trigger recompilation. Beginning
with 5.1.10.2, such changes would not trigger recompilation.
Beginning with Shorewall 5.2.0, AUTOMAKE may be set to a numeric
<replaceable>depth</replaceable> which specifies how deeply each
listed directory is to be searched. AUTOMAKE=1 only searches each
directory itself and is equivalent to AUTOMAKE=Yes. AUTOMAKE=2 will
search each directory and its immediate sub-directories; AUTOMAKE=3
will search each diretory, each of its immediate sub-directories,
and each of their immediate sub-directories, etc.</para>
</listitem>
</varlistentry>