%define module_name mxser %define _srcdir %{_prefix}/src %{?systemd_requires} Name: dkms-%{module_name} Version: 4 Release: 7%{?dist} Summary: Kernel module for Moxa serial controllers Group: System Environment/Kernel License: Proprietary URL: https://moxa.com Source0: https://cdn-cms.azureedge.net/getmedia/c93cf256-4b6d-442d-b18c-297902e370a1/moxa-msb-pci-express-universal-pci-boards-linux-kernel-4.x.x-driver-v4.2.tgz Source1: dkms.conf Source2: disable-fifo-moxa.sh Source3: mxser-disable-fifo.service Source6: moxa_unbind Source7: moxa_unbind.service Source8: mxupcie.conf Patch1: mxser_include_ver_fix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: dkms kernel-devel gcc make systemd bash BuildRequires: systemd-rpm-macros BuildArch: noarch %description Kernel module driver source for Moxa serial controllers %prep %setup -q -n %{module_name} %patch1 -p1 -b .include_fix #build %install rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{_srcdir} mkdir -p $RPM_BUILD_ROOT%{_srcdir}/%{module_name}-%{version} mkdir -p $RPM_BUILD_ROOT%{_bindir} mkdir -p $RPM_BUILD_ROOT%{_unitdir} mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/moxa mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d cp -r %{_builddir}/%{module_name}/driver/* $RPM_BUILD_ROOT%{_srcdir}/%{module_name}-%{version}/ cp %{_builddir}/%{module_name}/mx_ver.h $RPM_BUILD_ROOT%{_srcdir}/%{module_name}-%{version}/kernel4.x/ install -D -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_srcdir}/%{module_name}-%{version}/dkms.conf install -D -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_bindir}/disable-fifo-moxa.sh install -D -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/mxser-disable-fifo.service install -D -m 0755 %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/moxa/moxa_unbind install -D -m 0644 %{SOURCE7} $RPM_BUILD_ROOT%{_unitdir}/moxa_unbind.service install -D -m 0644 %{SOURCE8} $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/mxupcie.conf %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) %{_srcdir}/%{module_name}-%{version}/* %{_bindir}/disable-fifo-moxa.sh %{_unitdir}/mxser-disable-fifo.service %{_sysconfdir}/moxa/moxa_unbind %{_unitdir}/moxa_unbind.service %{_sysconfdir}/modprobe.d/mxupcie.conf %doc readme.txt %post /usr/sbin/dkms add -m %{module_name} -v %{version} %systemd_post mxser-disable-fifo.service %systemd_post moxa_unbind.service /usr/bin/systemctl enable moxa_unbind.service %preun %systemd_preun mxser-disable-fifo.service %systemd_preun moxa_unbind.service /usr/sbin/dkms remove -m %{module_name} -v %{version} --all %postun %systemd_postun_with_restart mxser-disable-fifo.service %systemd_postun_with_restart moxa_unbind.service /usr/sbin/dkms uninstall -m %{module_name} -v %{version} /usr/sbin/dkms remove -m %{module_name} -v %{version} --all %changelog * Wed Oct 25 2023 Alexei Panov - 4-7 - changes for moxa unbind service * Wed Oct 25 2023 Alexei Panov - 4-6 - more changes for drivers work * Tue Oct 24 2023 Alexei Panov - 4-5 - added second kernel module * Thu Jul 6 2023 Alexei Panov - 4-4 - changed post and preun ections * Thu Jul 6 2023 Alexei Panov - 4-3 - changed option "remake_initrd" to "yes" in dkms.conf file * Thu Jun 30 2022 Alexei Panov - 4-2 - added patch to fix rename state field * Mon Mar 14 2022 Alexei Panov - 4-1 - initial build for EPEL (version 8)