Allow 'get_script_version' to correctly handle point releases

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2010-03-04 09:40:48 -08:00
parent 7b52d812ae
commit 41d709b043
2 changed files with 8 additions and 0 deletions

View File

@ -31,6 +31,7 @@ get_script_version() { # $1 = script
local temp
local version
local ifs
local digits
temp=$( $SHOREWALL_SHELL $1 version | sed 's/-.*//' )
@ -41,9 +42,12 @@ get_script_version() { # $1 = script
IFS=.
temp=$(echo $temp)
IFS=$ifs
digits=0
for temp in $temp; do
version=${version}$(printf '%02d' $temp)
digits=$(($digits + 1))
[ $digits -eq 3 ] && break
done
fi

View File

@ -30,6 +30,7 @@ get_script_version() { # $1 = script
local temp
local version
local ifs
local digits
temp=$( $SHOREWALL_SHELL $1 version | sed 's/-.*//' )
@ -40,9 +41,12 @@ get_script_version() { # $1 = script
IFS=.
temp=$(echo $temp)
IFS=$ifs
digits=0
for temp in $temp; do
version=${version}$(printf '%02d' $temp)
digits=$(($digits + 1))
[ $digits -eq 3 ] && break
done
fi