1 # Spec file for Open vSwitch kernel modules using DKMS.
3 # Copyright (C) 2015 Nicira, Inc.
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.
10 %define oname openvswitch
15 Summary: Open vSwitch kernel module
19 URL: http
://openvswitch.org
/
20 Source: %{oname}-%{version}.tar.gz
21 Requires: autoconf
, gcc
, make
24 BuildRoot: %
(mktemp
-ud
%{_tmppath}/%{name}-%{version}-%{release}-XXXXXX
)
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
32 Open vSwitch Linux kernel module.
36 %setup -n
%{oname}-%{version}
38 cat
> %{oname}.conf
<< EOF
39 override
%{oname} * extra/%{oname}
40 override
%{oname} * weak-updates/%{oname}
45 # for running the '%{__make} -C datapath print-build-modules' below.
50 %{__rm} -rf %{buildroot}
52 # Kernel module sources install for dkms
53 %{__mkdir_p} %{buildroot}%{_usrsrc}/%{oname}-%{version}/
54 %{__cp} -r * %{buildroot}%{_usrsrc}/%{oname}-%{version}/
56 # check we can get kernel module names
57 %{__make} -C datapath print
-build
-modules
60 cat
> %{buildroot}%{_usrsrc}/%{oname}-%{version}/dkms.conf
<< EOF
61 MODULES
=( `
%{__make} -C datapath print
-build
-modules | grep
-v
make`
)
63 PACKAGE_NAME
="openvswitch"
64 PACKAGE_VERSION
="
%{version}-%{release}"
65 MAKE
=".
/configure
--with
-linux
='\$
{kernel_source_dir
}'
&& make -C datapath
/linux"
66 for __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
/
74 install -d
%{buildroot}%{_sysconfdir}/depmod.d
/
75 install -m
644 %{oname}.conf %{buildroot}%{_sysconfdir}/depmod.d
/
79 # Add to DKMS registry
80 isadded
=`dkms status
-m "
%{oname}" -v "%{version}"`
81 if [ "x$
{isadded
}"
= "x"
] ; then
82 dkms add
-m "
%{oname}" -v "%{version}" ||
:
84 dkms build
-m "
%{oname}" -v "%{version}" ||
:
85 dkms
install -m "
%{oname}" -v "%{version}"
--force ||
:
89 # Remove all versions from DKMS registry
90 dkms remove
-m "
%{oname}" -v "%{version}"
--all ||
:
94 %{__rm} -rf %{buildroot}
99 %{_usrsrc}/%{oname}-%{version}/
100 /etc
/depmod.d
/openvswitch.conf