Implement AUTOMAKE=recursive

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

View File

@ -6593,11 +6593,14 @@ 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' , '' 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' , '';
if ( ( $val = $config{AUTOMAKE} ) !~ /^[Rr]ecursive$/ ) {
default_yes_no( 'AUTOMAKE' , '' ) unless $val && $val =~ /^\d{1,2}$/;
}
if ( $config{USE_NFLOG_SIZE} ) {
if ( have_capability( 'NFLOG_SIZE' ) ) {
@suffixes = qw(group size threshold nlgroup cprange qthreshold);

View File

@ -290,6 +290,9 @@ get_config() {
;;
[1-9][0-9])
;;
[Rr]ecursive)
AUTOMAKE=recursive
;;
*)
if [ -n "$AUTOMAKE" ]; then
fatal_error "Invalid AUTOMAKE setting ($AUTOMAKE)"
@ -402,7 +405,15 @@ uptodate() {
#
# Busybox 'find' doesn't support -quit.
#
if [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print)" ]; then
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 [ -n "$(${find} ${dir} -maxdepth $AUTOMAKE -type f -newer $1 -print -quit)" ]; then

View File

@ -464,7 +464,7 @@
<varlistentry>
<term><emphasis role="bold">AUTOMAKE=</emphasis>[<emphasis
role="bold">Yes</emphasis>|<emphasis
role="bold">No</emphasis>|<replaceable>depth</replaceable>]</term>
role="bold">No</emphasis>|<option>recursive</option>|<replaceable>depth</replaceable>]</term>
<listitem>
<para>If set, the behavior of the <command>start</command>,
@ -492,13 +492,17 @@
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>
Beginning with Shorewall 5.2.0, the pre-5.1.10.2 behavior can be
obtained by setting AUTOMAKE=recursive.</para>
<para>Also 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>