-
Notifications
You must be signed in to change notification settings - Fork 0
/
9pmod.spec
86 lines (61 loc) · 1.95 KB
/
9pmod.spec
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
%define myversion 1.0
%define myrelease 1
%define kernel_release %(echo ${KERNEL_RELEASE})
%define ___kernel_release %(echo ${KERNEL_RELEASE} | tr - _)
# for weak-modules:
%define KREL %{kernel_release}
# no debuginfo
%global debug_package %{nil}
Summary: 9p modules (v9fs) (source)
Name: 9pmod
Version: %{myversion}
Release: %{myrelease}
License: GPL
Group: System Environment/Kernel
Source: 9pmod.tar.gz
URL: www.bull.fr
BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(id -u -n)
%description
Standalone modules for the 9P filesystem (Source)
%define _rpmdrivername 9pmod-ko-%{version}-%{release}
%package ko
Summary: 9p modules (v9fs) (kernel modules)
Version: %{myversion}
Release: %{___kernel_release}%{dist}.Bull.%{myrelease}
Group: System Environment/Kernel
%description ko
Standalone modules for the 9P filesystem
%prep
%setup -q -n 9pmod
%build
make
%install
make INSTALL_MOD_PATH=${RPM_BUILD_ROOT} install
%post ko
if [ -e "/boot/System.map-%{KREL}" ]; then
/sbin/depmod -aeF /boot/System.map-%{KREL} %{KREL} > /dev/null 2>&1 || :
else
/sbin/depmod -r -ae %{KREL}
fi
modules=( $(find /lib/modules/%{KREL}/extra/fs/9p /lib/modules/%{KREL}/extra/net/9p | grep '\.ko$') )
if [ -x "/sbin/weak-modules" ]; then
printf '%s\n' "${modules[@]}" | /sbin/weak-modules --add-modules 2>/dev/null || true
fi
%preun ko
# Save modules list for the postun phase
rpm -ql %_rpmdrivername | grep '\.ko$' > /var/run/rpm-kmod-9pmod-modules
%postun ko
if [ -e "/boot/System.map-%{KREL}" ]; then
/sbin/depmod -aeF /boot/System.map-%{KREL} %{KREL} > /dev/null 2>&1 || :
else
/sbin/depmod -r -ae %{KREL}
fi
modules=( $(cat /var/run/rpm-kmod-9pmod-modules) )
rm /var/run/rpm-kmod-9pmod-modules
if [ -x "/sbin/weak-modules" ]; then
printf '%s\n' "${modules[@]}" | /sbin/weak-modules --remove-modules 2>/dev/null || true
fi
%files ko
%defattr (-,root,root)
/lib/modules
%changelog