]>
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 | |
420dfb59 DE |
23 | # Set with_systemd on distros that use it, so we can install the service |
24 | # file, otherwise the sysvinit script will be installed | |
25 | %if 0%{?fedora} >= 14 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1210 | |
26 | %global with_systemd 1 | |
27 | %define init_script systemd | |
0af99319 MW |
28 | # |
29 | # BuildRequires systemd-units on fedora and rhel | |
30 | %if 0%{?fedora} >= 14 || 0%{?rhel} >= 7 | |
420dfb59 | 31 | BuildRequires: systemd-units |
723e380b | 32 | %endif |
0af99319 MW |
33 | # |
34 | # BuildRequires systemd on openSUSE and SUSE | |
0af99319 MW |
35 | %if 0%{?suse_version} >= 1210 |
36 | BuildRequires: systemd | |
37 | %endif | |
420dfb59 DE |
38 | %else |
39 | %global with_systemd 0 | |
dc068290 | 40 | %define init_script sysvinit |
420dfb59 DE |
41 | %endif |
42 | ||
fce070c8 DE |
43 | # Must use /var/run for runtime_path on older releases or dnsmasq in the |
44 | # lxc-net script will not be able to write its pid in /run (selinux denial) | |
45 | %if 0%{?fedora} < 15 || 0%{?rhel} < 7 | |
46 | %define _with_runtime_path --with-runtime-path=/var/run | |
47 | %endif | |
48 | ||
9588a6ce SH |
49 | # RPM needs alpha/beta/rc in Release: not Version: to ensure smooth |
50 | # package upgrades from alpha->beta->rc->release. For more info see: | |
51 | # http://fedoraproject.org/wiki/Packaging%3aNamingGuidelines#NonNumericRelease | |
52 | %if "x@LXC_VERSION_BETA@" != "x" | |
53 | %global beta_rel @LXC_VERSION_BETA@ | |
54 | %global beta_dot .%{beta_rel} | |
55 | %else | |
56 | %global norm_rel 1 | |
57 | %endif | |
58 | ||
5e97c3fc | 59 | Name: @PACKAGE@ |
9588a6ce SH |
60 | Version: @LXC_VERSION_BASE@ |
61 | Release: %{?beta_rel:0.1.%{beta_rel}}%{?!beta_rel:%{norm_rel}}%{?dist} | |
07520b2a | 62 | URL: http://linuxcontainers.org |
9588a6ce | 63 | Source: http://linuxcontainers.org/downloads/%{name}-%{version}%{?beta_dot}.tar.gz |
0adde0f8 | 64 | Summary: Linux Containers userspace tools |
5e97c3fc | 65 | Group: Applications/System |
0adde0f8 | 66 | License: LGPLv2+ |
cef07149 | 67 | BuildRoot: %{_tmppath}/%{name}-%{version}-build |
fce070c8 | 68 | Requires: openssl rsync dnsmasq bridge-utils |
1f3fc0d7 | 69 | Requires: %{name}-libs = %{version}-%{release} |
fce070c8 DE |
70 | Requires(pre): /usr/sbin/useradd |
71 | Requires(postun): /usr/sbin/userdel | |
72 | %if 0%{?fedora} < 15 || 0%{?rhel} < 7 | |
73 | Requires: libcgroup | |
74 | %endif | |
0af99319 MW |
75 | # Note for Suse. The "docbook2X" BuildRequires does properly |
76 | # match docbook2x on Suse in a case insensitive manner | |
77 | BuildRequires: libcap libcap-devel docbook2X graphviz libxslt pkgconfig | |
78 | ||
79 | # | |
80 | # Additional packages for openSUSE and SUSE | |
81 | # | |
82 | %if 0%{?suse_version} >= 1210 | |
83 | PreReq: permissions | |
84 | BuildRequires: libapparmor-devel linux-glibc-devel lsb-release docbook-utils | |
85 | ||
86 | # | |
87 | # libseccomp-devel only needed on i386/i586/i686 and X86_64 | |
88 | # | |
89 | %ifarch %ix86 x86_64 | |
90 | BuildRequires: libseccomp-devel | |
91 | %endif | |
92 | %endif | |
5e97c3fc | 93 | |
a8eed52c | 94 | # |
95 | # Additional package for Tizen | |
96 | # | |
97 | %if %{defined tizen_version} | |
98 | BuildRequires: pkgconfig(dlog) | |
99 | %endif | |
100 | ||
5e97c3fc | 101 | %description |
0adde0f8 | 102 | Containers are insulated areas inside a system, which have their own namespace |
f7f1ba77 SG |
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 | |
0adde0f8 DE |
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 | |
1c41ddcb GK |
115 | The %{name}-libs package contains libraries for running %{name} applications. |
116 | ||
0adde0f8 DE |
117 | %package devel |
118 | Summary: Development library for %{name} | |
119 | Group: Development/Libraries | |
120 | Requires: %{name} = %{version}-%{release}, pkgconfig | |
121 | %description devel | |
805415fc | 122 | The %{name}-devel package contains header files and library needed for |
0adde0f8 DE |
123 | development of the Linux containers. |
124 | ||
5e97c3fc | 125 | %prep |
9588a6ce | 126 | %setup -q -n %{name}-%{version}%{?beta_dot} |
5e97c3fc | 127 | %build |
a8a6c2c6 | 128 | |
129 | #Dont use pkgconfig to get bash completion dir and use backwards compatible location. | |
130 | export bashcompdir=%{_sysconfdir}/bash_completion.d | |
131 | ||
ce951132 | 132 | PATH=$PATH:/usr/sbin:/sbin %configure $args \ |
0af99319 MW |
133 | %if "x%{_unitdir}" != "x" |
134 | --with-systemdsystemunitdir=%{_unitdir} \ | |
ce951132 | 135 | %endif |
fce070c8 | 136 | %{?_with_runtime_path} \ |
420dfb59 DE |
137 | --disable-rpath \ |
138 | --with-init-script=%{init_script} | |
cef07149 | 139 | make %{?_smp_mflags} |
5e97c3fc | 140 | |
141 | %install | |
b9cb4325 DE |
142 | rm -rf %{buildroot} |
143 | make install DESTDIR=%{buildroot} | |
144 | find %{buildroot} -type f -name '*.la' -exec rm -f {} ';' | |
805415fc | 145 | |
5e97c3fc | 146 | %clean |
147 | rm -rf %{buildroot} | |
148 | ||
0af99319 | 149 | %pre |
fce070c8 | 150 | # Ensure that lxc-dnsmasq uid & gid gets correctly allocated |
0af99319 MW |
151 | if getent passwd lxc-dnsmasq >/dev/null 2>&1 ; then : ; else \ |
152 | /usr/sbin/useradd -M -r -s /sbin/nologin \ | |
153 | -c "LXC Networking Service" -d %_localstatedir/%name lxc-dnsmasq 2> /dev/null \ | |
154 | || exit 1 | |
155 | fi | |
156 | ||
cef07149 | 157 | %post |
0af99319 | 158 | # This test should trigger a network configure on a new install. |
3b159041 | 159 | if [ ! -d @LXC_DISTRO_SYSCONF@ ] |
160 | then | |
161 | mkdir -p @LXC_DISTRO_SYSCONF@ | |
162 | fi | |
163 | ||
cd27b6c8 | 164 | if [ ! -f @LXC_DISTRO_SYSCONF@/lxc-net ] || ! grep -q 'USE_LXC_BRIDGE=' @LXC_DISTRO_SYSCONF@/lxc-net |
0af99319 MW |
165 | then |
166 | # Grab a random 10net subnet. Need to add test logic... | |
167 | while [ true ] | |
168 | do | |
169 | SUBNET=10.$(($RANDOM % 256)).$(($RANDOM % 256)) | |
170 | if ! ip -4 route ls | grep -q "^$SUBNET" | |
171 | then | |
172 | break | |
173 | fi | |
174 | done | |
175 | ||
cd27b6c8 | 176 | cat > @LXC_DISTRO_SYSCONF@/lxc-net <<EOF |
0af99319 MW |
177 | # Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your |
178 | # containers. Set to "false" if you'll use virbr0 or another existing | |
e8202121 | 179 | # bridge, or macvlan to your host's NIC. |
0af99319 MW |
180 | USE_LXC_BRIDGE="true" |
181 | ||
182 | # If you change the LXC_BRIDGE to something other than lxcbr0, then | |
183 | # you will also need to update your /etc/lxc/default.conf as well as the | |
184 | # configuration (/var/lib/lxc/<container>/config) for any containers | |
185 | # already created using the default config to reflect the new bridge | |
186 | # name. | |
187 | # If you have the dnsmasq daemon installed, you'll also have to update | |
188 | # /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon. | |
189 | LXC_BRIDGE="lxcbr0" | |
84432621 | 190 | LXC_BRIDGE_MAC="00:16:3e:00:00:00" |
0af99319 MW |
191 | LXC_ADDR="$SUBNET.1" |
192 | LXC_NETMASK="255.255.255.0" | |
193 | LXC_NETWORK="$SUBNET.0/24" | |
194 | LXC_DHCP_RANGE="$SUBNET.2,$SUBNET.254" | |
195 | LXC_DHCP_MAX="253" | |
196 | # Uncomment the next line if you'd like to use a conf-file for the lxcbr0 | |
197 | # dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have | |
198 | # container 'mail1' always get ip address 10.0.3.100. | |
199 | #LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf | |
200 | ||
7f4386f0 PCG |
201 | # Whether to use nftables (if available) to configure required network rules. |
202 | # Set to any value != "true" to force iptables backend instead. | |
203 | LXC_USE_NFT="true" | |
204 | ||
0af99319 MW |
205 | # Uncomment the next line if you want lxcbr0's dnsmasq to resolve the .lxc |
206 | # domain. You can then add "server=/lxc/10.0.3.1' (or your actual $LXC_ADDR) | |
207 | # to /etc/dnsmasq.conf, after which 'container1.lxc' will resolve on your | |
208 | # host. | |
209 | #LXC_DOMAIN="lxc" | |
210 | EOF | |
211 | fi | |
212 | ||
fce070c8 DE |
213 | %postun |
214 | /usr/sbin/userdel lxc-dnsmasq > /dev/null 2>&1 || : | |
215 | ||
0adde0f8 DE |
216 | %post libs -p /sbin/ldconfig |
217 | %postun libs -p /sbin/ldconfig | |
805415fc | 218 | |
5e97c3fc | 219 | %files |
220 | %defattr(-,root,root) | |
5e97c3fc | 221 | %{_bindir}/* |
0af99319 MW |
222 | # openSUSE/SUSE |
223 | %if 0%{?suse_version} >= 1210 | |
224 | %dir %{_sysconfdir}/apparmor.d | |
225 | %dir %{_sysconfdir}/apparmor.d/abstractions | |
226 | %dir %{_sysconfdir}/apparmor.d/abstractions/%{name} | |
227 | %config %{_sysconfdir}/apparmor.d/abstractions/%{name}/container-base | |
228 | %config %{_sysconfdir}/apparmor.d/abstractions/%{name}/start-container | |
229 | %config %{_sysconfdir}/apparmor.d/%{name}-containers | |
230 | %dir %{_sysconfdir}/apparmor.d/%{name} | |
231 | %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default | |
232 | %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default-with-mounting | |
233 | %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default-with-nesting | |
234 | %config %{_sysconfdir}/apparmor.d/usr.bin.%{name}-start | |
235 | %endif | |
0adde0f8 DE |
236 | %{_mandir}/man1/lxc* |
237 | %{_mandir}/man5/lxc* | |
238 | %{_mandir}/man7/lxc* | |
0af99319 MW |
239 | # not openSUSE/SUSE |
240 | %if %{undefined suse_version} | |
0adde0f8 DE |
241 | %{_mandir}/ja/man1/lxc* |
242 | %{_mandir}/ja/man5/lxc* | |
243 | %{_mandir}/ja/man7/lxc* | |
2b371b26 SY |
244 | %{_mandir}/ko/man1/lxc* |
245 | %{_mandir}/ko/man5/lxc* | |
246 | %{_mandir}/ko/man7/lxc* | |
0af99319 | 247 | %endif |
411c76ce | 248 | %{_datadir}/doc/* |
b9cb4325 | 249 | %{_datadir}/lxc/* |
e0f2f5c7 | 250 | %{_sysconfdir}/bash_completion.d |
0adde0f8 | 251 | %config(noreplace) %{_sysconfdir}/lxc/* |
0af99319 | 252 | %config(noreplace) %{_sysconfdir}/sysconfig/* |
5e97c3fc | 253 | |
420dfb59 | 254 | %if %{with_systemd} |
0af99319 | 255 | %{_unitdir}/lxc-net.service |
420dfb59 | 256 | %{_unitdir}/lxc.service |
bc395756 | 257 | %{_unitdir}/lxc@.service |
b6278254 | 258 | %{_unitdir}/lxc-monitord.service |
420dfb59 DE |
259 | %else |
260 | %{_sysconfdir}/rc.d/init.d/lxc | |
0af99319 | 261 | %{_sysconfdir}/rc.d/init.d/lxc-net |
420dfb59 | 262 | %endif |
87ff951e | 263 | |
1c41ddcb GK |
264 | %files libs |
265 | %defattr(-,root,root) | |
ba5783a5 | 266 | %{_sbindir}/* |
1c41ddcb | 267 | %{_libdir}/*.so.* |
7701a78d | 268 | %{_libdir}/*.a |
1c41ddcb | 269 | %{_libdir}/%{name} |
7323456e | 270 | %{_localstatedir}/* |
bc395756 EG |
271 | %{_libexecdir}/%{name}/hooks/unmount-namespace |
272 | %{_libexecdir}/%{name}/lxc-apparmor-load | |
273 | %{_libexecdir}/%{name}/lxc-monitord | |
45e854dc | 274 | %attr(4111,root,root) %{_libexecdir}/%{name}/lxc-user-nic |
420dfb59 | 275 | %if %{with_systemd} |
0af99319 MW |
276 | %attr(555,root,root) %{_libexecdir}/%{name}/lxc-net |
277 | %attr(555,root,root) %{_libexecdir}/%{name}/lxc-containers | |
420dfb59 | 278 | %endif |
1c41ddcb | 279 | |
5e97c3fc | 280 | %files devel |
281 | %defattr(-,root,root) | |
282 | %{_includedir}/%{name}/* | |
1c41ddcb | 283 | %{_libdir}/*.so |
b9cb4325 | 284 | %{_libdir}/pkgconfig/* |
5e97c3fc | 285 | |
286 | %changelog | |
0adde0f8 DE |
287 | * Tue Oct 22 2013 Dwight Engen <dwight.engen@oracle.com> - 1.0.0-0.1.alpha2 |
288 | - fix some rpmlint warnings/errors | |
ec64264d | 289 | - split lua bits into separate package |
0adde0f8 DE |
290 | |
291 | * Mon Sep 10 2012 Dwight Engen <dwight.engen@oracle.com> - 0.8.0 | |
b9cb4325 DE |
292 | - fix lxc-init moved to libexec |
293 | - .pc moved to _libdir | |
294 | - package template files /usr/share/lxc/templates | |
295 | ||
0adde0f8 | 296 | * Thu Sep 8 2011 Greg Kurz <gkurz@fr.ibm.com> - 0.7.5.1 |
1c41ddcb GK |
297 | - fix installed files for rpmbuild |
298 | - introduce lxc-libs package | |
b4915399 | 299 | |
0adde0f8 | 300 | * Fri Jul 23 2010 Daniel Lezcano <dlezcano@fr.ibm.com> - 0.7.2 |
7ef6e440 DL |
301 | - set attribute for installed files |
302 | - fix libraries installation | |
7ef6e440 | 303 | |
7920b1b4 | 304 | * Tue Mar 24 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.1 |
237315ff DL |
305 | - Removed capability setting, let the user to do that through "lxc-setcap" |
306 | ||
0adde0f8 | 307 | * Mon Feb 16 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.0 |
44931bc7 | 308 | - Added more capabilities to the executables |
309 | ||
0adde0f8 | 310 | * Sun Jan 25 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.0 |
cef07149 | 311 | - Reduced spec file |
312 | ||
0adde0f8 | 313 | * Sun Aug 3 2008 Daniel Lezcano <dlezcano@fr.ibm.com> - 0.1.0 |
5e97c3fc | 314 | - Initial RPM release. |
315 | ||
316 | # Local variables: | |
317 | # mode: shell-script | |
318 | # sh-shell: rpm | |
319 | # end: |