# overridable kernel version to build against %{!?kver:%global kver %(rpm -q kernel-devel | tail -n1 | sed s/kernel-devel-//)} Name: msr-safe Version: 1.4.0 Epoch: 1 Release: 1%{?dist} Summary: DKMS-packaged Linux module for safe access to MSR registers # Module is LGPL except for msr-entry.c; msrsave is BSD License: LGPLv3+ and GPLv2+ and BSD URL: https://github.com/LLNL/msr-safe Source0: https://github.com/LLNL/msr-safe/archive/v%version/%name-%version.tar.gz # Allow specifying kernel version, and build in /usr/src, not /lib/modules Patch1: msr-safe-kver.patch BuildRequires: kernel-devel kernel %{?fedora:BuildRequires: systemd-rpm-macros} Requires(preun): systemd Requires(post): systemd Requires(postun): systemd ExclusiveArch: x86_64 %description DKMS-packaged Linux module for safe access to MSR registers. See also the libmsr package. %prep %setup -q %patch1 -p1 %build # Not installed (dkms used), but check it builds %{!?copr_username:%make_build KVER=%kver CFLAGS="%build_cflags"} %make_build CFLAGS="%build_cflags" msrsave/msrsave %install mkdir -p %buildroot%_datadir/%name %buildroot%_prefix/src/%name-%version cp -a whitelists %buildroot%_datadir/%name install -D -m644 rpm/msr-safe.service %buildroot%_unitdir/msr-safe.service install -D -m644 rpm/msr-safe.sysconfig %buildroot%_sysconfdir/sysconfig/msr-safe install -D -m644 rpm/10-msr-safe.rules %buildroot%_udevrulesdir/10-msr-safe.rules install -D -m755 rpm/msr-safe.sh %buildroot%_sbindir/msr-safe install -D -m755 msrsave/msrsave %buildroot%_sbindir/msrsave install -D -m644 msrsave/msrsave.1 %buildroot%_mandir/man1/msrsave.1 cp -a Makefile *.[ch] %buildroot%_prefix/src/%name-%version cat <<'EOF' >%buildroot%_prefix/src/%name-%version/dkms.conf PACKAGE_NAME="msr-safe" PACKAGE_VERSION="%version" # Module name, source and destination directories, and build command-line BUILT_MODULE_NAME[0]="%name" BUILT_MODULE_LOCATION[0]="." DEST_MODULE_LOCATION[0]="/kernel/../extra/" MAKE[0]="make KVER=${kernelver}" CLEAN="make clean KVER=${kernelver}" AUTOINSTALL="yes" EOF %files %license LICENSE %doc README.md THANKS %_datadir/%name %_prefix/src/%name-%version %_sbindir/msr-safe %_sbindir/msrsave %_unitdir/msr-safe.service %config(noreplace) %_sysconfdir/sysconfig/msr-safe %_udevrulesdir/10-msr-safe.rules %_mandir/man1/msrsave.1* %pre getent group msr >/dev/null || groupadd -r msr %post dkms add -m %{name} -v %{version} --rpm_safe_upgrade dkms build -m %{name} -v %{version} || true udevadm control --reload-rules %systemd_post msr-safe.service %preun dkms remove -m %{name} -v %{version} --all --rpm_safe_upgrade || true groudel msr || : %systemd_preun msr-safe.service %postun udevadm control --reload-rules %systemd_postun_with_restart msr-safe.service %changelog * Fri Jul 3 2020 Dave Love - 1:1.4.0-1 - New version * Fri Apr 12 2019 Dave Love - 1:1.2.0-1 - New version, with epoch - Add scriptlets for service * Tue Jan 12 2016 Dave Love - 20150915-3 - Fix dkms.conf * Wed Jan 6 2016 Dave Love - 20150915-2 - Fix kernel version in dkms.conf and build in the kernel-devel directory * Fri Dec 18 2015 Dave Love - 20150915-1 - Initial packaging