From: Christopher J. Morrone Date: Thu, 9 Jun 2011 20:14:11 +0000 (-0700) Subject: LU-407 Fix lustre-modules rpm name in spec file. X-Git-Tag: 2.1.0-RC0~34 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=7fe3a1558a5c990d21759e07c89c33b9cd30599b LU-407 Fix lustre-modules rpm name in spec file. RHEL and Fedora kernels include ".%{_arch}" in the kernel's version string. Since Lustre includes the kernel version in its rpms, it can appear that a double architecture name appears at the end. Really one is from the kernel, and one is from Lustre. Trying to change that is probably more trouble than it is worth. This seems to cause problems with rpm's understanding of rpm names. To fix that this patch takes Andreas's suggestion of grep'ing the full rpm name from "rpm -q kernel-modules". We also add "|| true" to the last line of the %preun scriptlet so that failure does not aport installation. Finally, we also remove the redundant greps in the postun scriptlet. Change-Id: I2c71e853e28ec6e0907eb4ea7c3205ca6e5dd873 Signed-off-by: Christopher J. Morrone Reviewed-on: http://review.whamcloud.com/934 Reviewed-by: Andreas Dilger Tested-by: Hudson Tested-by: Maloo Reviewed-by: Brian J. Murrell --- diff --git a/lustre.spec.in b/lustre.spec.in index d14a6f5..acb94fa 100644 --- a/lustre.spec.in +++ b/lustre.spec.in @@ -302,15 +302,16 @@ else depmod -ae %{kversion} || exit 0 fi +MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}") # "weak modules" support # Suse if [ -x /usr/lib/module-init-tools/weak-modules ]; then - rpm -ql %{name}-modules-%{version}-%{release} | grep '\.ko$' | + rpm -ql $MODULES_RPM_NAME | grep '\.ko$' | /usr/lib/module-init-tools/weak-modules --add-modules fi # RedHat if [ -x /sbin/weak-modules ]; then - rpm -ql %{name}-modules-%{version}-%{release} | grep '\.ko$' | + rpm -ql $MODULES_RPM_NAME | grep '\.ko$' | /sbin/weak-modules --add-modules fi @@ -330,7 +331,8 @@ if sysctl kernel.unsupported >/dev/null 2>&1 && fi %preun modules -rpm -ql %{name}-modules-%{version}-%{release} | grep '\.ko$' > /var/run/%{name}-modules +MODULES_RPM_NAME=$(rpm -q %{name}-modules | grep "%{version}-%{release}") +rpm -ql $MODULES_RPM_NAME | grep '\.ko$' > /var/run/%{name}-modules || true %postun modules if [ -f /boot/System.map-%{kversion} ]; then @@ -342,12 +344,12 @@ fi # "weak modules" support # Suse if [ -x /usr/lib/module-init-tools/weak-modules ]; then - cat /var/run/%{name}-modules | grep '\.ko$' | + cat /var/run/%{name}-modules | /usr/lib/module-init-tools/weak-modules --remove-modules fi # RedHat if [ -x /sbin/weak-modules ]; then - cat /var/run/%{name}-modules | grep '\.ko$' | + cat /var/run/%{name}-modules | /sbin/weak-modules --remove-modules fi rm /var/run/%{name}-modules