File lxc.spec of Package lxc

#
# spec file for package lxc
#
# 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/
#


Name:           lxc
Version:        0.8.0
Release:        0
Url:            http://lxc.sourceforge.net/
Summary:        Linux containers implementation
License:        LGPL-2.1+
Group:          System/Management
Source:         http://lxc.sourceforge.net/download/lxc/%{name}-%{version}.tar.gz
Source1:        README.SUSE
Source2:        lxc-createconfig.in

# PATCH-FIX-UPSTREAM lxc-opensuse-clonefixes.patch fcrozat@suse.com -- various fixes in openSUSE template for lxc-clone
Patch0:         lxc-opensuse-clonefixes.patch
# PATCH-FIX-UPSTREAM lxc-opensuse-tmpfs.patch fcrozat@suse.com -- fix shutdown in openSUSE container
Patch1:         lxc-opensuse-tmpfs.patch
# PATCH-FIX-UPSTREAM lxc-cgroup-already-running.patch fcrozat@suse.com -- warn if container is already running
Patch2:         lxc-cgroup-already-running.patch
# PATCH-FIX-UPSTREAM 0001-Ensure-btrfs-subvolume-is-destroyed-on-error.patch fcrozat@suse.com -- ensure btrfs subvolume is destroyed on container creation fails
Patch4:         0001-Ensure-btrfs-subvolume-is-destroyed-on-error.patch
# PATCH-FIX-UPSTREAM lxc-opensuse-12.2.patch
Patch5:         lxc-opensuse-12.2.patch
# PATCH-FIX-UPSTREAM pivot-root_shared.patch fcrozat@suse.com -- fix pivot root when / is mount as shared
Patch6:         pivot-root_shared.patch
# PATCH-FIX-UPSTREAM lxc-autodev.patch fcrozat@suse.com -- Add lxc.autodev
Patch7:         lxc-autodev.patch
Patch8:         lxc-opensuse-extend-base.patch
Patch9:         lxc-opensuse-proper-failure.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  docbook-utils
BuildRequires:  libapparmor-devel
BuildRequires:  libcap-devel
BuildRequires:  pkg-config
%if 0%{?suse_version} >= 1130
BuildRequires:  linux-glibc-devel
%else
BuildRequires:  linux-kernel-headers
%endif
Requires:       /sbin/setcap
Requires:       rsync
%if 0%{?suse_version} < 1230
Requires(post): aaa_base
%endif
# needed to create openSUSE containers using template
Recommends:     build

%description
It provides commands to create and manage containers. It contains a
full featured container with the isolation/virtualization of the pids,
the ipc, the utsname, the mount points, /proc, /sys, the network and it
takes into account the control groups. It is very light, flexible, and
provides a set of tools around the container like the monitoring with
asynchronous events notification, or the freeze of the container. This
package is useful to create Virtual Private Server, or to run isolated
applications like bash or sshd.

%package devel
Summary:        Development library for lxc
License:        LGPL-2.1
Group:          Development/Libraries/C and C++
Requires:       %name = %version

%description devel
Lxc header files and library needed for development of containers.

%prep
%setup
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1

%build
%configure --disable-examples
%__make %{?_smp_mflags}
%__cp %{SOURCE1} .
%__rm -rf .doc
%__mkdir_p .doc/examples
%__cp doc/examples/*.conf .doc/examples

%install
%makeinstall
install -d -m 755 %{buildroot}/var/lib/lxc
find %buildroot -type f -name '*.la' -delete

./config.status --file=%{buildroot}%{_bindir}/lxc-createconfig:%{S:2}
chmod a+x %{buildroot}%{_bindir}/lxc-createconfig

%clean
%__rm -rf %buildroot

%post
/sbin/ldconfig
%if 0%{?suse_version} < 1230
if [ -x /etc/init.d/boot.cgroup ]; then 
%fillup_and_insserv -f -Y boot.cgroup
/etc/init.d/boot.cgroup start 2>/dev/null >/dev/null || :
fi
%endif

%postun
/sbin/ldconfig
%if 0%{?suse_version} < 1230
%insserv_cleanup
%endif

%files
%defattr(-,root,root)
%doc AUTHORS MAINTAINERS COPYING README doc/FAQ.txt
%doc README.SUSE
%doc .doc/examples
%{_libdir}/lib%{name}.so.*
%{_libexecdir}/%name
%{_libdir}/%name
%{_datadir}/%name
%dir /var/lib/lxc
%{_bindir}/%{name}-*
%{_mandir}/man[^3]/*

%files devel
%defattr(-,root,root)
%{_includedir}/%name
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/%{name}.pc

%changelog
openSUSE Build Service is sponsored by