]> git.proxmox.com Git - mirror_lxc.git/blob - lxc.spec.in
cgfsng: fail when limits fail to apply
[mirror_lxc.git] / lxc.spec.in
1 #
2 # lxc: linux Container library
3 #
4 # (C) Copyright IBM Corp. 2007, 2008
5 #
6 # Authors:
7 # Daniel Lezcano <daniel.lezcano at free.fr>
8 #
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
13 #
14 # This library is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # Lesser General Public License for more details.
18 #
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with this library; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
23 %global with_python %{?_with_python: 1} %{?!_with_python: 0}
24 %global with_lua %{?_with_lua: 1} %{?!_with_lua: 0}
25
26 # Set with_systemd on distros that use it, so we can install the service
27 # file, otherwise the sysvinit script will be installed
28 %if 0%{?fedora} >= 14 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1210
29 %global with_systemd 1
30 %define init_script systemd
31 #
32 # BuildRequires systemd-units on fedora and rhel
33 %if 0%{?fedora} >= 14 || 0%{?rhel} >= 7
34 BuildRequires: systemd-units
35 #
36 # BuildRequires systemd on openSUSE and SUSE
37 %endif
38 %if 0%{?suse_version} >= 1210
39 BuildRequires: systemd
40 %endif
41 %else
42 %global with_systemd 0
43 %define init_script sysvinit
44 %endif
45
46 # Must use /var/run for runtime_path on older releases or dnsmasq in the
47 # lxc-net script will not be able to write its pid in /run (selinux denial)
48 %if 0%{?fedora} < 15 || 0%{?rhel} < 7
49 %define _with_runtime_path --with-runtime-path=/var/run
50 %endif
51
52 # RPM needs alpha/beta/rc in Release: not Version: to ensure smooth
53 # package upgrades from alpha->beta->rc->release. For more info see:
54 # http://fedoraproject.org/wiki/Packaging%3aNamingGuidelines#NonNumericRelease
55 %if "x@LXC_VERSION_BETA@" != "x"
56 %global beta_rel @LXC_VERSION_BETA@
57 %global beta_dot .%{beta_rel}
58 %else
59 %global norm_rel 1
60 %endif
61
62 Name: @PACKAGE@
63 Version: @LXC_VERSION_BASE@
64 Release: %{?beta_rel:0.1.%{beta_rel}}%{?!beta_rel:%{norm_rel}}%{?dist}
65 URL: http://linuxcontainers.org
66 Source: http://linuxcontainers.org/downloads/%{name}-%{version}%{?beta_dot}.tar.gz
67 Summary: Linux Containers userspace tools
68 Group: Applications/System
69 License: LGPLv2+
70 BuildRoot: %{_tmppath}/%{name}-%{version}-build
71 Requires: openssl rsync dnsmasq bridge-utils
72 Requires: %{name}-libs = %{version}-%{release}
73 Requires(pre): /usr/sbin/useradd
74 Requires(postun): /usr/sbin/userdel
75 %if 0%{?fedora} < 15 || 0%{?rhel} < 7
76 Requires: libcgroup
77 %endif
78 # Note for Suse. The "docbook2X" BuildRequires does properly
79 # match docbook2x on Suse in a case insensitive manner
80 BuildRequires: libcap libcap-devel docbook2X graphviz libxslt pkgconfig
81
82 #
83 # Additional packages for openSUSE and SUSE
84 #
85 %if 0%{?suse_version} >= 1210
86 PreReq: permissions
87 BuildRequires: libapparmor-devel linux-glibc-devel lsb-release docbook-utils
88
89 #
90 # libseccomp-devel only needed on i386/i586/i686 and X86_64
91 #
92 %ifarch %ix86 x86_64
93 BuildRequires: libseccomp-devel
94 %endif
95 %endif
96
97 %if %{with_python}
98 Requires: python3
99 BuildRequires: python3-devel
100 BuildRequires: python3-setuptools
101 %endif
102
103 %description
104 Containers are insulated areas inside a system, which have their own namespace
105 for filesystem, network, PID, IPC, CPU and memory allocation and which can be
106 created using the Control Group and Namespace features included in the Linux
107 kernel.
108
109 This package provides the lxc-* tools, which can be used to start a single
110 daemon in a container, or to boot an entire "containerized" system, and to
111 manage and debug your containers.
112
113 %package libs
114 Summary: Shared library files for %{name}
115 Group: System Environment/Libraries
116 %description libs
117 The %{name}-libs package contains libraries for running %{name} applications.
118
119 %package devel
120 Summary: Development library for %{name}
121 Group: Development/Libraries
122 Requires: %{name} = %{version}-%{release}, pkgconfig
123 %description devel
124 The %{name}-devel package contains header files and library needed for
125 development of the Linux containers.
126
127 %if %{with_lua}
128 %package lua
129 Summary: Lua bindings for %{name}
130 Group: System Environment/Libraries
131 Requires: lua-filesystem lua-alt-getopt
132 BuildRequires: lua-devel
133 %description lua
134 The %{name}-lua package contains %{name} bindings for lua.
135 %endif
136
137 %prep
138 %setup -q -n %{name}-%{version}%{?beta_dot}
139 %build
140 PATH=$PATH:/usr/sbin:/sbin %configure $args \
141 %if %{with_lua}
142 --enable-lua \
143 %endif
144 %if %{with_python}
145 --enable-python \
146 %endif
147 %if "x%{_unitdir}" != "x"
148 --with-systemdsystemunitdir=%{_unitdir} \
149 %endif
150 %{?_with_runtime_path} \
151 --disable-rpath \
152 --with-init-script=%{init_script}
153 make %{?_smp_mflags}
154
155 %install
156 rm -rf %{buildroot}
157 make install DESTDIR=%{buildroot}
158 find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
159
160 %clean
161 rm -rf %{buildroot}
162
163 %pre
164 # Ensure that lxc-dnsmasq uid & gid gets correctly allocated
165 if getent passwd lxc-dnsmasq >/dev/null 2>&1 ; then : ; else \
166 /usr/sbin/useradd -M -r -s /sbin/nologin \
167 -c "LXC Networking Service" -d %_localstatedir/%name lxc-dnsmasq 2> /dev/null \
168 || exit 1
169 fi
170
171 %post
172 # This test should trigger a network configure on a new install.
173 if [ ! -f @LXC_DISTRO_SYSCONF@/lxc-net ] || ! grep -q 'USE_LXC_BRIDGE=' @LXC_DISTRO_SYSCONF@/lxc-net
174 then
175 # Grab a random 10net subnet. Need to add test logic...
176 while [ true ]
177 do
178 SUBNET=10.$(($RANDOM % 256)).$(($RANDOM % 256))
179 if ! ip -4 route ls | grep -q "^$SUBNET"
180 then
181 break
182 fi
183 done
184
185 cat > @LXC_DISTRO_SYSCONF@/lxc-net <<EOF
186 # Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your
187 # containers. Set to "false" if you'll use virbr0 or another existing
188 # bridge, or mavlan to your host's NIC.
189 USE_LXC_BRIDGE="true"
190
191 # If you change the LXC_BRIDGE to something other than lxcbr0, then
192 # you will also need to update your /etc/lxc/default.conf as well as the
193 # configuration (/var/lib/lxc/<container>/config) for any containers
194 # already created using the default config to reflect the new bridge
195 # name.
196 # If you have the dnsmasq daemon installed, you'll also have to update
197 # /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon.
198 LXC_BRIDGE="lxcbr0"
199 LXC_BRIDGE_MAC="00:16:3e:00:00:00"
200 LXC_ADDR="$SUBNET.1"
201 LXC_NETMASK="255.255.255.0"
202 LXC_NETWORK="$SUBNET.0/24"
203 LXC_DHCP_RANGE="$SUBNET.2,$SUBNET.254"
204 LXC_DHCP_MAX="253"
205 # Uncomment the next line if you'd like to use a conf-file for the lxcbr0
206 # dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have
207 # container 'mail1' always get ip address 10.0.3.100.
208 #LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf
209
210 # Uncomment the next line if you want lxcbr0's dnsmasq to resolve the .lxc
211 # domain. You can then add "server=/lxc/10.0.3.1' (or your actual $LXC_ADDR)
212 # to /etc/dnsmasq.conf, after which 'container1.lxc' will resolve on your
213 # host.
214 #LXC_DOMAIN="lxc"
215 EOF
216 fi
217
218 %postun
219 /usr/sbin/userdel lxc-dnsmasq > /dev/null 2>&1 || :
220
221 %post libs -p /sbin/ldconfig
222 %postun libs -p /sbin/ldconfig
223
224 %files
225 %defattr(-,root,root)
226 %{_bindir}/*
227 # openSUSE/SUSE
228 %if 0%{?suse_version} >= 1210
229 %dir %{_sysconfdir}/apparmor.d
230 %dir %{_sysconfdir}/apparmor.d/abstractions
231 %dir %{_sysconfdir}/apparmor.d/abstractions/%{name}
232 %config %{_sysconfdir}/apparmor.d/abstractions/%{name}/container-base
233 %config %{_sysconfdir}/apparmor.d/abstractions/%{name}/start-container
234 %config %{_sysconfdir}/apparmor.d/%{name}-containers
235 %dir %{_sysconfdir}/apparmor.d/%{name}
236 %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default
237 %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default-with-mounting
238 %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default-with-nesting
239 %config %{_sysconfdir}/apparmor.d/usr.bin.%{name}-start
240 %endif
241 %{_mandir}/man1/lxc*
242 %{_mandir}/man5/lxc*
243 %{_mandir}/man7/lxc*
244 # not openSUSE/SUSE
245 %if %{undefined suse_version}
246 %{_mandir}/ja/man1/lxc*
247 %{_mandir}/ja/man5/lxc*
248 %{_mandir}/ja/man7/lxc*
249 %{_mandir}/ko/man1/lxc*
250 %{_mandir}/ko/man5/lxc*
251 %{_mandir}/ko/man7/lxc*
252 %endif
253 %{_datadir}/doc/*
254 %{_datadir}/lxc/*
255 %{_sysconfdir}/bash_completion.d
256 %config(noreplace) %{_sysconfdir}/lxc/*
257 %config(noreplace) %{_sysconfdir}/sysconfig/*
258
259 %if %{with_systemd}
260 %{_unitdir}/lxc-net.service
261 %{_unitdir}/lxc.service
262 %{_unitdir}/lxc@.service
263 %else
264 %{_sysconfdir}/rc.d/init.d/lxc
265 %{_sysconfdir}/rc.d/init.d/lxc-net
266 %endif
267
268 %files libs
269 %defattr(-,root,root)
270 %{_sbindir}/*
271 %{_libdir}/*.so.*
272 %{_libdir}/%{name}
273 %{_localstatedir}/*
274 %{_libexecdir}/%{name}/hooks/unmount-namespace
275 %{_libexecdir}/%{name}/lxc-apparmor-load
276 %{_libexecdir}/%{name}/lxc-monitord
277 %attr(4111,root,root) %{_libexecdir}/%{name}/lxc-user-nic
278 %if %{with_systemd}
279 %attr(555,root,root) %{_libexecdir}/%{name}/lxc-net
280 %attr(555,root,root) %{_libexecdir}/%{name}/lxc-containers
281 %endif
282
283 %if %{with_python}
284 %{python3_sitearch}/*
285 %endif
286
287 %if %{with_lua}
288 %files lua
289 %defattr(-,root,root)
290 %{_datadir}/lua
291 %{_libdir}/lua
292 %endif
293
294 %files devel
295 %defattr(-,root,root)
296 %{_includedir}/%{name}/*
297 %{_libdir}/*.so
298 %{_libdir}/pkgconfig/*
299
300 %changelog
301 * Tue Oct 22 2013 Dwight Engen <dwight.engen@oracle.com> - 1.0.0-0.1.alpha2
302 - fix some rpmlint warnings/errors
303 - split lua bits into separate package
304
305 * Mon Sep 10 2012 Dwight Engen <dwight.engen@oracle.com> - 0.8.0
306 - fix lxc-init moved to libexec
307 - .pc moved to _libdir
308 - package template files /usr/share/lxc/templates
309
310 * Thu Sep 8 2011 Greg Kurz <gkurz@fr.ibm.com> - 0.7.5.1
311 - fix installed files for rpmbuild
312 - introduce lxc-libs package
313
314 * Fri Jul 23 2010 Daniel Lezcano <dlezcano@fr.ibm.com> - 0.7.2
315 - set attribute for installed files
316 - fix libraries installation
317
318 * Tue Mar 24 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.1
319 - Removed capability setting, let the user to do that through "lxc-setcap"
320
321 * Mon Feb 16 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.0
322 - Added more capabilities to the executables
323
324 * Sun Jan 25 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.0
325 - Reduced spec file
326
327 * Sun Aug 3 2008 Daniel Lezcano <dlezcano@fr.ibm.com> - 0.1.0
328 - Initial RPM release.
329
330 # Local variables:
331 # mode: shell-script
332 # sh-shell: rpm
333 # end: