File kvm.spec of Package kvm

#
# spec file for package kvm
#
# Copyright (c) 2013 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/
#


%if %( echo `rpm -q --queryformat %%{version} udev` ) > 190
%define _udevrulesdir /usr/lib/udev/rules.d
%else
%define _udevrulesdir /lib/udev/rules.d
%endif

ExclusiveArch:  %ix86 x86_64 s390x

Name:           kvm
Url:            http://www.linux-kvm.org
Summary:        Kernel-based Virtual Machine
License:        GPL-2.0+
Group:          System/Emulators/PC
Version:        1.6.0 
Release:        0
BuildRequires:  qemu >= 1.5.90
BuildRequires:  udev
Requires:       qemu >= 1.5.90
Recommends:     python-curses
Recommends:     virt-utils
Source1:        80-kvm.rules
Source2:        qemu-ifup
Source3:        kvm_stat
Source4:        qemu-kvm.1.gz
Source5:        60-kvm.rules

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
KVM (Kernel-based Virtual Machine) is virtualization software for
Linux. It was originally developed to leverage the hardware virtualization
extensions provided by Intel VT and AMD-V technologies. Since then, a few
other platforms have also included support for KVM virtualization.

Since the qemu package now supports kvm, this package includes only left-overs
from the former kvm package that for various reasons do not make sense to be
placed in the qemu package.

%prep

%build

%install
mkdir -p %{buildroot}%{_bindir}
cat > %{buildroot}%{_bindir}/qemu-kvm << 'EOF'
#!/bin/sh
%ifarch %s390x
exec /usr/bin/qemu-system-s390x -machine accel=kvm "$@"
%else
exec /usr/bin/qemu-system-x86_64 -machine accel=kvm "$@"
%endif
EOF
chmod 755 %{buildroot}%{_bindir}/qemu-kvm
%if 0%{?suse_version} >= 1310
install -D -m 644 %{SOURCE1} %{buildroot}%{_udevrulesdir}/80-kvm.rules
%else
install -D -m 644 %{SOURCE5} %{buildroot}%{_udevrulesdir}/60-kvm.rules
%endif
install -D -m 755 %{SOURCE2} %{buildroot}/usr/share/qemu/qemu-ifup
install -D -m 755 %{SOURCE3} %{buildroot}%{_bindir}/kvm_stat
install -D -m 644 %{SOURCE4} %{buildroot}%{_mandir}/man1/qemu-kvm.1.gz

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%_bindir/qemu-kvm
%_bindir/kvm_stat
%_datadir/qemu/qemu-ifup
%if 0%{?suse_version} >= 1310
%{_udevrulesdir}/80-kvm.rules
%else
%{_udevrulesdir}/60-kvm.rules
%endif
%doc %_mandir/man1/qemu-kvm.1.gz

%changelog
openSUSE Build Service is sponsored by