On 1/15/2018 2:07 PM, Flavio Leitner wrote:
On Sat, Jan 13, 2018 at 02:36:40PM -0800, Greg Rose wrote:
Add post install and post un-install scripts to make sure that the
openvswitch kernel modules are correctly written with the weak-modules
utility. This ensures that after an upgrade to a newer kernel the
correct openvswitch kernel modules from a previous installation will
be found by the depmod search path.
Hi Greg,
I think you're patching the wrong spec. The RPM %post and %postun sections
are needed only when installing the kmod package and they have a separate
specs (which are rhel/*-kmod-*.spec.in.) since they generate a separate
packages.
Since you will be patching the spec generating the package and not a
sub-package, you don't need to add its name after %post or %postun.
I did wonder about that but my ignorance of rpm spec files is showing. :)
OK, I'll rework the patch and send V2.
Your help is greatly appreciated Flavio. Thanks!
- Greg
Example:
diff --git a/rhel/openvswitch-kmod-fedora.spec.in
b/rhel/openvswitch-kmod-fedora.spec.in
index 93adb0330..8ab82348e 100644
--- a/rhel/openvswitch-kmod-fedora.spec.in
+++ b/rhel/openvswitch-kmod-fedora.spec.in
@@ -56,8 +56,29 @@ done
rm -rf $RPM_BUILD_ROOT
%post
-# Ensure that modprobe will find our modules.
-depmod %{kernel}
+for k in $(cd /lib/modules && /bin/ls); do
+ [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
+done
+if [ -x "/sbin/weak-modules" ]; then
+ for m in openvswitch vport-gre vport-stt vport-geneve \
+ vport-lisp vport-vxlan; do
+ echo "/lib/modules/%{kernel}/extra/$m.ko"
+ done | /sbin/weak-modules --add-modules
+fi
+
+
+%postun
+for k in $(cd /lib/modules && /bin/ls); do
+ [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
+done
+if [ "$1" = 0 ]; then # Erase, not upgrade
+ if [ -x "/sbin/weak-modules" ]; then
+ for m in openvswitch vport-gre vport-stt vport-geneve \
+ vport-lisp vport-vxlan; do
+ echo "/lib/modules/%{kernel}/extra/$m.ko"
+ done | /sbin/weak-modules --remove-modules
+ fi
+fi
%files
%defattr(0644,root,root)
fbl
Suggested-by: Flavio Leitner <[email protected]>
Signed-off-by: Greg Rose <[email protected]>
---
rhel/openvswitch.spec.in | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in
index e510d35..44cd611 100644
--- a/rhel/openvswitch.spec.in
+++ b/rhel/openvswitch.spec.in
@@ -165,6 +165,17 @@ else
done
fi
+%post kmod-%{kverrel}
+for k in $(cd /lib/modules && /bin/ls); do
+ [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
+done
+if [ -x "/sbin/weak-modules" ]; then
+ for m in openvswitch vport-gre vport-stt vport-geneve \
+ vport-lisp vport-vxlan; do
+ echo "/lib/modules/%{kernel}/extra/$m.ko"
+ done | /sbin/weak-modules --add-modules
+fi
+
# Ensure all required services are set to run
/sbin/chkconfig --add openvswitch
/sbin/chkconfig openvswitch on
@@ -185,6 +196,19 @@ if [ "$1" = "0" ]; then # $1 = 0 for uninstall
rm -f /etc/openvswitch/vswitchd.cacert
fi
+%postun kmod-%{kverrel}
+for k in $(cd /lib/modules && /bin/ls); do
+ [ -d "/lib/modules/$k/kernel/" ] && depmod -a "$k"
+done
+if [ "$1" = 0 ]; then # Erase, not upgrade
+ if [ -x "/sbin/weak-modules" ]; then
+ for m in openvswitch vport-gre vport-stt vport-geneve \
+ vport-lisp vport-vxlan; do
+ echo "/lib/modules/%{kernel}/extra/$m.ko"
+ done | /sbin/weak-modules --remove-modules
+ fi
+fi
+
%postun selinux-policy
if [ $1 -eq 0 ] ; then
/usr/sbin/semodule -r openvswitch-custom &> /dev/null || :
--
1.8.3.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev