Support conditional compilation.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-05-07 09:36:02 -07:00
parent be7a6ec35d
commit 577db69719
3 changed files with 40 additions and 7 deletions

View File

@ -337,7 +337,7 @@ uptodate() {
ifs="$IFS"
IFS=':'
for dir in $CONFIG_PATH; do
for dir in $g_shorewalldir $CONFIG_PATH; do
if [ -n "$(find ${dir} -newer $1)" ]; then
IFS="$ifs"
return 1;
@ -599,6 +599,7 @@ start_command() {
compile_command() {
local finished
finished=0
local conditional
while [ $finished -eq 0 ]; do
[ $# -eq 0 ] && break
@ -629,6 +630,10 @@ compile_command() {
g_debug=Yes;
option=${option#d}
;;
c*)
conditional=Yes;
option=${option#c}
;;
T*)
g_confess=Yes
option=${option#T}
@ -678,9 +683,14 @@ compile_command() {
;;
esac
[ "x$file" = x- ] || progress_message3 "Compiling..."
if [ -n "$conditional" ] && uptodate $file; then
echo "$file is up to date -- no compilation required"
return 0
else
[ "x$file" = x- ] || progress_message3 "Compiling..."
compiler $g_debugging compile $file && run_postcompile $file
compiler $g_debugging compile $file && run_postcompile $file
fi
}
#
@ -1579,7 +1589,7 @@ usage() # $1 = exit status
echo " allow <address> ..."
echo " check [ -e ] [ -r ] [ -p ] [ -r ] [ -T ] [ <directory> ]"
echo " clear"
echo " compile [ -e ] [ -p ] [ -t ] [ -d ] [ -T ] [ <directory name> ] [ <path name> ]"
echo " compile [ -e ] [ -p ] [ -t ] [ -c ] [ -d ] [ -T ] [ <directory name> ] [ <path name> ]"
echo " delete <interface>[:<host-list>] ... <zone>"
echo " disable <interface>"
echo " drop <address> ..."

View File

@ -92,6 +92,8 @@
<arg><option>-e</option></arg>
<arg><option>-c</option></arg>
<arg><option>-d</option></arg>
<arg><option>-p</option></arg>
@ -832,8 +834,9 @@
<listitem>
<para>Compiles the current configuration into the executable file
<emphasis>pathname</emphasis>. If a directory is supplied, Shorewall
will look in that directory first for configuration files. If the
<emphasis>pathname</emphasis>. If a
<replaceable>directory</replaceable> is supplied, Shorewall will
look in that directory first for configuration files. If the
<emphasis>pathname</emphasis> is omitted, the file
<filename>firewall</filename> in the VARDIR (normally <filename
class="directory">/var/lib/shorewall/</filename>) is assumed. A
@ -853,6 +856,16 @@
capabilities</emphasis> on a system with Shorewall Lite
installed</para>
<para>The <emphasis role="bold">-c</emphasis> option was added in
Shorewall 4.5.17 and causes conditional compilation of a script. The
script specified by <replaceable>pathname</replaceable> (or implied
if <emphasis role="bold">pathname</emphasis> is omitted) is compiled
if it doesn't exist or if there is any file in the
<replaceable>directory</replaceable> or in a directory on the
CONFIG_PATH that has a modification time later than the file to be
compiled. When no compilation is needed, a message is issued and an
exit status of zero is returned.</para>
<para>The <option>-d</option> option causes the compiler to be run
under control of the Perl debugger.</para>

View File

@ -762,7 +762,17 @@
which may be produced using the command <emphasis
role="bold">shorewall6-lite show -f capabilities &gt;
capabilities</emphasis> on a system with Shorewall6 Lite
installed</para>
installed.</para>
<para>The <emphasis role="bold">-c</emphasis> option was added in
Shorewall 4.5.17 and causes conditional compilation of a script. The
script specified by <replaceable>pathname</replaceable> (or implied
if <emphasis role="bold">pathname</emphasis> is omitted) is compiled
if it doesn't exist or if there is any file in the
<replaceable>directory</replaceable> or in a directory on the
CONFIG_PATH that has a modification time later than the file to be
compiled. When no compilation is needed, a message is issued and an
exit status of zero is returned.</para>
<para>The <option>-d</option> option causes the compiler to be run
under control of the Perl debugger.</para>