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

View File

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