forked from extern/shorewall_code
Rename upgrade => update
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
6f3497e353
commit
4916610033
@ -523,7 +523,7 @@ EOF
|
|||||||
#
|
#
|
||||||
sub compiler {
|
sub compiler {
|
||||||
|
|
||||||
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $upgrade , $annotate ) =
|
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate ) =
|
||||||
( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, );
|
( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, );
|
||||||
|
|
||||||
$export = 0;
|
$export = 0;
|
||||||
@ -558,7 +558,7 @@ sub compiler {
|
|||||||
test => { store => \$test },
|
test => { store => \$test },
|
||||||
preview => { store => \$preview, validate=> \&validate_boolean } ,
|
preview => { store => \$preview, validate=> \&validate_boolean } ,
|
||||||
confess => { store => \$confess, validate=> \&validate_boolean } ,
|
confess => { store => \$confess, validate=> \&validate_boolean } ,
|
||||||
upgrade => { store => \$upgrade, validate=> \&validate_boolean } ,
|
update => { store => \$update, validate=> \&validate_boolean } ,
|
||||||
annotate => { store => \$annotate, validate=> \&validate_boolean } ,
|
annotate => { store => \$annotate, validate=> \&validate_boolean } ,
|
||||||
);
|
);
|
||||||
#
|
#
|
||||||
@ -891,9 +891,9 @@ sub compiler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Upgrade the configuration file if requested
|
# Update the configuration file if requested
|
||||||
#
|
#
|
||||||
upgrade_config_file( $annotate ) if $upgrade;
|
update_config_file( $annotate ) if $update;
|
||||||
|
|
||||||
if ( $family == F_IPV4 ) {
|
if ( $family == F_IPV4 ) {
|
||||||
progress_message3 "Shorewall configuration verified";
|
progress_message3 "Shorewall configuration verified";
|
||||||
|
@ -121,7 +121,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
|
|||||||
run_user_exit1
|
run_user_exit1
|
||||||
run_user_exit2
|
run_user_exit2
|
||||||
generate_aux_config
|
generate_aux_config
|
||||||
upgrade_config_file
|
update_config_file
|
||||||
|
|
||||||
$product
|
$product
|
||||||
$Product
|
$Product
|
||||||
@ -209,7 +209,7 @@ our %globals;
|
|||||||
#
|
#
|
||||||
our %config;
|
our %config;
|
||||||
#
|
#
|
||||||
# Raw values from shorewall.conf - used to upgrade the config file
|
# Raw values from shorewall.conf - used to update the config file
|
||||||
#
|
#
|
||||||
my %rawconfig;
|
my %rawconfig;
|
||||||
#
|
#
|
||||||
@ -3792,9 +3792,9 @@ sub generate_aux_config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Upgrade the configuration file
|
# Update the configuration file
|
||||||
#
|
#
|
||||||
sub upgrade_config_file( $ ) {
|
sub update_config_file( $ ) {
|
||||||
my $annotate = shift;
|
my $annotate = shift;
|
||||||
|
|
||||||
my $fn = $annotate ? "$globals{SHAREDIR}/configfiles/${product}.conf.annotated" : "$globals{SHAREDIR}/configfiles/${product}.conf";
|
my $fn = $annotate ? "$globals{SHAREDIR}/configfiles/${product}.conf.annotated" : "$globals{SHAREDIR}/configfiles/${product}.conf";
|
||||||
@ -3813,9 +3813,9 @@ sub upgrade_config_file( $ ) {
|
|||||||
my ( $template, $output );
|
my ( $template, $output );
|
||||||
open $template, '<' , $fn or fatal_error "Unable to open $fn: $!";
|
open $template, '<' , $fn or fatal_error "Unable to open $fn: $!";
|
||||||
|
|
||||||
unless ( open $output, '>', "$configfile.upgraded" ) {
|
unless ( open $output, '>', "$configfile.updated" ) {
|
||||||
close $template;
|
close $template;
|
||||||
fatal_error "Unable to open $configfile.upgraded for output: $!";
|
fatal_error "Unable to open $configfile.updated for output: $!";
|
||||||
}
|
}
|
||||||
|
|
||||||
while ( <$template> ) {
|
while ( <$template> ) {
|
||||||
@ -3905,10 +3905,10 @@ sub upgrade_config_file( $ ) {
|
|||||||
close $output;
|
close $output;
|
||||||
|
|
||||||
fatal_error "Can't rename $configfile to $configfile.bak: $!" unless rename $configfile, "$configfile.bak";
|
fatal_error "Can't rename $configfile to $configfile.bak: $!" unless rename $configfile, "$configfile.bak";
|
||||||
fatal_error "Can't rename $configfile.upgraded to $configfile: $!" unless rename "$configfile.upgraded", $configfile;
|
fatal_error "Can't rename $configfile.updated to $configfile: $!" unless rename "$configfile.updated", $configfile;
|
||||||
|
|
||||||
|
|
||||||
progress_message3 "Configuration file $configfile upgraded - old file renamed $configfile.bak";
|
progress_message3 "Configuration file $configfile updated - old file renamed $configfile.bak";
|
||||||
} else {
|
} else {
|
||||||
fatal_error "$fn does not exist";
|
fatal_error "$fn does not exist";
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ sub usage( $ ) {
|
|||||||
[ --preview ]
|
[ --preview ]
|
||||||
[ --family={4|6} ]
|
[ --family={4|6} ]
|
||||||
[ --annotate ]
|
[ --annotate ]
|
||||||
[ --upgrade ]
|
[ --updatee ]
|
||||||
';
|
';
|
||||||
|
|
||||||
exit shift @_;
|
exit shift @_;
|
||||||
@ -85,7 +85,7 @@ my $test = 0;
|
|||||||
my $family = 4; # F_IPV4
|
my $family = 4; # F_IPV4
|
||||||
my $preview = 0;
|
my $preview = 0;
|
||||||
my $annotate = 0;
|
my $annotate = 0;
|
||||||
my $upgrade = 0;
|
my $update = 0;
|
||||||
|
|
||||||
Getopt::Long::Configure ('bundling');
|
Getopt::Long::Configure ('bundling');
|
||||||
|
|
||||||
@ -113,8 +113,8 @@ my $result = GetOptions('h' => \$help,
|
|||||||
'confess' => \$confess,
|
'confess' => \$confess,
|
||||||
'a' => \$annotate,
|
'a' => \$annotate,
|
||||||
'annotate' => \$annotate,
|
'annotate' => \$annotate,
|
||||||
'u' => \$upgrade,
|
'u' => \$update,
|
||||||
'upgrade' => \$upgrade,
|
'update' => \$update,
|
||||||
);
|
);
|
||||||
|
|
||||||
usage(1) unless $result && @ARGV < 2;
|
usage(1) unless $result && @ARGV < 2;
|
||||||
@ -133,6 +133,6 @@ compiler( script => $ARGV[0] || '',
|
|||||||
preview => $preview,
|
preview => $preview,
|
||||||
family => $family,
|
family => $family,
|
||||||
confess => $confess,
|
confess => $confess,
|
||||||
upgrade => $upgrade,
|
update => $update,
|
||||||
annotate => $annotate,
|
annotate => $annotate,
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Changes in Shorewall 4.4.21 Beta 2
|
Changes in Shorewall 4.4.21 Beta 2
|
||||||
|
|
||||||
1) Implement the 'upgrade' command.
|
1) Implement the 'update' command.
|
||||||
|
|
||||||
Changes in Shorewall 4.4.21 Beta 1
|
Changes in Shorewall 4.4.21 Beta 1
|
||||||
|
|
||||||
|
@ -80,9 +80,9 @@ None.
|
|||||||
|
|
||||||
DROP_DEFAULT=Drop(-,DROP)
|
DROP_DEFAULT=Drop(-,DROP)
|
||||||
|
|
||||||
4) An 'upgrade' command has been added that validates the
|
4) An 'update' command has been added that validates the
|
||||||
configuration and then upgrades the shorewall.conf
|
configuration and then updates the shorewall.conf
|
||||||
(shorewall6.conf) file. The upgraded file will set any new options
|
(shorewall6.conf) file. The updated file will set any new options
|
||||||
with their default values and will move any deprecated options with
|
with their default values and will move any deprecated options with
|
||||||
non-default values to a 'deprecated options' section at the end of
|
non-default values to a 'deprecated options' section at the end of
|
||||||
the file. Each such deprecated option will generate a warning
|
the file. Each such deprecated option will generate a warning
|
||||||
@ -91,8 +91,8 @@ None.
|
|||||||
Your original shorewall.conf (shorewall6.conf) file will be saved as
|
Your original shorewall.conf (shorewall6.conf) file will be saved as
|
||||||
shorewall.conf.bak (shorewall6.conf.bak).
|
shorewall.conf.bak (shorewall6.conf.bak).
|
||||||
|
|
||||||
The 'upgrade' command accepts the same options as 'check' plus an
|
The 'update' command accepts the same options as 'check' plus an
|
||||||
'-a' option that causes the upgraded file to be annotated with
|
'-a' option that causes the updated file to be annotated with
|
||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
|
@ -397,7 +397,7 @@ compiler() {
|
|||||||
[ "$g_debugging" = trace ] && options="$options --debug"
|
[ "$g_debugging" = trace ] && options="$options --debug"
|
||||||
[ -n "$g_refreshchains" ] && options="$options --refresh=$g_refreshchains"
|
[ -n "$g_refreshchains" ] && options="$options --refresh=$g_refreshchains"
|
||||||
[ -n "$g_confess" ] && options="$options --confess"
|
[ -n "$g_confess" ] && options="$options --confess"
|
||||||
[ -n "$g_upgrade" ] && options="$options --upgrade"
|
[ -n "$g_updatee" ] && options="$options --update"
|
||||||
[ -n "$g_annotate" ] && options="$options --annotate"
|
[ -n "$g_annotate" ] && options="$options --annotate"
|
||||||
|
|
||||||
if [ -n "$PERL" ]; then
|
if [ -n "$PERL" ]; then
|
||||||
@ -1455,7 +1455,7 @@ usage() # $1 = exit status
|
|||||||
echo " version [ -a ]"
|
echo " version [ -a ]"
|
||||||
echo " safe-start [ <directory> ]"
|
echo " safe-start [ <directory> ]"
|
||||||
echo " safe-restart [ <directory> ]"
|
echo " safe-restart [ <directory> ]"
|
||||||
echo " upgrade [ -e ] [ -d ] [ -p ] [ -r ] [ -T ] [ -a ] [ <directory> ]"
|
echo " update [ -e ] [ -d ] [ -p ] [ -r ] [ -T ] [ -a ] [ <directory> ]"
|
||||||
echo
|
echo
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
@ -1538,7 +1538,7 @@ g_debug=
|
|||||||
g_export=
|
g_export=
|
||||||
g_refreshchains=:none:
|
g_refreshchains=:none:
|
||||||
g_confess=
|
g_confess=
|
||||||
g_upgrade=
|
g_update=
|
||||||
g_annotate=
|
g_annotate=
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1746,10 +1746,10 @@ case "$COMMAND" in
|
|||||||
shift
|
shift
|
||||||
check_command $@
|
check_command $@
|
||||||
;;
|
;;
|
||||||
upgrade)
|
update)
|
||||||
get_config Yes
|
get_config Yes
|
||||||
shift
|
shift
|
||||||
g_upgrade=Yes
|
g_update=Yes
|
||||||
check_command $@
|
check_command $@
|
||||||
;;
|
;;
|
||||||
show|list)
|
show|list)
|
||||||
|
@ -397,7 +397,7 @@ compiler() {
|
|||||||
[ "$g_debugging" = trace ] && options="$options --debug"
|
[ "$g_debugging" = trace ] && options="$options --debug"
|
||||||
[ -n "$g_refreshchains" ] && options="$options --refresh=$g_refreshchains"
|
[ -n "$g_refreshchains" ] && options="$options --refresh=$g_refreshchains"
|
||||||
[ -n "$g_confess" ] && options="$options --confess"
|
[ -n "$g_confess" ] && options="$options --confess"
|
||||||
[ -n "$g_upgrade" ] && options="$options --upgrade"
|
[ -n "$g_update" ] && options="$options --update"
|
||||||
[ -n "$g_annotate" ] && options="$options --annotate"
|
[ -n "$g_annotate" ] && options="$options --annotate"
|
||||||
[ -x $pc ] || startup_error "Shorewall6 requires the shorewall package which is not installed"
|
[ -x $pc ] || startup_error "Shorewall6 requires the shorewall package which is not installed"
|
||||||
|
|
||||||
@ -1451,7 +1451,7 @@ usage() # $1 = exit status
|
|||||||
echo " version [ -a ]"
|
echo " version [ -a ]"
|
||||||
echo " safe-start [ <directory> ]"
|
echo " safe-start [ <directory> ]"
|
||||||
echo " safe-restart [ <directory> ]"
|
echo " safe-restart [ <directory> ]"
|
||||||
echo " upgrade [ -e ] [ -d ] [ -p ] [ -r ] [ -T ] [ -a ] [ <directory> ]"
|
echo " update [ -e ] [ -d ] [ -p ] [ -r ] [ -T ] [ -a ] [ <directory> ]"
|
||||||
echo
|
echo
|
||||||
exit $1
|
exit $1
|
||||||
}
|
}
|
||||||
@ -1534,7 +1534,7 @@ g_debug=
|
|||||||
g_export=
|
g_export=
|
||||||
g_refreshchains=:none:
|
g_refreshchains=:none:
|
||||||
g_confess=
|
g_confess=
|
||||||
g_upgrade=
|
g_update=
|
||||||
g_annotate=
|
g_annotate=
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1742,10 +1742,10 @@ case "$COMMAND" in
|
|||||||
shift
|
shift
|
||||||
check_command $@
|
check_command $@
|
||||||
;;
|
;;
|
||||||
upgrade)
|
update)
|
||||||
get_config Yes
|
get_config Yes
|
||||||
shift
|
shift
|
||||||
g_upgrade=Yes
|
g_updatee=Yes
|
||||||
check_command $@
|
check_command $@
|
||||||
;;
|
;;
|
||||||
show|list)
|
show|list)
|
||||||
|
@ -626,7 +626,7 @@
|
|||||||
|
|
||||||
<arg>-<replaceable>options</replaceable></arg>
|
<arg>-<replaceable>options</replaceable></arg>
|
||||||
|
|
||||||
<arg choice="plain"><option>upgrade</option></arg>
|
<arg choice="plain"><option>update</option></arg>
|
||||||
|
|
||||||
<arg><option>-e</option></arg>
|
<arg><option>-e</option></arg>
|
||||||
|
|
||||||
@ -762,19 +762,6 @@
|
|||||||
<para>The <option>-T</option> option was added in Shorewall 4.4.20
|
<para>The <option>-T</option> option was added in Shorewall 4.4.20
|
||||||
and causes a Perl stack trace to be included with each
|
and causes a Perl stack trace to be included with each
|
||||||
compiler-generated error and warning message.</para>
|
compiler-generated error and warning message.</para>
|
||||||
|
|
||||||
<para>The <option>-u</option> option was added in Shorewall 4.4.21
|
|
||||||
and causes the compiler to upgrade
|
|
||||||
<filename>/etc/shorewall/shorewall.conf</filename>. The upgrade will
|
|
||||||
add new options with their default values and will move deprecated
|
|
||||||
options with non-defaults to a deprecated options section at the
|
|
||||||
bottom of the file.Your existing <filename>shorewall.conf</filename>
|
|
||||||
file is renamed <filename>shorewall.conf.bak.</filename></para>
|
|
||||||
|
|
||||||
<para>The <option>-a</option> option was added in Shorewall 4.4.21
|
|
||||||
and is only meaningful when used with <option>-u</option>. It causes
|
|
||||||
the upgraded <filename>shorewall.conf</filename> file to be
|
|
||||||
annotated with documentation.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
@ -1561,19 +1548,19 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">upgrade</emphasis></term>
|
<term><emphasis role="bold">update</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.4.21 and causes the compiler to validate
|
<para>Added in Shorewall 4.4.21 and causes the compiler to validate
|
||||||
the configuration and then upgrade
|
the configuration and then update
|
||||||
<filename>/etc/shorewall/shorewall.conf</filename>. The upgrade will
|
<filename>/etc/shorewall/shorewall.conf</filename>. The update will
|
||||||
add new options with their default values and will move deprecated
|
add new options with their default values and will move deprecated
|
||||||
options with non-defaults to a deprecated options section at the
|
options with non-defaults to a deprecated options section at the
|
||||||
bottom of the file. Your existing
|
bottom of the file. Your existing
|
||||||
<filename>shorewall.conf</filename> file is renamed
|
<filename>shorewall.conf</filename> file is renamed
|
||||||
<filename>shorewall.conf.bak.</filename></para>
|
<filename>shorewall.conf.bak.</filename></para>
|
||||||
|
|
||||||
<para>The <option>-a</option> option causes the upgraded
|
<para>The <option>-a</option> option causes the updated
|
||||||
<filename>shorewall.conf</filename> file to be annotated with
|
<filename>shorewall.conf</filename> file to be annotated with
|
||||||
documentation.</para>
|
documentation.</para>
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@
|
|||||||
|
|
||||||
<arg>-<replaceable>options</replaceable></arg>
|
<arg>-<replaceable>options</replaceable></arg>
|
||||||
|
|
||||||
<arg choice="plain"><option>upgrade</option></arg>
|
<arg choice="plain"><option>update</option></arg>
|
||||||
|
|
||||||
<arg><option>-e</option></arg>
|
<arg><option>-e</option></arg>
|
||||||
|
|
||||||
@ -1302,19 +1302,19 @@
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><emphasis role="bold">upgrade</emphasis></term>
|
<term><emphasis role="bold">update</emphasis></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Added in Shorewall 4.4.21 and causes the compiler to validate
|
<para>Added in Shorewall 4.4.21 and causes the compiler to validate
|
||||||
the configuration and then upgrade
|
the configuration and then update
|
||||||
<filename>/etc/shorewall6/shorewall6.conf</filename>. The upgrade
|
<filename>/etc/shorewall6/shorewall6.conf</filename>. The update
|
||||||
will add new options with their default values and will move
|
will add new options with their default values and will move
|
||||||
deprecated options with non-defaults to a deprecated options section
|
deprecated options with non-defaults to a deprecated options section
|
||||||
at the bottom of the file. Your existing
|
at the bottom of the file. Your existing
|
||||||
<filename>shorewall6.conf</filename> file is renamed
|
<filename>shorewall6.conf</filename> file is renamed
|
||||||
<filename>shorewall6.conf.bak.</filename></para>
|
<filename>shorewall6.conf.bak.</filename></para>
|
||||||
|
|
||||||
<para>The <option>-a</option> option causes the upgraded
|
<para>The <option>-a</option> option causes the updated
|
||||||
<filename>shorewall6.conf</filename> file to be annotated with
|
<filename>shorewall6.conf</filename> file to be annotated with
|
||||||
documentation.</para>
|
documentation.</para>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user