From a2b5118f2a6fa17aaeb3ec0554b6ea8a3ad62ddd Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Wed, 11 Dec 2024 23:51:30 -0800 Subject: [PATCH] LU-18533 build: fix the common.postinst nonexistence issue Since dkms v3.1.3, the common.postinst script was not installed anymore with the install-redhat target, which caused the following failure while installing lustre-client-dkms package: WARNING: /usr/lib/dkms/common.postinst does not exist. ERROR: DKMS version is too old and lustre-client was not built with legacy DKMS support. You must either rebuild lustre-client with legacy postinst support or upgrade DKMS to a more current version. This patch fixes the above issue by using dkms add, build, and install commands directly instead of the common.postinst script. Test-Parameters: trivial Test-Parameters: optional testgroup=full-dkms Change-Id: If8a61e33d1ef37388e6de7836c00c3e425c2bdc0 Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57392 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Nathaniel Clark Reviewed-by: Li Xi Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre-dkms.spec.in | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/lustre-dkms.spec.in b/lustre-dkms.spec.in index 6372480..4a6dc02 100644 --- a/lustre-dkms.spec.in +++ b/lustre-dkms.spec.in @@ -12,6 +12,10 @@ %bcond_without zfs %bcond_with ldiskfs +%if ! 0%{?rhel}%{?fedora}%{?suse_version}%{?openEuler} +%define not_rpm 1 +%endif + # LUTF Turn off brp-python-precompile script as we don't want the python files # to be compiled on installation %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') @@ -164,24 +168,17 @@ fi /usr/src/%{module}-%{version} %post -for POSTINST in /usr/lib/dkms/common.postinst; do - if [ -f $POSTINST ]; then - $POSTINST %{module} %{version} - exit $? - fi - echo "WARNING: $POSTINST does not exist." -done -echo -e "ERROR: DKMS version is too old and %{module} was not" -echo -e "built with legacy DKMS support." -echo -e "You must either rebuild %{module} with legacy postinst" -echo -e "support or upgrade DKMS to a more current version." -exit 1 +dkms add -m %{module} -v %{version} %{!?not_rpm:--rpm_safe_upgrade} ||: +dkms build -m %{module} -v %{version} || : +dkms install --force -m %{module} -v %{version} ||: %preun -dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade +dkms remove -m %{module} -v %{version} --all %{!?not_rpm:--rpm_safe_upgrade} exit 0 %changelog +* Wed Dec 11 2024 Jian Yu +- Fix the /usr/lib/dkms/common.postinst does not exist warning. * Wed May 16 2018 Joe Grund - Add patch requirement * Mon Aug 1 2016 Nathaniel Clark -- 1.8.3.1