mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-22 06:10:42 +01:00
Take 2 on conditional compilation.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
7215b61aa4
commit
3923092468
@ -3367,6 +3367,8 @@ shorewall_cli() {
|
||||
g_timestamp=
|
||||
g_shorewalldir=
|
||||
g_haveconfig=
|
||||
g_conditional=
|
||||
g_file=
|
||||
|
||||
VERBOSE=
|
||||
VERBOSITY=1
|
||||
|
@ -399,6 +399,11 @@ compiler() {
|
||||
[ -f "$shorewallrc1" ] || fatal_error "Compiling for export requires a shorewallrc file"
|
||||
fi
|
||||
|
||||
if [ -n "$g_conditional" ] && uptodate $g_file; then
|
||||
echo "$g_file is up to date -- no compilation required"
|
||||
return 0
|
||||
fi
|
||||
|
||||
options="--verbose=$VERBOSITY --family=$g_family --config_path=$CONFIG_PATH --shorewallrc=${shorewallrc}"
|
||||
[ -n "$shorewallrc1" ] && options="$options --shorewallrc1=${shorewallrc1}"
|
||||
[ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG"
|
||||
@ -599,7 +604,6 @@ start_command() {
|
||||
compile_command() {
|
||||
local finished
|
||||
finished=0
|
||||
local conditional
|
||||
|
||||
while [ $finished -eq 0 ]; do
|
||||
[ $# -eq 0 ] && break
|
||||
@ -631,7 +635,7 @@ compile_command() {
|
||||
option=${option#d}
|
||||
;;
|
||||
c*)
|
||||
conditional=Yes;
|
||||
g_conditional=Yes;
|
||||
option=${option#c}
|
||||
;;
|
||||
T*)
|
||||
@ -654,15 +658,15 @@ compile_command() {
|
||||
esac
|
||||
done
|
||||
|
||||
file=
|
||||
g_file=
|
||||
|
||||
case $# in
|
||||
0)
|
||||
[ -n "$g_export" ] && file=firewall || file=${VARDIR}/firewall
|
||||
[ -n "$g_export" ] && g_file=firewall || g_file=${VARDIR}/firewall
|
||||
;;
|
||||
1)
|
||||
file=$1
|
||||
[ -d $file ] && fatal_error "$file is a directory"
|
||||
g_file=$1
|
||||
[ -d $g_file ] && fatal_error "$g_file is a directory"
|
||||
;;
|
||||
2)
|
||||
[ -n "$g_shorewalldir" -a -z "$g_export" ] && usage 2
|
||||
@ -676,21 +680,16 @@ compile_command() {
|
||||
fi
|
||||
|
||||
g_shorewalldir=$(resolve_file $1)
|
||||
file=$2
|
||||
g_file=$2
|
||||
;;
|
||||
*)
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$conditional" ] && uptodate $file; then
|
||||
echo "$file is up to date -- no compilation required"
|
||||
return 0
|
||||
else
|
||||
[ "x$file" = x- ] || progress_message3 "Compiling..."
|
||||
[ "x$g_file" = x- ] || progress_message3 "Compiling..."
|
||||
|
||||
compiler $g_debugging compile $file && run_postcompile $file
|
||||
fi
|
||||
compiler $g_debugging compile $g_file && run_postcompile $g_file
|
||||
}
|
||||
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user