Eliminate VERSION reserved variable name

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2010-03-02 08:02:10 -08:00
parent 5fc6d58e19
commit 3ea6f6792f
13 changed files with 65 additions and 66 deletions

View File

@ -55,7 +55,7 @@ PRODUCT="Shorewall Lite"
[ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
VERSION=$(cat /usr/share/shorewall-lite/version)
SHOREWALL_VERSION=$(cat /usr/share/shorewall-lite/version)
[ -n "$IPTABLES" ] || IPTABLES=$(mywhich iptables)

View File

@ -531,8 +531,7 @@ export PRODUCT="Shorewall Lite"
[ -d $VARDIR ] || mkdir -p $VARDIR || fatal_error "Unable to create $VARDIR"
LIBRARIES="$SHAREDIR/lib.base $SHAREDIR/lib.cli"
VERSION_FILE=$SHAREDIR/version
HELP=$SHAREDIR/help
version_file=$SHAREDIR/version
for library in $LIBRARIES; do
if [ -f $library ]; then
@ -570,15 +569,15 @@ get_config
FIREWALL=$LITEDIR/firewall
if [ -f $VERSION_FILE ]; then
version=$(cat $VERSION_FILE)
if [ -f $version_file ]; then
SHOREWALL_VERSION=$(cat $SHOREWALL_VERSION_FILE)
else
echo " ERROR: Shorewall Lite is not properly installed" >&2
echo " The file $VERSION_FILE does not exist" >&2
echo " The file $version_file does not exist" >&2
exit 1
fi
banner="Shorewall Lite $version Status at $HOSTNAME -"
banner="Shorewall Lite $SHOREWALL_VERSION Status at $HOSTNAME -"
case $(echo -e) in
-e*)
@ -628,7 +627,7 @@ case "$COMMAND" in
status)
[ $# -eq 1 ] || usage 1
[ "$(id -u)" != 0 ] && fatal_error "ERROR: The status command may only be run by root"
echo "Shorewall Lite $version Status at $HOSTNAME - $(date)"
echo "Shorewall Lite $SHOREWALL_VERSION Status at $HOSTNAME - $(date)"
echo
if shorewall_is_started ; then
echo "Shorewall Lite is running"
@ -662,7 +661,7 @@ case "$COMMAND" in
hits_command $@
;;
version)
echo $version Lite
echo $SHOREWALL_VERSION Lite
;;
logwatch)
logwatch_command $@

View File

@ -219,7 +219,7 @@ sub generate_script_2() {
'[ -n "${VERBOSITY:=0}" ]',
qq([ -n "\${RESTOREFILE:=$config{RESTOREFILE}}" ]) );
emit ( qq(VERSION="$globals{VERSION}") ) unless $test;
emit ( qq(SHOREWALL_VERSION="$globals{VERSION}") ) unless $test;
emit ( qq(PATH="$config{PATH}") ,
'TERMINATOR=fatal_error' ,

View File

@ -213,7 +213,7 @@ case "$COMMAND" in
;;
status)
[ $# -ne 1 ] && usage 2
echo "$PRODUCT-$VERSION Status at $HOSTNAME - $(date)"
echo "$PRODUCT-$SHORWEALL_VERSION Status at $HOSTNAME - $(date)"
echo
if shorewall_is_started; then
echo "$PRODUCT is running"
@ -238,7 +238,7 @@ case "$COMMAND" in
;;
version)
[ $# -ne 1 ] && usage 2
echo $VERSION
echo $SHOREWALL_VERSION
status=0
;;
help)

View File

@ -214,7 +214,7 @@ else
;;
status)
[ $# -ne 1 ] && usage 2
echo "$PRODUCT-$VERSION Status at $HOSTNAME - $(date)"
echo "$PRODUCT-$SHOREWALL_VERSION Status at $HOSTNAME - $(date)"
echo
if shorewall6_is_started; then
echo "$PRODUCT is running"
@ -239,7 +239,7 @@ else
;;
version)
[ $# -ne 1 ] && usage 2
echo $VERSION
echo $SHOREWALL_VERSION
status=0
;;
help)

View File

@ -1054,7 +1054,7 @@ report_capabilities1() {
}
echo "#"
echo "# Shorewall $VERSION detected the following iptables/netfilter capabilities - $(date)"
echo "# Shorewall $SHOREWALL_VERSION detected the following iptables/netfilter capabilities - $(date)"
echo "#"
report_capability1 NAT_ENABLED
report_capability1 MANGLE_ENABLED

View File

