diff --git a/Shorewall-lite/shorewall-lite b/Shorewall-lite/shorewall-lite index 050803931..7c951fe12 100755 --- a/Shorewall-lite/shorewall-lite +++ b/Shorewall-lite/shorewall-lite @@ -390,6 +390,55 @@ usage() # $1 = exit status exit $1 } +version_command() { + local finished + finished=0 + local all + all= + local product + + while [ $finished -eq 0 -a $# -gt 0 ]; do + option=$1 + case $option in + -*) + option=${option#-} + + while [ -n "$option" ]; do + case $option in + -) + finished=1 + option= + ;; + a*) + all=Yes + option=${option#a} + ;; + *) + usage 1 + ;; + esac + done + shift + ;; + *) + finished=1 + ;; + esac + done + + [ $# -gt 0 ] && usage 1 + + echo $SHOREWALL_VERSION + + if [ -n "$all" ]; then + for product in shorewall shorewall6 shorewall6-lite shorewall-init; do + if [ -f /usr/share/$product/version ]; then + echo "$product: $(cat /usr/share/$product/version)" + fi + done + fi +} + # # Execution begins here # @@ -633,7 +682,8 @@ case "$COMMAND" in hits_command $@ ;; version) - echo $SHOREWALL_VERSION Lite + shift + version_command $@ ;; logwatch) logwatch_command $@ diff --git a/Shorewall/shorewall b/Shorewall/shorewall index f860f9213..34d18ead0 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -1541,23 +1541,15 @@ version_command() { [ $# -gt 0 ] && usage 1 + echo $SHOREWALL_VERSION + if [ -n "$all" ]; then - for product in shorewall shorewall6 shorewall-lite shorewall6-lite shorewall-init; do + for product in shorewall6 shorewall-lite shorewall6-lite shorewall-init; do if [ -f /usr/share/$product/version ]; then - case $product in - shorewall) - echo $SHOREWALL_VERSION - ;; - *) - echo "$product: $(cat /usr/share/$product/version)" - ;; - esac + echo "$product: $(cat /usr/share/$product/version)" fi done - else - echo $SHOREWALL_VERSION fi - } if [ $# -eq 0 ]; then diff --git a/Shorewall6-lite/shorewall6-lite b/Shorewall6-lite/shorewall6-lite index 8aae0f207..89a36c505 100755 --- a/Shorewall6-lite/shorewall6-lite +++ b/Shorewall6-lite/shorewall6-lite @@ -373,6 +373,55 @@ usage() # $1 = exit status exit $1 } +version_command() { + local finished + finished=0 + local all + all= + local product + + while [ $finished -eq 0 -a $# -gt 0 ]; do + option=$1 + case $option in + -*) + option=${option#-} + + while [ -n "$option" ]; do + case $option in + -) + finished=1 + option= + ;; + a*) + all=Yes + option=${option#a} + ;; + *) + usage 1 + ;; + esac + done + shift + ;; + *) + finished=1 + ;; + esac + done + + [ $# -gt 0 ] && usage 1 + + echo $SHOREWALL_VERSION + + if [ -n "$all" ]; then + for product in shorewall shorewall6 shorewall-lite shorewall-init; do + if [ -f /usr/share/$product/version ]; then + echo "$product: $(cat /usr/share/$product/version)" + fi + done + fi +} + # # Execution begins here # @@ -613,7 +662,8 @@ case "$COMMAND" in hits_command $@ ;; version) - echo $SHOREWALL_VERSION Lite + shift + version_command $@ ;; logwatch) logwatch_command $@ diff --git a/Shorewall6/shorewall6 b/Shorewall6/shorewall6 index 2d0285f18..7641dfeb2 100755 --- a/Shorewall6/shorewall6 +++ b/Shorewall6/shorewall6 @@ -1458,9 +1458,11 @@ version_command() { echo $SHOREWALL_VERSION if [ -n "$all" ]; then - if [ -f /usr/share/shorewall/version ]; then - echo "Shorewall $(cat /usr/share/shorewall/version)" - fi + for product in shorewall shorewall-lite shorewall6-lite shorewall-init; do + if [ -f /usr/share/$product/version ]; then + echo "$product: $(cat /usr/share/$product/version)" + fi + done fi }