]> git.proxmox.com Git - mirror_lxc.git/blob - lxc.spec.in
e64122c0b64ee9ac9492c611c8e552965c0747a5
[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(pre): /usr/sbin/useradd
73 Requires(postun): /usr/sbin/userdel
74 %if 0%{?fedora} < 15 || 0%{?rhel} < 7
75 Requires: libcgroup
76 %endif
77 # Note for Suse. The "docbook2X" BuildRequires does properly
78 # match docbook2x on Suse in a case insensitive manner
79 BuildRequires: libcap libcap-devel docbook2X graphviz libxslt pkgconfig
80
81 #
82 # Additional packages for openSUSE and SUSE
83 #
84 %if 0%{?suse_version} >= 1210
85 PreReq: permissions
86 BuildRequires: libapparmor-devel linux-glibc-devel lsb-release docbook-utils
87
88 #
89 # libseccomp-devel only needed on i386/i586/i686 and X86_64
90 #
91 %ifarch %ix86 x86_64
92 BuildRequires: libseccomp-devel
93 %endif
94 %endif
95
96 %if %{with_python}
97 Requires: python3
98 BuildRequires: python3-devel
99 %endif
100
101 %description
102 Containers are insulated areas inside a system, which have their own namespace
103 for filesystem, network, PID, IPC, CPU and memory allocation and which can be
104 created using the Control Group and Namespace features included in the Linux
105 kernel.
106
107 This package provides the lxc-* tools, which can be used to start a single
108 daemon in a container, or to boot an entire "containerized" system, and to
109 manage and debug your containers.
110
111 %package libs
112 Summary: Shared library files for %{name}
113 Group: System Environment/Libraries
114 %description libs
115 The %{name}-libs package contains libraries for running %{name} applications.
116
117 %package devel
118 Summary: Development library for %{name}
119 Group: Development/Libraries
120 Requires: %{name} = %{version}-%{release}, pkgconfig
121 %description devel
122 The %{name}-devel package contains header files and library needed for
123 development of the Linux containers.
124
125 %if %{with_lua}
126 %package lua
127 Summary: Lua bindings for %{name}
128 Group: System Environment/Libraries
129 Requires: lua-filesystem lua-alt-getopt
130 BuildRequires: lua-devel
131 %description lua
132 The %{name}-lua package contains %{name} bindings for lua.
133 %endif
134
135 %prep
136 %setup -q -n %{name}-%{version}%{?beta_dot}
137 %build
138 PATH=$PATH:/usr/sbin:/sbin %configure $args \
139 %if %{with_lua}
140 --enable-lua \
141 %endif
142 %if %{with_python}
143 --enable-python \
144 %endif
145 %if "x%{_unitdir}" != "x"
146 --with-systemdsystemunitdir=%{_unitdir} \
147 %endif
148 %{?_with_runtime_path} \
149 --disable-rpath \
150 --with-init-script=%{init_script}
151 make %{?_smp_mflags}
152
153 %install
154 rm -rf %{buildroot}
155 make install DESTDIR=%{buildroot}
156 find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
157
158 %clean
159 rm -rf %{buildroot}
160
161 %pre
162 # Ensure that lxc-dnsmasq uid & gid gets correctly allocated
163 if getent passwd lxc-dnsmasq >/dev/null 2>&1 ; then : ; else \
164 /usr/sbin/useradd -M -r -s /sbin/nologin \
165 -c "LXC Networking Service" -d %_localstatedir/%name lxc-dnsmasq 2> /dev/null \
166 || exit 1
167 fi
168
169 %post
170 # This test should trigger a network configure on a new install.
171 if [ ! -f %{_sysconfdir}/sysconfig/lxc-net ] || ! grep -q 'USE_LXC_BRIDGE=' %{_sysconfdir}/sysconfig/lxc-net
172 then
173 # Grab a random 10net subnet. Need to add test logic...
174 while [ true ]
175 do
176 SUBNET=10.$(($RANDOM % 256)).$(($RANDOM % 256))
177 if ! ip -4 route ls | grep -q "^$SUBNET"
178 then
179 break
180 fi
181 done
182
183 cat > %{_sysconfdir}/sysconfig/lxc-net <<EOF
184 # Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your
185 # containers. Set to "false" if you'll use virbr0 or another existing
186 # bridge, or mavlan to your host's NIC.
187 USE_LXC_BRIDGE="true"
188
189 # If you change the LXC_BRIDGE to something other than lxcbr0, then
190 # you will also need to update your /etc/lxc/default.conf as well as the
191 # configuration (/var/lib/lxc/<container>/config) for any containers
192 # already created using the default config to reflect the new bridge
193 # name.
194 # If you have the dnsmasq daemon installed, you'll also have to update
195 # /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon.
196 LXC_BRIDGE="lxcbr0"
197 LXC_ADDR="$SUBNET.1"
198 LXC_NETMASK="255.255.255.0"
199 LXC_NETWORK="$SUBNET.0/24"
200 LXC_DHCP_RANGE="$SUBNET.2,$SUBNET.254"
201 LXC_DHCP_MAX="253"
202 # Uncomment the next line if you'd like to use a conf-file for the lxcbr0
203 # dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have
204 # container 'mail1' always get ip address 10.0.3.100.
205 #LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf
206
207 # Uncomment the next line if you want lxcbr0's dnsmasq to resolve the .lxc
208 # domain. You can then add "server=/lxc/10.0.3.1' (or your actual $LXC_ADDR)
209 # to /etc/dnsmasq.conf, after which 'container1.lxc' will resolve on your
210 # host.
211 #LXC_DOMAIN="lxc"
212 EOF
213 fi
214
215 %postun
216 /usr/sbin/userdel lxc-dnsmasq > /dev/null 2>&1 || :
217
218 %post libs -p /sbin/ldconfig
219 %postun libs -p /sbin/ldconfig
220
221 %files
222 %defattr(-,root,root)
223 %{_bindir}/*
224 # openSUSE/SUSE
225 %if 0%{?suse_version} >= 1210
226 %dir %{_sysconfdir}/apparmor.d
227 %dir %{_sysconfdir}/apparmor.d/abstractions
228 %dir %{_sysconfdir}/apparmor.d/abstractions/%{name}
229 %config %{_sysconfdir}/apparmor.d/abstractions/%{name}/container-base
230 %config %{_sysconfdir}/apparmor.d/abstractions/%{name}/start-container
231 %config %{_sysconfdir}/apparmor.d/%{name}-containers
232 %dir %{_sysconfdir}/apparmor.d/%{name}
233 %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default
234 %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default-with-mounting
235 %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default-with-nesting
236 %config %{_sysconfdir}/apparmor.d/usr.bin.%{name}-start
237 %endif
238 %{_mandir}/man1/lxc*
239 %{_mandir}/man5/lxc*
240 %{_mandir}/man7/lxc*
241 # not openSUSE/SUSE
242 %if %{undefined suse_version}
243 %{_mandir}/ja/man1/lxc*
244 %{_mandir}/ja/man5/lxc*
245 %{_mandir}/ja/man7/lxc*
246 %endif
247 %{_datadir}/doc/*
248 %{_datadir}/lxc/*
249 %{_sysconfdir}/bash_completion.d
250 %{_sysconfdir}/sysconfig/*
251 %config(noreplace) %{_sysconfdir}/lxc/*
252 %config(noreplace) %{_sysconfdir}/sysconfig/*
253
254 %if %{with_systemd}
255 %{_unitdir}/lxc-net.service
256 %{_unitdir}/lxc.service
257 %else
258 %{_sysconfdir}/rc.d/init.d/lxc
259 %{_sysconfdir}/rc.d/init.d/lxc-net
260 %endif
261
262 %files libs
263 %defattr(-,root,root)
264 %{_sbindir}/*
265 %{_libdir}/*.so.*
266 %{_libdir}/%{name}
267 %if %{with_python}
268 %{_libdir}/python*
269 %endif
270 %{_localstatedir}/*
271 %{_libexecdir}/%{name}
272 %attr(4111,root,root) %{_libexecdir}/%{name}/lxc-user-nic
273 %if %{with_systemd}
274 %attr(555,root,root) %{_libexecdir}/%{name}/lxc-devsetup
275 %attr(555,root,root) %{_libexecdir}/%{name}/lxc-net
276 %attr(555,root,root) %{_libexecdir}/%{name}/lxc-containers
277 %endif
278
279 %if %{with_python}
280 %{_libdir}/python3.3/site-packages/_lxc*
281 %{_libdir}/python3.3/site-packages/lxc/*
282 %endif
283
284 %if %{with_lua}
285 %files lua
286 %defattr(-,root,root)
287 %{_datadir}/lua
288 %{_libdir}/lua
289 %endif
290
291 %files devel
292 %defattr(-,root,root)
293 %{_includedir}/%{name}/*
294 %{_libdir}/*.so
295 %{_libdir}/pkgconfig/*
296
297 %changelog
298 * Tue Oct 22 2013 Dwight Engen <dwight.engen@oracle.com> - 1.0.0-0.1.alpha2
299 - fix some rpmlint warnings/errors
300 - split lua bits into separate package
301
302 * Mon Sep 10 2012 Dwight Engen <dwight.engen@oracle.com> - 0.8.0
303 - fix lxc-init moved to libexec
304 - .pc moved to _libdir
305 - package template files /usr/share/lxc/templates
306
307 * Thu Sep 8 2011 Greg Kurz <gkurz@fr.ibm.com> - 0.7.5.1
308 - fix installed files for rpmbuild
309 - introduce lxc-libs package
310
311 * Fri Jul 23 2010 Daniel Lezcano <dlezcano@fr.ibm.com> - 0.7.2
312 - set attribute for installed files
313 - fix libraries installation
314
315 * Tue Mar 24 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.1
316 - Removed capability setting, let the user to do that through "lxc-setcap"
317
318 * Mon Feb 16 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.0
319 - Added more capabilities to the executables
320
321 * Sun Jan 25 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.0
322 - Reduced spec file
323
324 * Sun Aug 3 2008 Daniel Lezcano <dlezcano@fr.ibm.com> - 0.1.0
325 - Initial RPM release.
326
327 # Local variables:
328 # mode: shell-script
329 # sh-shell: rpm
330 # end: