diff --git a/Shorewall/lib.run b/Shorewall/lib.run index dea383469..394927a72 100644 --- a/Shorewall/lib.run +++ b/Shorewall/lib.run @@ -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 diff --git a/Shorewall6/lib.run b/Shorewall6/lib.run index ad906041e..09f2bada2 100644 --- a/Shorewall6/lib.run +++ b/Shorewall6/lib.run @@ -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