Merge "Change ovs_base neutron plugin to use vercmp"
This commit is contained in:
commit
5b63926788
55
functions
55
functions
@ -511,61 +511,6 @@ function check_path_perm_sanity {
|
||||
}
|
||||
|
||||
|
||||
# This function recursively compares versions, and is not meant to be
|
||||
# called by anything other than vercmp_numbers below. This function does
|
||||
# not work with alphabetic versions.
|
||||
#
|
||||
# _vercmp_r sep ver1 ver2
|
||||
function _vercmp_r {
|
||||
typeset sep
|
||||
typeset -a ver1=() ver2=()
|
||||
sep=$1; shift
|
||||
ver1=("${@:1:sep}")
|
||||
ver2=("${@:sep+1}")
|
||||
|
||||
if ((ver1 > ver2)); then
|
||||
echo 1; return 0
|
||||
elif ((ver2 > ver1)); then
|
||||
echo -1; return 0
|
||||
fi
|
||||
|
||||
if ((sep <= 1)); then
|
||||
echo 0; return 0
|
||||
fi
|
||||
|
||||
_vercmp_r $((sep-1)) "${ver1[@]:1}" "${ver2[@]:1}"
|
||||
}
|
||||
|
||||
|
||||
# This function compares two versions and is meant to be called by
|
||||
# external callers. Please note the function assumes non-alphabetic
|
||||
# versions. For example, this will work:
|
||||
#
|
||||
# vercmp_numbers 1.10 1.4
|
||||
#
|
||||
# The above will return "1", as 1.10 is greater than 1.4.
|
||||
#
|
||||
# vercmp_numbers 5.2 6.4
|
||||
#
|
||||
# The above will return "-1", as 5.2 is less than 6.4.
|
||||
#
|
||||
# vercmp_numbers 4.0 4.0
|
||||
#
|
||||
# The above will return "0", as the versions are equal.
|
||||
#
|
||||
# vercmp_numbers ver1 ver2
|
||||
function vercmp_numbers {
|
||||
typeset v1=$1 v2=$2 sep
|
||||
typeset -a ver1 ver2
|
||||
|
||||
deprecated "vercmp_numbers is deprecated for more generic vercmp"
|
||||
|
||||
IFS=. read -ra ver1 <<< "$v1"
|
||||
IFS=. read -ra ver2 <<< "$v2"
|
||||
|
||||
_vercmp_r "${#ver1[@]}" "${ver1[@]}" "${ver2[@]}"
|
||||
}
|
||||
|
||||
# vercmp ver1 op ver2
|
||||
# Compare VER1 to VER2
|
||||
# - op is one of < <= == >= >
|
||||
|
@ -54,7 +54,7 @@ function _neutron_ovs_base_install_ubuntu_dkms {
|
||||
local kernel_major_minor
|
||||
kernel_major_minor=`echo $kernel_version | cut -d. -f1-2`
|
||||
# From kernel 3.13 on, openvswitch-datapath-dkms is not needed
|
||||
if [ `vercmp_numbers "$kernel_major_minor" "3.13"` -lt "0" ]; then
|
||||
if vercmp '$kernel_major_minor' '<' '3.13'; then
|
||||
install_package "dkms openvswitch-datapath-dkms linux-headers-$kernel_version"
|
||||
fi
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user