Whamcloud - gitweb
LU-18533 build: fix the common.postinst nonexistence issue 92/57392/2
authorJian Yu <yujian@whamcloud.com>
Thu, 12 Dec 2024 07:51:30 +0000 (23:51 -0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 2 Jan 2025 20:52:58 +0000 (20:52 +0000)
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 <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57392
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Nathaniel Clark <nclark@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre-dkms.spec.in

index 6372480..4a6dc02 100644 (file)
 %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 <yujian@whamcloud.com>
+- Fix the /usr/lib/dkms/common.postinst does not exist warning.
 * Wed May 16 2018 Joe Grund <joe.grund@intel.com>
 - Add patch requirement
 * Mon Aug  1 2016 Nathaniel Clark <nathaniel.l.clark@intel.com>