mirror of
https://gitlab.com/shorewall/code.git
synced 2025-02-04 11:59:27 +01:00
Extend 'version -a' behavior to all CLIs
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
47c4cbd85a
commit
858a422da3
@ -390,6 +390,55 @@ usage() # $1 = exit status
|
|||||||
exit $1
|
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
|
# Execution begins here
|
||||||
#
|
#
|
||||||
@ -633,7 +682,8 @@ case "$COMMAND" in
|
|||||||
hits_command $@
|
hits_command $@
|
||||||
;;
|
;;
|
||||||
version)
|
version)
|
||||||
echo $SHOREWALL_VERSION Lite
|
shift
|
||||||
|
version_command $@
|
||||||
;;
|
;;
|
||||||
logwatch)
|
logwatch)
|
||||||
logwatch_command $@
|
logwatch_command $@
|
||||||
|
@ -1541,23 +1541,15 @@ version_command() {
|
|||||||
|
|
||||||
[ $# -gt 0 ] && usage 1
|
[ $# -gt 0 ] && usage 1
|
||||||
|
|
||||||
|
echo $SHOREWALL_VERSION
|
||||||
|
|
||||||
if [ -n "$all" ]; then
|
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
|
if [ -f /usr/share/$product/version ]; then
|
||||||
case $product in
|
echo "$product: $(cat /usr/share/$product/version)"
|
||||||
shorewall)
|
|
||||||
echo $SHOREWALL_VERSION
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "$product: $(cat /usr/share/$product/version)"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
|
||||||
echo $SHOREWALL_VERSION
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
|
@ -373,6 +373,55 @@ usage() # $1 = exit status
|
|||||||
exit $1
|
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
|
# Execution begins here
|
||||||
#
|
#
|
||||||
@ -613,7 +662,8 @@ case "$COMMAND" in
|
|||||||
hits_command $@
|
hits_command $@
|
||||||
;;
|
;;
|
||||||
version)
|
version)
|
||||||
echo $SHOREWALL_VERSION Lite
|
shift
|
||||||
|
version_command $@
|
||||||
;;
|
;;
|
||||||
logwatch)
|
logwatch)
|
||||||
logwatch_command $@
|
logwatch_command $@
|
||||||
|
@ -1458,9 +1458,11 @@ version_command() {
|
|||||||
echo $SHOREWALL_VERSION
|
echo $SHOREWALL_VERSION
|
||||||
|
|
||||||
if [ -n "$all" ]; then
|
if [ -n "$all" ]; then
|
||||||
if [ -f /usr/share/shorewall/version ]; then
|
for product in shorewall shorewall-lite shorewall6-lite shorewall-init; do
|
||||||
echo "Shorewall $(cat /usr/share/shorewall/version)"
|
if [ -f /usr/share/$product/version ]; then
|
||||||
fi
|
echo "$product: $(cat /usr/share/$product/version)"
|
||||||
|
fi
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user