]> git.proxmox.com Git - mirror_ovs.git/blame - rhel/openvswitch-dkms.spec.in
cirrus: Use FreeBSD 12.2.
[mirror_ovs.git] / rhel / openvswitch-dkms.spec.in
CommitLineData
5cdc4335
AW
1# Spec file for Open vSwitch kernel modules using DKMS.
2#
3# Copyright (C) 2015 Nicira, Inc.
4#
5# Copying and distribution of this file, with or without modification,
6# are permitted in any medium without royalty provided the copyright
7# notice and this notice are preserved. This file is offered as-is,
8# without warranty of any kind.
9
10%define oname openvswitch
11
12Name: %{oname}-dkms
13Version: @VERSION@
14Release: 1%{?dist}
15Summary: Open vSwitch kernel module
16
17Group: System/Kernel
18License: GPLv2
19URL: http://openvswitch.org/
20Source: %{oname}-%{version}.tar.gz
21Requires: autoconf, gcc, make
22Requires(post): dkms
23Requires(preun): dkms
24BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
25
26# Without this we get an empty openvswitch-debuginfo package (whose name
27# conflicts with the openvswitch-debuginfo package for OVS userspace).
28%undefine _enable_debug_packages
29
30
31%description
32Open vSwitch Linux kernel module.
33
34
35%prep
36%setup -n %{oname}-%{version}
37
38cat > %{oname}.conf << EOF
39override %{oname} * extra/%{oname}
40override %{oname} * weak-updates/%{oname}
41EOF
42
43
44%build
45# for running the '%{__make} -C datapath print-build-modules' below.
46./configure
47
48
49%install
50%{__rm} -rf %{buildroot}
51
52# Kernel module sources install for dkms
53%{__mkdir_p} %{buildroot}%{_usrsrc}/%{oname}-%{version}/
54%{__cp} -r * %{buildroot}%{_usrsrc}/%{oname}-%{version}/
55
56# check we can get kernel module names
57%{__make} -C datapath print-build-modules
58
59# Prepare dkms.conf
60cat > %{buildroot}%{_usrsrc}/%{oname}-%{version}/dkms.conf << EOF
61MODULES=( `%{__make} -C datapath print-build-modules | grep -v make` )
62
63PACKAGE_NAME="openvswitch"
64PACKAGE_VERSION="%{version}-%{release}"
65MAKE="./configure --with-linux='\${kernel_source_dir}' && make -C datapath/linux"
66for __idx in \${!MODULES[@]}; do
67 BUILT_MODULE_NAME[__idx]=\${MODULES[__idx]}
68 BUILT_MODULE_LOCATION[__idx]=datapath/linux/
69 DEST_MODULE_LOCATION[__idx]=/kernel/drivers/net/openvswitch/
70done
71AUTOINSTALL=yes
72EOF
73
74install -d %{buildroot}%{_sysconfdir}/depmod.d/
75install -m 644 %{oname}.conf %{buildroot}%{_sysconfdir}/depmod.d/
76
77
78%post
79# Add to DKMS registry
80isadded=`dkms status -m "%{oname}" -v "%{version}"`
81if [ "x${isadded}" = "x" ] ; then
82 dkms add -m "%{oname}" -v "%{version}" || :
83fi
84dkms build -m "%{oname}" -v "%{version}" || :
85dkms install -m "%{oname}" -v "%{version}" --force || :
86
87
88%preun
89# Remove all versions from DKMS registry
90dkms remove -m "%{oname}" -v "%{version}" --all || :
91
92
93%clean
94%{__rm} -rf %{buildroot}
95
96
97%files
98%defattr(-,root,root)
99%{_usrsrc}/%{oname}-%{version}/
100/etc/depmod.d/openvswitch.conf