summaryrefslogtreecommitdiff
path: root/kmod.spec
blob: 963ca861bacabb8ac4221d3f428bdcbdf8caa631 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Name:           kmod
Version:        34
Release:        1
Summary:        Kernel module management
License:        GPL-2.0-or-later
URL:            https://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary
Source0:        https://www.kernel.org/pub/linux/utils/kernel/kmod/%{name}-%{version}.tar.xz
Source1:        weak-modules
Source2:        depmod.conf.dist
Source3:        kmod.changes

BuildRequires:  gcc chrpath zlib-devel xz-devel scdoc openssl-devel libtool gtk-doc

Provides:       module-init-tools = 4.0-1
Provides:       /sbin/modprobe
Patch0001:	0001-Module-replace-the-module-with-new-module.patch
Patch0002:	0002-Module-suspend-the-module-by-rmmod-r-option.patch

%description
The kmod package provides several commands to manage the kernel modules,
such as insmod to load and rmmod to unload the modules.

%package libs
Summary:    Libraries to handle kernel module loading and unloading
License:    LGPL-2.1-or-later

%description libs
The kmod-libs package provides runtime libraries for any application that
wishes to load or unload Linux kernel modules from the running system.

%package devel
Summary:        Header files for kmod development
License:        LGPL-2.1-or-later
Requires:       %{name} = %{version}-%{release}
Requires:       %{name}-libs = %{version}-%{release}

%description devel
The kmod-devel package provides header files used for loading or unloading
kernel modules.

%package_help

%prep
%autosetup -n %{name}-%{version} -p1

%build
# Reinitialize libtool to remove Rpath
autoreconf -vif
%configure --with-openssl --with-zlib --with-xz
%make_build

%install
%make_install
%delete_la
pushd $RPM_BUILD_ROOT/%{_mandir}/man5
ln -s modprobe.d.5 modprobe.conf.5
popd

mkdir -p $RPM_BUILD_ROOT%{_sbindir}
for i in $RPM_BUILD_ROOT%{_sbindir}/modprobe $RPM_BUILD_ROOT%{_sbindir}/modinfo $RPM_BUILD_ROOT%{_sbindir}/insmod \
         $RPM_BUILD_ROOT%{_sbindir}/rmmod $RPM_BUILD_ROOT%{_sbindir}/depmod $RPM_BUILD_ROOT%{_sbindir}/lsmod
do
    ln -sf ../bin/kmod $i
done

mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d

install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sbindir}/weak-modules
install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf

%files
%dir %{_sysconfdir}/*.d
%dir %{_prefix}/lib/modprobe.d

%{_bindir}/*
%{_sbindir}/*
%{bash_completions_dir}/*
%{zsh_completions_dir}/*
%{fish_completions_dir}/*
%{_sysconfdir}/depmod.d/dist.conf

%files libs
%license COPYING
%{_libdir}/libkmod.so.*

%files devel
%{_includedir}/libkmod.h
%{_libdir}/pkgconfig/libkmod.pc
%{_datadir}/pkgconfig/kmod.pc
%{_libdir}/libkmod.so

%files help
%attr(0644,root,root) %{_mandir}/man5/*.5*
%attr(0644,root,root) %{_mandir}/man8/*.8*

%doc NEWS README.md

%include %{SOURCE3}