%define _build_id_links none %define _disable_source_fetch 0 %define debug_package %{nil} Name: ec_sys-dkms Version: 1.0.0 Release: 3%{?dist} Summary: EC_SYS DKMS module License: GPL URL: https://gitlab.com/eyes1971/ec_sys-dkms.git Source0: https://gitlab.com/eyes1971/ec_sys-dkms/-/archive/1.0.0/ec_sys-dkms-1.0.0.tar.gz BuildRequires: kernel-devel BuildRequires: dkms %description EC_SYS DKMS module %prep %setup -q -n ec_sys-dkms-1.0.0 %build # Nothing to do %install mkdir -p %{buildroot}/usr/src/%{name}-%{version} cp -a * %{buildroot}/usr/src/%{name}-%{version} %post # Remove old version if it exists dkms remove -m %{name} -v %{version} --all >/dev/null 2>&1 || : # Add to DKMS tree dkms add -m %{name} -v %{version} # Build and install the module dkms build -m %{name} -v %{version} dkms install -m %{name} -v %{version} %preun if [ $1 -eq 0 ] ; then if dkms status -m %{name} -v %{version} >/dev/null 2>&1; then dkms remove -m %{name} -v %{version} --all || true fi fi %files /usr/src/%{name}-%{version} %changelog * Fri Feb 27 2026 Sam Weng - 1.0.0-3 - Improved %preun handling with dkms status check - Allows graceful handling when module doesn't exist - Uses || true to prevent uninstall failures * Fri Feb 27 2026 Sam Weng - 1.0.0-2 - Fixed DKMS post-installation handling with proper cleanup - Added dkms remove to handle existing module versions - Ensures idempotent installation without tree conflicts * Sun Apr 21 2024 Sam Weng - 1.0.0-1 - First Build