File lxc.spec of Package lxc.6023

#
# spec file for package lxc
#
# Copyright (c) 2016 SUSE LINUX 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:        1.1.2
Release:        0
Url:            http://linuxcontainers.org/
Summary:        Userspace tools for the Linux kernel containers
License:        LGPL-2.1+
Group:          System/Management
Source:         http://linuxcontainers.org/downloads/%{name}-%{version}.tar.gz
Source1:        README.SUSE
Source2:        lxc-createconfig.in
Patch0:         lxc-1.0.7-fix-bashisms.patch
Patch1:         CVE-2015-1331-lxclock-use-run-lxc-lock-rather-than-r.patch
Patch2:         attach-mount-a-sane-prox-for-LSM-setup.patch
Patch3:         CVE-2015-1334-Don-t-use-the-container-s-proc-during-.patch
Patch4:         templates-lxc-opensuse-use-rpm-to-determine-build-ve.patch
Patch5:         CVE-2015-1335-Protect-container-mounts-against-symlinks.patch
Patch6:         CVE-2016-8649-attach-do-not-send-procfd-to-attached-process.patch

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

BuildRequires:  docbook-utils
BuildRequires:  docbook2x
BuildRequires:  fdupes
BuildRequires:  libapparmor-devel
BuildRequires:  libcap-devel
%ifarch %ix86 x86_64
BuildRequires:  libseccomp-devel
%endif
BuildRequires:  libxslt
BuildRequires:  linux-glibc-devel
BuildRequires:  lsb-release
BuildRequires:  pkg-config
BuildRequires:  python3-devel

%if 0%{?suse_version} >= 1210
BuildRequires:  systemd
%endif

Requires:       /sbin/setcap
Requires:       rsync

%{?systemd_requires}
# 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 -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1

%build
chmod 755 configure
%configure --disable-examples \
	--disable-rpath \
	--with-init-script=systemd \
	--with-systemdsystemunitdir=%{_unitdir}
%__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
chmod u-s %{buildroot}/usr/lib/lxc/lxc-user-nic
./config.status --file=%{buildroot}%{_bindir}/lxc-createconfig:%{S:2}
chmod a+x %{buildroot}%{_bindir}/lxc-createconfig
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rclxc
ln -s /usr/sbin/service %{buildroot}%{_sbindir}/rclxc-net
%fdupes %{buildroot}/%{_datadir}/%{name}/config/

%clean
%__rm -rf %buildroot

%pre
%service_add_pre lxc.service lxc-net.service

%post
/sbin/ldconfig
%service_add_post lxc.service lxc-net.service

%preun
%service_del_preun lxc.service lxc-net.service

%postun
/sbin/ldconfig
%service_del_postun lxc.service lxc-net.service

%files
%defattr(-,root,root)
%doc AUTHORS MAINTAINERS COPYING README doc/FAQ.txt
%doc README.SUSE
%doc .doc/examples
%dir %{_sysconfdir}/%{name}/
%config %{_sysconfdir}/%{name}/default.conf
%config(noreplace) %{_sysconfdir}/default/%{name}
%{_libdir}/lib%{name}.so.*
%{_libexecdir}/%name
%{_libdir}/%name
%{_datadir}/%name
%dir /var/lib/lxc
%{_bindir}/%{name}-*
%{_sbindir}/init.lxc
%{_sbindir}/rclxc
%{_sbindir}/rclxc-net
%{_mandir}/man[^3]/*
%_unitdir/%{name}.service
%_unitdir/%{name}-net.service
%python3_sitearch/%{name}/
%python3_sitearch/_%{name}*
%dir  %{_sysconfdir}/apparmor.d
%dir  %{_sysconfdir}/apparmor.d/abstractions
%dir  %{_sysconfdir}/apparmor.d/abstractions/lxc
%config %{_sysconfdir}/apparmor.d/abstractions/lxc/container-base
%config %{_sysconfdir}/apparmor.d/abstractions/lxc/start-container
%config %{_sysconfdir}/apparmor.d/lxc-containers
%dir  %{_sysconfdir}/apparmor.d/lxc
%config %{_sysconfdir}/apparmor.d/lxc/lxc-default
%config %{_sysconfdir}/apparmor.d/lxc/lxc-default-with-mounting
%config %{_sysconfdir}/apparmor.d/lxc/lxc-default-with-nesting
%config %{_sysconfdir}/apparmor.d/usr.bin.lxc-start
%config %{_sysconfdir}/bash_completion.d/%{name}

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

%changelog
openSUSE Build Service is sponsored by