]>
Commit | Line | Data |
---|---|---|
5e97c3fc | 1 | # |
2 | # lxc: linux Container library | |
3 | # | |
4 | # (C) Copyright IBM Corp. 2007, 2008 | |
5 | # | |
6 | # Authors: | |
9afe19d6 | 7 | # Daniel Lezcano <daniel.lezcano at free.fr> |
5e97c3fc | 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 | |
250b1eec | 21 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
5e97c3fc | 22 | |
0adde0f8 DE |
23 | %global with_python %{?_with_python: 1} %{?!_with_python: 0} |
24 | %global with_lua %{?_with_lua: 1} %{?!_with_lua: 0} | |
25 | ||
420dfb59 DE |
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 | |
0af99319 MW |
31 | # |
32 | # BuildRequires systemd-units on fedora and rhel | |
33 | %if 0%{?fedora} >= 14 || 0%{?rhel} >= 7 | |
420dfb59 | 34 | BuildRequires: systemd-units |
0af99319 MW |
35 | # |
36 | # BuildRequires systemd on openSUSE and SUSE | |
37 | %endif | |
38 | %if 0%{?suse_version} >= 1210 | |
39 | BuildRequires: systemd | |
40 | %endif | |
420dfb59 DE |
41 | %else |
42 | %global with_systemd 0 | |
dc068290 | 43 | %define init_script sysvinit |
420dfb59 DE |
44 | %endif |
45 | ||
fce070c8 DE |
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 | ||
9588a6ce SH |
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 | ||
5e97c3fc | 62 | Name: @PACKAGE@ |
9588a6ce SH |
63 | Version: @LXC_VERSION_BASE@ |
64 | Release: %{?beta_rel:0.1.%{beta_rel}}%{?!beta_rel:%{norm_rel}}%{?dist} | |
07520b2a | 65 | URL: http://linuxcontainers.org |
9588a6ce | 66 | Source: http://linuxcontainers.org/downloads/%{name}-%{version}%{?beta_dot}.tar.gz |
0adde0f8 | 67 | Summary: Linux Containers userspace tools |
5e97c3fc | 68 | Group: Applications/System |
0adde0f8 | 69 | License: LGPLv2+ |
cef07149 | 70 | BuildRoot: %{_tmppath}/%{name}-%{version}-build |
fce070c8 | 71 | Requires: openssl rsync dnsmasq bridge-utils |
1f3fc0d7 | 72 | Requires: %{name}-libs = %{version}-%{release} |
fce070c8 DE |
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 | |
0af99319 MW |
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 | |
5e97c3fc | 96 | |
ce951132 DE |
97 | %if %{with_python} |
98 | Requires: python3 | |
99 | BuildRequires: python3-devel | |
100 | %endif | |
101 | ||
5e97c3fc | 102 | %description |
0adde0f8 | 103 | Containers are insulated areas inside a system, which have their own namespace |
f7f1ba77 SG |
104 | for filesystem, network, PID, IPC, CPU and memory allocation and which can be |
105 | created using the Control Group and Namespace features included in the Linux | |
0adde0f8 DE |
106 | kernel. |
107 | ||
108 | This package provides the lxc-* tools, which can be used to start a single | |
109 | daemon in a container, or to boot an entire "containerized" system, and to | |
110 | manage and debug your containers. | |
111 | ||
112 | %package libs | |
113 | Summary: Shared library files for %{name} | |
114 | Group: System Environment/Libraries | |
115 | %description libs | |
1c41ddcb GK |
116 | The %{name}-libs package contains libraries for running %{name} applications. |
117 | ||
0adde0f8 DE |
118 | %package devel |
119 | Summary: Development library for %{name} | |
120 | Group: Development/Libraries | |
121 | Requires: %{name} = %{version}-%{release}, pkgconfig | |
122 | %description devel | |
805415fc | 123 | The %{name}-devel package contains header files and library needed for |
0adde0f8 DE |
124 | development of the Linux containers. |
125 | ||
126 | %if %{with_lua} | |
127 | %package lua | |
128 | Summary: Lua bindings for %{name} | |
129 | Group: System Environment/Libraries | |
9f2fd74c | 130 | Requires: lua-filesystem lua-alt-getopt |
0adde0f8 DE |
131 | BuildRequires: lua-devel |
132 | %description lua | |
133 | The %{name}-lua package contains %{name} bindings for lua. | |
134 | %endif | |
5e97c3fc | 135 | |
136 | %prep | |
9588a6ce | 137 | %setup -q -n %{name}-%{version}%{?beta_dot} |
5e97c3fc | 138 | %build |
ce951132 | 139 | PATH=$PATH:/usr/sbin:/sbin %configure $args \ |
f080ffd7 DE |
140 | %if %{with_lua} |
141 | --enable-lua \ | |
142 | %endif | |
ce951132 DE |
143 | %if %{with_python} |
144 | --enable-python \ | |
0af99319 MW |
145 | %endif |
146 | %if "x%{_unitdir}" != "x" | |
147 | --with-systemdsystemunitdir=%{_unitdir} \ | |
ce951132 | 148 | %endif |
fce070c8 | 149 | %{?_with_runtime_path} \ |
420dfb59 DE |
150 | --disable-rpath \ |
151 | --with-init-script=%{init_script} | |
cef07149 | 152 | make %{?_smp_mflags} |
5e97c3fc | 153 | |
154 | %install | |
b9cb4325 DE |
155 | rm -rf %{buildroot} |
156 | make install DESTDIR=%{buildroot} | |
157 | find %{buildroot} -type f -name '*.la' -exec rm -f {} ';' | |
805415fc | 158 | |
5e97c3fc | 159 | %clean |
160 | rm -rf %{buildroot} | |
161 | ||
0af99319 | 162 | %pre |
fce070c8 | 163 | # Ensure that lxc-dnsmasq uid & gid gets correctly allocated |
0af99319 MW |
164 | if getent passwd lxc-dnsmasq >/dev/null 2>&1 ; then : ; else \ |
165 | /usr/sbin/useradd -M -r -s /sbin/nologin \ | |
166 | -c "LXC Networking Service" -d %_localstatedir/%name lxc-dnsmasq 2> /dev/null \ | |
167 | || exit 1 | |
168 | fi | |
169 | ||
cef07149 | 170 | %post |
0af99319 MW |
171 | # This test should trigger a network configure on a new install. |
172 | if [ ! -f %{_sysconfdir}/sysconfig/lxc-net ] || ! grep -q 'USE_LXC_BRIDGE=' %{_sysconfdir}/sysconfig/lxc-net | |
173 | then | |
174 | # Grab a random 10net subnet. Need to add test logic... | |
175 | while [ true ] | |
176 | do | |
177 | SUBNET=10.$(($RANDOM % 256)).$(($RANDOM % 256)) | |
178 | if ! ip -4 route ls | grep -q "^$SUBNET" | |
179 | then | |
180 | break | |
181 | fi | |
182 | done | |
183 | ||
184 | cat > %{_sysconfdir}/sysconfig/lxc-net <<EOF | |
185 | # Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your | |
186 | # containers. Set to "false" if you'll use virbr0 or another existing | |
187 | # bridge, or mavlan to your host's NIC. | |
188 | USE_LXC_BRIDGE="true" | |
189 | ||
190 | # If you change the LXC_BRIDGE to something other than lxcbr0, then | |
191 | # you will also need to update your /etc/lxc/default.conf as well as the | |
192 | # configuration (/var/lib/lxc/<container>/config) for any containers | |
193 | # already created using the default config to reflect the new bridge | |
194 | # name. | |
195 | # If you have the dnsmasq daemon installed, you'll also have to update | |
196 | # /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon. | |
197 | LXC_BRIDGE="lxcbr0" | |
198 | LXC_ADDR="$SUBNET.1" | |
199 | LXC_NETMASK="255.255.255.0" | |
200 | LXC_NETWORK="$SUBNET.0/24" | |
201 | LXC_DHCP_RANGE="$SUBNET.2,$SUBNET.254" | |
202 | LXC_DHCP_MAX="253" | |
203 | # Uncomment the next line if you'd like to use a conf-file for the lxcbr0 | |
204 | # dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have | |
205 | # container 'mail1' always get ip address 10.0.3.100. | |
206 | #LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf | |
207 | ||
208 | # Uncomment the next line if you want lxcbr0's dnsmasq to resolve the .lxc | |
209 | # domain. You can then add "server=/lxc/10.0.3.1' (or your actual $LXC_ADDR) | |
210 | # to /etc/dnsmasq.conf, after which 'container1.lxc' will resolve on your | |
211 | # host. | |
212 | #LXC_DOMAIN="lxc" | |
213 | EOF | |
214 | fi | |
215 | ||
fce070c8 DE |
216 | %postun |
217 | /usr/sbin/userdel lxc-dnsmasq > /dev/null 2>&1 || : | |
218 | ||
0adde0f8 DE |
219 | %post libs -p /sbin/ldconfig |
220 | %postun libs -p /sbin/ldconfig | |
805415fc | 221 | |
5e97c3fc | 222 | %files |
223 | %defattr(-,root,root) | |
5e97c3fc | 224 | %{_bindir}/* |
0af99319 MW |
225 | # openSUSE/SUSE |
226 | %if 0%{?suse_version} >= 1210 | |
227 | %dir %{_sysconfdir}/apparmor.d | |
228 | %dir %{_sysconfdir}/apparmor.d/abstractions | |
229 | %dir %{_sysconfdir}/apparmor.d/abstractions/%{name} | |
230 | %config %{_sysconfdir}/apparmor.d/abstractions/%{name}/container-base | |
231 | %config %{_sysconfdir}/apparmor.d/abstractions/%{name}/start-container | |
232 | %config %{_sysconfdir}/apparmor.d/%{name}-containers | |
233 | %dir %{_sysconfdir}/apparmor.d/%{name} | |
234 | %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default | |
235 | %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default-with-mounting | |
236 | %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default-with-nesting | |
237 | %config %{_sysconfdir}/apparmor.d/usr.bin.%{name}-start | |
238 | %endif | |
0adde0f8 DE |
239 | %{_mandir}/man1/lxc* |
240 | %{_mandir}/man5/lxc* | |
241 | %{_mandir}/man7/lxc* | |
0af99319 MW |
242 | # not openSUSE/SUSE |
243 | %if %{undefined suse_version} | |
0adde0f8 DE |
244 | %{_mandir}/ja/man1/lxc* |
245 | %{_mandir}/ja/man5/lxc* | |
246 | %{_mandir}/ja/man7/lxc* | |
2b371b26 SY |
247 | %{_mandir}/ko/man1/lxc* |
248 | %{_mandir}/ko/man5/lxc* | |
249 | %{_mandir}/ko/man7/lxc* | |
0af99319 | 250 | %endif |
411c76ce | 251 | %{_datadir}/doc/* |
b9cb4325 | 252 | %{_datadir}/lxc/* |
e0f2f5c7 | 253 | %{_sysconfdir}/bash_completion.d |
0af99319 | 254 | %{_sysconfdir}/sysconfig/* |
0adde0f8 | 255 | %config(noreplace) %{_sysconfdir}/lxc/* |
0af99319 | 256 | %config(noreplace) %{_sysconfdir}/sysconfig/* |
5e97c3fc | 257 | |
420dfb59 | 258 | %if %{with_systemd} |
0af99319 | 259 | %{_unitdir}/lxc-net.service |
420dfb59 DE |
260 | %{_unitdir}/lxc.service |
261 | %else | |
262 | %{_sysconfdir}/rc.d/init.d/lxc | |
0af99319 | 263 | %{_sysconfdir}/rc.d/init.d/lxc-net |
420dfb59 | 264 | %endif |
87ff951e | 265 | |
1c41ddcb GK |
266 | %files libs |
267 | %defattr(-,root,root) | |
ba5783a5 | 268 | %{_sbindir}/* |
1c41ddcb GK |
269 | %{_libdir}/*.so.* |
270 | %{_libdir}/%{name} | |
ce951132 DE |
271 | %if %{with_python} |
272 | %{_libdir}/python* | |
273 | %endif | |
7323456e | 274 | %{_localstatedir}/* |
e0f2f5c7 | 275 | %{_libexecdir}/%{name} |
45e854dc | 276 | %attr(4111,root,root) %{_libexecdir}/%{name}/lxc-user-nic |
420dfb59 | 277 | %if %{with_systemd} |
87ff951e | 278 | %attr(555,root,root) %{_libexecdir}/%{name}/lxc-devsetup |
0af99319 MW |
279 | %attr(555,root,root) %{_libexecdir}/%{name}/lxc-net |
280 | %attr(555,root,root) %{_libexecdir}/%{name}/lxc-containers | |
420dfb59 | 281 | %endif |
1c41ddcb | 282 | |
58d6a17e MW |
283 | %if %{with_python} |
284 | %{_libdir}/python3.3/site-packages/_lxc* | |
285 | %{_libdir}/python3.3/site-packages/lxc/* | |
286 | %endif | |
287 | ||
0adde0f8 DE |
288 | %if %{with_lua} |
289 | %files lua | |
290 | %defattr(-,root,root) | |
291 | %{_datadir}/lua | |
292 | %{_libdir}/lua | |
293 | %endif | |
294 | ||
5e97c3fc | 295 | %files devel |
296 | %defattr(-,root,root) | |
297 | %{_includedir}/%{name}/* | |
1c41ddcb | 298 | %{_libdir}/*.so |
b9cb4325 | 299 | %{_libdir}/pkgconfig/* |
5e97c3fc | 300 | |
301 | %changelog | |
0adde0f8 DE |
302 | * Tue Oct 22 2013 Dwight Engen <dwight.engen@oracle.com> - 1.0.0-0.1.alpha2 |
303 | - fix some rpmlint warnings/errors | |
ec64264d | 304 | - split lua bits into separate package |
0adde0f8 DE |
305 | |
306 | * Mon Sep 10 2012 Dwight Engen <dwight.engen@oracle.com> - 0.8.0 | |
b9cb4325 DE |
307 | - fix lxc-init moved to libexec |
308 | - .pc moved to _libdir | |
309 | - package template files /usr/share/lxc/templates | |
310 | ||
0adde0f8 | 311 | * Thu Sep 8 2011 Greg Kurz <gkurz@fr.ibm.com> - 0.7.5.1 |
1c41ddcb GK |
312 | - fix installed files for rpmbuild |
313 | - introduce lxc-libs package | |
b4915399 | 314 | |
0adde0f8 | 315 | * Fri Jul 23 2010 Daniel Lezcano <dlezcano@fr.ibm.com> - 0.7.2 |
7ef6e440 DL |
316 | - set attribute for installed files |
317 | - fix libraries installation | |
7ef6e440 | 318 | |
7920b1b4 | 319 | * Tue Mar 24 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.1 |
237315ff DL |
320 | - Removed capability setting, let the user to do that through "lxc-setcap" |
321 | ||
0adde0f8 | 322 | * Mon Feb 16 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.0 |
44931bc7 | 323 | - Added more capabilities to the executables |
324 | ||
0adde0f8 | 325 | * Sun Jan 25 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.0 |
cef07149 | 326 | - Reduced spec file |
327 | ||
0adde0f8 | 328 | * Sun Aug 3 2008 Daniel Lezcano <dlezcano@fr.ibm.com> - 0.1.0 |
5e97c3fc | 329 | - Initial RPM release. |
330 | ||
331 | # Local variables: | |
332 | # mode: shell-script | |
333 | # sh-shell: rpm | |
334 | # end: |