158 lines
3.9 KiB
RPMSpec
158 lines
3.9 KiB
RPMSpec
#
|
|
# spec file for package hyper-v
|
|
#
|
|
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
|
#
|
|
# All modifications and additions to the file contributed by third parties
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
# upon. The license for this file, and modifications and additions to the
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
# license for the pristine package is not an Open Source License, in which
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
# published by the Open Source Initiative.
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
#
|
|
|
|
# norootforbuild
|
|
|
|
%define with_kmp 1
|
|
%if %{with_kmp}
|
|
%define with_drivers_in_kmp 0
|
|
%endif
|
|
|
|
Name: hyper-v
|
|
%if %{with_kmp}
|
|
BuildRequires: kernel-default-devel module-init-tools
|
|
%ifarch %ix86
|
|
BuildRequires: kernel-pae-devel
|
|
%endif
|
|
%endif
|
|
ExclusiveArch: %ix86 x86_64
|
|
PreReq: %insserv_prereq
|
|
Group: System/Kernel
|
|
AutoReqProv: on
|
|
Summary: Microsoft Hyper-V drivers
|
|
Url: http://www.kernel.org
|
|
Version: 1
|
|
Release: %(bash %_sourcedir/get_release_number.sh)
|
|
Source: Module.supported
|
|
Source1: hyperv_pvdrivers.conf
|
|
Source2: kmp_filelist
|
|
Source3: hyper-v.supplements.txt
|
|
Source4: hyper-v.dummy_ko.c
|
|
Source10: hv_kvp_daemon.c
|
|
Source11: hyper-v.init.sh
|
|
License: GPL v2 only
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
%if %{with_kmp}
|
|
%if %{with_drivers_in_kmp}
|
|
%suse_kernel_module_package -n hyper-v um xen -f kmp_filelist
|
|
%else
|
|
%suse_kernel_module_package -n hyper-v um xen -f kmp_filelist -p hyper-v.supplements.txt
|
|
%endif
|
|
%endif
|
|
|
|
%description
|
|
This package contains the Microsoft Hyper-V drivers.
|
|
|
|
|
|
|
|
%if %{with_kmp}
|
|
|
|
%package KMP
|
|
Group: System/Kernel
|
|
License: GPL v2 only
|
|
Summary: Microsoft Hyper-V drivers
|
|
|
|
%description KMP
|
|
This package contains the Microsoft Hyper-V drivers.
|
|
|
|
|
|
|
|
%endif
|
|
|
|
%prep
|
|
%setup -Tc
|
|
|
|
%build
|
|
gcc $RPM_OPT_FLAGS -g %{S:10} -o hv_kvp_daemon
|
|
%if %{with_kmp}
|
|
for flavor in %flavors_to_build; do
|
|
%if %{with_drivers_in_kmp}
|
|
krel=$(make -s -C %{kernel_source $flavor} kernelrelease)
|
|
cp -a /lib/modules/$krel/source/drivers/staging/hv $flavor
|
|
%else
|
|
rm -rfv $flavor
|
|
mkdir -p $flavor
|
|
cp %_sourcedir/hyper-v.dummy_ko.c $flavor/hyper-v.suse_kmp_dummy.c
|
|
cat > $flavor/Makefile <<-EOF
|
|
obj-m += hyper-v.suse_kmp_dummy.o
|
|
EOF
|
|
%endif
|
|
cp %_sourcedir/Module.supported $flavor
|
|
make -C %{kernel_source $flavor} modules M=$PWD/$flavor
|
|
done
|
|
%endif
|
|
|
|
%install
|
|
%if %{with_kmp}
|
|
export INSTALL_MOD_PATH=$RPM_BUILD_ROOT
|
|
for flavor in %flavors_to_build; do
|
|
make -C %{kernel_source $flavor} modules_install M=$PWD/$flavor
|
|
done
|
|
%endif
|
|
mkdir -p $RPM_BUILD_ROOT/usr/sbin
|
|
install -m755 hv_kvp_daemon $RPM_BUILD_ROOT/usr/sbin
|
|
mkdir -p $RPM_BUILD_ROOT/etc/init.d
|
|
install -m755 %{S:11} $RPM_BUILD_ROOT/etc/init.d/hv_kvp_daemon
|
|
ln -sfvbn ../..//etc/init.d/hv_kvp_daemon $RPM_BUILD_ROOT/usr/sbin/rchv_kvp_daemon
|
|
mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d
|
|
install -m644 %SOURCE1 $RPM_BUILD_ROOT/etc/modprobe.d/hyperv_pvdrivers.conf
|
|
|
|
%files
|
|
%defattr (-,root,root)
|
|
%if !%{with_kmp}
|
|
%dir /etc/modprobe.d
|
|
%config /etc/modprobe.d/hyperv_pvdrivers.conf
|
|
%endif
|
|
/etc/init.d/hv_kvp_daemon
|
|
/usr/sbin/rchv_kvp_daemon
|
|
/usr/sbin/hv_kvp_daemon
|
|
|
|
%post
|
|
if test -d /sys/class/dmi/id
|
|
then
|
|
pushd /sys/class/dmi/id > /dev/null
|
|
board_vendor=
|
|
if test -r board_vendor
|
|
then
|
|
board_vendor="`cat board_vendor`"
|
|
fi
|
|
if test "${board_vendor}" = "Microsoft Corporation"
|
|
then
|
|
product_name=
|
|
if test -r product_name
|
|
then
|
|
product_name="`cat product_name`"
|
|
fi
|
|
if test "${product_name}" = "Virtual Machine"
|
|
then
|
|
echo "Enabling hv_kvp_daemon on '${product_name}' from '${board_vendor}'"
|
|
popd > /dev/null
|
|
%{fillup_and_insserv -Y hv_kvp_daemon}
|
|
exit 0
|
|
fi
|
|
fi
|
|
fi
|
|
%{fillup_and_insserv hv_kvp_daemon}
|
|
|
|
%preun
|
|
%stop_on_removal
|
|
|
|
%postun
|
|
%insserv_cleanup
|
|
|
|
%changelog
|