Record the config directory in the state file

This commit is contained in:
Tom Eastep 2010-08-12 17:54:07 -07:00
parent 36054b7784
commit 7281c9166e
4 changed files with 27 additions and 10 deletions

View File

@ -442,32 +442,37 @@ EOF
setup_forwarding( $family , 1 );
push_indent;
emit<<'EOF';
set_state "Started"
my $config_dir = $globals{CONFIGDIR};
emit<<"EOF";
set_state Started $config_dir
run_restored_exit
else
if [ $COMMAND = refresh ]; then
if [ \$COMMAND = refresh ]; then
chainlist_reload
EOF
setup_forwarding( $family , 0 );
emit<<'EOF';
emit<<"EOF";
run_refreshed_exit
do_iptables -N shorewall
set_state "Started"
set_state Started $config_dir
else
setup_netfilter
conditionally_flush_conntrack
EOF
setup_forwarding( $family , 0 );
emit<<'EOF';
emit<<"EOF";
run_start_exit
do_iptables -N shorewall
set_state "Started"
set_state Started $config_dir
run_started_exit
fi
EOF
emit<<'EOF';
[ $0 = ${VARDIR}/firewall ] || cp -f $(my_pathname) ${VARDIR}/firewall
fi

View File

@ -339,6 +339,7 @@ sub initialize( $ ) {
%globals = ( SHAREDIR => '/usr/share/shorewall' ,
SHAREDIRPL => '/usr/share/shorewall/' ,
CONFDIR => '/etc/shorewall',
CONFIGDIR => '',
LOGPARMS => '',
TC_SCRIPT => '',
EXPORT => 0,
@ -2719,6 +2720,9 @@ sub process_shorewall_conf() {
my $file = find_file "$product.conf";
if ( -f $file ) {
$globals{CONFIGDIR} = $file;
$globals{CONFIGDIR} =~ s/$product.conf//;
if ( -r _ ) {
open_file $file;

View File

@ -514,9 +514,13 @@ find_file()
#
# Set the Shorewall state
#
set_state () # $1 = state
set_state () # $1 = state $2
{
echo "$1 ($(date))" > ${VARDIR}/state
if [ $# -gt 1 ]; then
echo "$1 ($(date)) from $2" > ${VARDIR}/state
else
echo "$1 ($(date))" > ${VARDIR}/state
fi
}
#

View File

@ -452,7 +452,11 @@ find_file()
#
set_state () # $1 = state
{
echo "$1 ($(date))" > ${VARDIR}/state
if [ $# -gt 1 ]; then
echo "$1 ($(date)) from $2" > ${VARDIR}/state
else
echo "$1 ($(date))" > ${VARDIR}/state
fi
}
#