On 05/06/2013 03:57 PM, Dash Four wrote:
>
>
> Tom Eastep wrote:
>
>>
>> What I'm suggesting is to replace all of that with:
>>
>> if [ $PRODUCT == shorewall -o $PRODUCT == shoreawll6 ]; then
>> ${SBINDIR}/$PRODUCT compile -c
>> fi
>>
>> 'compile -c' will compile ${VARDIR}/${PRODUCT}/firewall if it doesn't
>> exist or if the config has changed since it was last compiled. If it
>> exists and the config hasn't changed, the command exists with status 0.
>>
> Oh, in that case it makes perfect sense, though make sure that shorewall
> exist status is always returned so that it could be picked up by the
> initd script ;-)
> Patch attached. -Tom -- Tom Eastep \ When I die, I want to go like my Grandfather who Shoreline, \ died peacefully in his sleep. Not screaming like Washington, USA \ all of the passengers in his car http://shorewall.net \________________________________________________
diff --git a/Shorewall/lib.cli-std b/Shorewall/lib.cli-std
index 847a139..8bc68dd 100644
--- a/Shorewall/lib.cli-std
+++ b/Shorewall/lib.cli-std
@@ -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> ..."
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. This 200-page book is written by three acclaimed leaders in the field. The early access version is available now. Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________ Shorewall-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/shorewall-devel