@ -514,34 +514,34 @@ show_command() {
[ $# -gt 1 ] && usage 1
local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
echo "$PRODUCT $version Connections ($count out of $max) at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Connections ($count out of $max) at $HOSTNAME - $(date)"
echo
[ -f /proc/net/ip_conntrack ] && cat /proc/net/ip_conntrack || grep -v '^ipv6' /proc/net/nf_conntrack
;;
nat)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version NAT Table at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION NAT Table at $HOSTNAME - $(date)"
echo
show_reset
$IPTABLES -t nat -L $g_ipt_options
;;
raw)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version RAW Table at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION RAW Table at $HOSTNAME - $(date)"
echo
show_reset
$IPTABLES -t raw -L $g_ipt_options
;;
tos|mangle)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Mangle Table at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Mangle Table at $HOSTNAME - $(date)"
echo
show_reset
$IPTABLES -t mangle -L $g_ipt_options
;;
log)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Log ($LOGFILE) at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Log ($LOGFILE) at $HOSTNAME - $(date)"
echo
show_reset
host=$(echo $HOSTNAME | sed 's/\..*$//')
@ -549,21 +549,21 @@ show_command() {
;;
tc)
[ $# -gt 2 ] && usage 1
echo "$PRODUCT $version Traffic Control at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Traffic Control at $HOSTNAME - $(date)"
echo
shift
show_tc $1
;;
classifiers|filters)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Classifiers at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Classifiers at $HOSTNAME - $(date)"
echo
show_classifiers
;;
zones)
[ $# -gt 1 ] && usage 1
if [ -f ${VARDIR}/zones ]; then
echo "$PRODUCT $version Zones at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Zones at $HOSTNAME - $(date)"
echo
while read zone type hosts; do
echo "$zone ($type)"
@ -596,13 +596,13 @@ show_command() {
;;
ip)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version IP at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION IP at $HOSTNAME - $(date)"
echo
ip -4 addr list
;;
routing)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Routing at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Routing at $HOSTNAME - $(date)"
echo
show_routing
;;
@ -613,7 +613,7 @@ show_command() {
;;
chain)
shift
echo "$PRODUCT $version $([ $# -gt 1 ] && echo "Chains " || [ $# -gt 0 ] && echo "Chain " || echo $table Table)$* at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION $([ $# -gt 1 ] && echo "Chains " || [ $# -gt 0 ] && echo "Chain " || echo $table Table)$* at $HOSTNAME - $(date)"
echo
show_reset
if [ $# -gt 0 ]; then
@ -630,7 +630,7 @@ show_command() {
;;
policies)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Policies at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Policies at $HOSTNAME - $(date)"
echo
[ -f ${VARDIR}/policies ] && cat ${VARDIR}/policies;
;;
@ -665,7 +665,7 @@ show_command() {
[ $# -ne 2 ] && usage 1
for directory in $(split $CONFIG_PATH); do
if [ -f ${directory}/macro.$2 ]; then
echo "Shorewall $version Macro $2 at $HOSTNAME - $(date)"
echo "Shorewall $SHOREWALL_VERSION Macro $2 at $HOSTNAME - $(date)"
cat ${directory}/macro.$2
return
fi
@ -715,7 +715,7 @@ show_command() {
fi
done
echo "$PRODUCT $version $([ $# -gt 1 ] && echo "Chains " || echo "Chain ")$* at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION $([ $# -gt 1 ] && echo "Chains " || echo "Chain ")$* at $HOSTNAME - $(date)"
echo
show_reset
for chain in $*; do
@ -723,7 +723,7 @@ show_command() {
echo
done
else
echo "$PRODUCT $version $table Table at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION $table Table at $HOSTNAME - $(date)"
echo
show_reset
$IPTABLES -t $table -L $g_ipt_options
@ -783,7 +783,7 @@ dump_command() {
[ -n "$g_debugging" ] && set -x
[ $# -eq 0 ] || usage 1
clear_term
echo "$PRODUCT $version Dump at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Dump at $HOSTNAME - $(date)"
echo
show_reset
@ -1276,7 +1276,7 @@ hits_command() {
[ $# -eq 0 ] || usage 1
clear_term
echo "$PRODUCT $version Hits at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Hits at $HOSTNAME - $(date)"
echo
timeout=30

View File

@ -1568,7 +1568,7 @@ version_command() {
[ $# -gt 0 ] && usage 1
echo $version
echo $SHOREWALL_VERSION
}
@ -1608,14 +1608,14 @@ done
version_file=$SHAREDIR/version
if [ -f $version_file ]; then
version=$(cat $version_file)
SHOREWALL_VERSION=$(cat $version_file)
else
echo " ERROR: Shorewall is not properly installed" >&2
echo " The file $version_file does not exist" >&2
exit 1
fi
banner="Shorewall-$version Status at $HOSTNAME -"
banner="Shorewall-$SHOREWALL_VERSION Status at $HOSTNAME -"
case $(echo -e) in
-e*)
@ -1702,7 +1702,7 @@ case "$COMMAND" in
[ $# -eq 1 ] || usage 1
[ "$(id -u)" != 0 ] && fatal_error "ERROR: The status command may only be run by root"
get_config
echo "Shorewall-$version Status at $HOSTNAME - $(date)"
echo "Shorewall-$SHOREWALL_VERSION Status at $HOSTNAME - $(date)"
echo
if shorewall_is_started ; then
echo "Shorewall is running"
@ -1748,7 +1748,7 @@ case "$COMMAND" in
;;
logwatch)
get_config Yes Yes Yes
banner="Shorewall-$version Logwatch at $HOSTNAME -"
banner="Shorewall-$SHOREWALL_VERSION Logwatch at $HOSTNAME -"
logwatch_command $@
;;
drop)

View File

@ -55,7 +55,7 @@ PRODUCT="Shorewall Lite"
[ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
VERSION=$(cat /usr/share/shorewall6-lite/version)
SHOREWALL_VERSION=$(cat /usr/share/shorewall6-lite/version)
[ -n "$IPTABLES" ] || IPTABLES=$(mywhich iptables)

View File

@ -516,7 +516,7 @@ export PRODUCT="Shorewall6 Lite"
[ -d $VARDIR ] || mkdir -p $VARDIR || fatal_error "Unable to create $VARDIR"
LIBRARIES="$SHAREDIR/lib.base $SHAREDIR/lib.cli"
VERSION_FILE=$SHAREDIR/version
version_file=$SHAREDIR/version
HELP=$SHAREDIR/help
for library in $LIBRARIES; do
@ -555,15 +555,15 @@ get_config
FIREWALL=$LITEDIR/firewall
if [ -f $VERSION_FILE ]; then
version=$(cat $VERSION_FILE)
if [ -f $version_file ]; then
SHOREWALL_VERSION=$(cat $version_file)
else
echo " ERROR: Shorewall6 Lite is not properly installed" >&2
echo " The file $VERSION_FILE does not exist" >&2
echo " The file $SHOREWALL_VERSION_FILE does not exist" >&2
exit 1
fi
banner="Shorewall6 Lite $version Status at $HOSTNAME -"
banner="Shorewall6 Lite $SHOREWALL_VERSION Status at $HOSTNAME -"
case $(echo -e) in
-e*)
@ -609,7 +609,7 @@ case "$COMMAND" in
status)
[ $# -eq 1 ] || usage 1
[ "$(id -u)" != 0 ] && fatal_error "ERROR: The status command may only be run by root"
echo "Shorewall6 Lite $version Status at $HOSTNAME - $(date)"
echo "Shorewall6 Lite $SHOREWALL_VERSION Status at $HOSTNAME - $(date)"
echo
if shorewall6_is_started ; then
echo "Shorewall6 Lite is running"
@ -643,7 +643,7 @@ case "$COMMAND" in
hits_command $@
;;
version)
echo $version Lite
echo $SHOREWALL_VERSION Lite
;;
logwatch)
logwatch_command $@

View File

@ -958,7 +958,7 @@ report_capabilities1() {
}
echo "#"
echo "# Shorewall6 $VERSION detected the following ip6tables/netfilter capabilities - $(date)"
echo "# Shorewall6 $SHOREWALL_VERSION detected the following ip6tables/netfilter capabilities - $(date)"
echo "#"
report_capability1 MANGLE_ENABLED
report_capability1 MULTIPORT

View File

@ -427,27 +427,27 @@ show_command() {
[ $# -gt 1 ] && usage 1
local count=$(cat /proc/sys/net/netfilter/nf_conntrack_count)
local max=$(cat /proc/sys/net/netfilter/nf_conntrack_max)
echo "$PRODUCT $version Connections ($count of $max) at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Connections ($count of $max) at $HOSTNAME - $(date)"
echo
grep '^ipv6' /proc/net/nf_conntrack
;;
tos|mangle)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Mangle Table at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Mangle Table at $HOSTNAME - $(date)"
echo
show_reset
$IP6TABLES -t mangle -L $g_ipt_options
;;
raw)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version raw Table at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION raw Table at $HOSTNAME - $(date)"
echo
show_reset
$IP6TABLES -t raw -L $g_ipt_options
;;
log)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Log ($LOGFILE) at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Log ($LOGFILE) at $HOSTNAME - $(date)"
echo
show_reset
host=$(echo $HOSTNAME | sed 's/\..*$//')
@ -455,20 +455,20 @@ show_command() {
;;
tc)
[ $# -gt 2 ] && usage 1
echo "$PRODUCT $version Traffic Control at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Traffic Control at $HOSTNAME - $(date)"
echo
show_tc
;;
classifiers|filters)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Classifiers at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Classifiers at $HOSTNAME - $(date)"
echo
show_classifiers
;;
zones)
[ $# -gt 1 ] && usage 1
if [ -f ${VARDIR}/zones ]; then
echo "$PRODUCT $version Zones at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Zones at $HOSTNAME - $(date)"
echo
while read zone type hosts; do
echo "$zone ($type)"
@ -501,13 +501,13 @@ show_command() {
;;
ip)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version IP at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION IP at $HOSTNAME - $(date)"
echo
ip -6 addr list
;;
routing)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Routing at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Routing at $HOSTNAME - $(date)"
echo
show_routing
;;
@ -518,7 +518,7 @@ show_command() {
;;
chain)
shift
echo "$PRODUCT $version $([ $# -gt 1 ] && echo "Chains " || [ $# -gt 0 ] && echo "Chain " || echo $table Table)$* at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION $([ $# -gt 1 ] && echo "Chains " || [ $# -gt 0 ] && echo "Chain " || echo $table Table)$* at $HOSTNAME - $(date)"
echo
show_reset
if [ $# -gt 0 ]; then
@ -534,7 +534,7 @@ show_command() {
;;
policies)
[ $# -gt 1 ] && usage 1
echo "$PRODUCT $version Policies at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Policies at $HOSTNAME - $(date)"
echo
[ -f ${VARDIR}/policies ] && cat ${VARDIR}/policies;
;;
@ -592,14 +592,14 @@ show_command() {
fi
done
echo "$PRODUCT $version $([ $# -gt 1 ] && echo "Chains " || echo "Chain ")$* at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION $([ $# -gt 1 ] && echo "Chains " || echo "Chain ")$* at $HOSTNAME - $(date)"
echo
show_reset
for chain in $*; do
$IP6TABLES -t $table -L $chain $g_ipt_options
done
else
echo "$PRODUCT $version $table Table at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION $table Table at $HOSTNAME - $(date)"
echo
show_reset
$IP6TABLES -t $table -L $g_ipt_options
@ -659,7 +659,7 @@ dump_command() {
[ -n "$g_debugging" ] && set -x
[ $# -eq 0 ] || usage 1
clear_term
echo "$PRODUCT $version Dump at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Dump at $HOSTNAME - $(date)"
echo
if [ -f /usr/share/shorewall/version ]; then
@ -974,7 +974,7 @@ hits_command() {
[ $# -eq 0 ] || usage 1
clear_term
echo "$PRODUCT $version Hits at $HOSTNAME - $(date)"
echo "$PRODUCT $SHOREWALL_VERSION Hits at $HOSTNAME - $(date)"
echo
timeout=30

View File

@ -1476,7 +1476,7 @@ version_command() {
[ $# -gt 0 ] && usage 1
echo $version
echo $SHOREWALL_VERSION
if [ -n "$all" ]; then
if [ -f /usr/share/shorewall/version ]; then
@ -1521,14 +1521,14 @@ done
version_file=$SHAREDIR/version
if [ -f $version_file ]; then
version=$(cat $version_file)
SHOREWALL_VERSION=$(cat $version_file)
else
echo " ERROR: Shorewall6 is not properly installed" >&2
echo " The file $version_file does not exist" >&2
exit 1
fi
banner="Shorewall6-$version Status at $HOSTNAME -"
banner="Shorewall6-$SHOREWALL_VERSION Status at $HOSTNAME -"
case $(echo -e) in
-e*)
@ -1615,7 +1615,7 @@ case "$COMMAND" in
[ $# -eq 1 ] || usage 1
[ "$(id -u)" != 0 ] && fatal_error "ERROR: The status command may only be run by root"
get_config
echo "Shorewall6-$version Status at $HOSTNAME - $(date)"
echo "Shorewall6-$SHOREWALL_VERSION Status at $HOSTNAME - $(date)"
echo
if shorewall6_is_started ; then
echo "Shorewall6 is running"
@ -1655,7 +1655,7 @@ case "$COMMAND" in
;;
logwatch)
get_config Yes Yes Yes
banner="Shorewall6-$version Logwatch at $HOSTNAME -"
banner="Shorewall6-$SHOREWALL_VERSION Logwatch at $HOSTNAME -"
logwatch_command $@
;;
drop)