diff mbox series

[ovs-dev] rhel: Do not update kmod RPM newer major revision kernels

Message ID 20210209194706.5069-1-gvrose8192@gmail.com
State New
Headers show
Series [ovs-dev] rhel: Do not update kmod RPM newer major revision kernels | expand

Commit Message

Gregory Rose Feb. 9, 2021, 7:47 p.m. UTC
The ovs-kmod-manage.sh script will run weak-updates even on newer
release kernels installing a non-compatible or un-runnable kernel
module.

Update the script to never install weak-updates onto kernels with
newer major release versions.

VMware-BZ: #2717283
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
index f147857e4..66b09472a 100644
--- a/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
+++ b/rhel/usr_share_openvswitch_scripts_ovs-kmod-manage.sh
@@ -155,6 +155,16 @@  kmod_versions=()
 kversion=$(rpm -ql ${rpmname} | grep '\.ko$' | \
            sed -n -e 's/^\/lib\/modules\/\(.*\)\/extra\/.*$/\1/p' | \
            sort | uniq)
+
+IFS='.\|-' read installed_major installed_minor installed_patch \
+    installed_major_rev installed_minor_rev installed_extra <<<"${kversion}"
+
+if [ "$installed_major_rev" -lt "$major_rev" ]; then
+    echo Not installing RPM with major revision "$installed_major_rev" \
+to kernel with greater major revision "$major_rev.  Exiting"
+    exit 1
+fi
+
 for kv in $kversion; do
     IFS='.\|-' read -r -a kv_nums <<<"${kv}"
     kmod_versions+=(${kv_nums[$ver_offset]})