%define _build_id_links none %define _disable_source_fetch 0 %define debug_package %{nil} Name: ec_sys-dkms Version: 1.0.3 Release: 1%{?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/v%{version}/ec_sys-dkms-v%{version}.tar.gz BuildRequires: kernel-devel BuildRequires: dkms %description EC_SYS DKMS module %prep %setup -q -n ec_sys-dkms-v%{version} %build # Nothing to do %install mkdir -p %{buildroot}/usr/src/%{name}-%{version} cp -a * %{buildroot}/usr/src/%{name}-%{version} # Fix dkms.conf to match RPM version and actual module location sed -i "s/PACKAGE_VERSION=.*/PACKAGE_VERSION=%{version}/" %{buildroot}/usr/src/%{name}-%{version}/dkms.conf sed -i 's|BUILT_MODULE_LOCATION\[0\]="src/"|BUILT_MODULE_LOCATION[0]="./"|' %{buildroot}/usr/src/%{name}-%{version}/dkms.conf %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.3-1 - Version update with content improvements * 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