]> git.proxmox.com Git - mirror_lxc.git/blob - lxc.spec.in
file_utils: fix too wide or inconsistent non-owner permissions
[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 # 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
28 #
29 # BuildRequires systemd-units on fedora and rhel
30 %if 0%{?fedora} >= 14 || 0%{?rhel} >= 7
31 BuildRequires: systemd-units
32 %endif
33 #
34 # BuildRequires systemd on openSUSE and SUSE
35 %if 0%{?suse_version} >= 1210
36 BuildRequires: systemd
37 %endif
38 %else
39 %global with_systemd 0
40 %define init_script sysvinit
41 %endif
42
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
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
59 Name: @PACKAGE@
60 Version: @LXC_VERSION_BASE@
61 Release: %{?beta_rel:0.1.%{beta_rel}}%{?!beta_rel:%{norm_rel}}%{?dist}
62 URL: http://linuxcontainers.org
63 Source: http://linuxcontainers.org/downloads/%{name}-%{version}%{?beta_dot}.tar.gz
64 Summary: Linux Containers userspace tools
65 Group: Applications/System
66 License: LGPLv2+
67 BuildRoot: %{_tmppath}/%{name}-%{version}-build
68 Requires: openssl rsync dnsmasq bridge-utils
69 Requires: %{name}-libs = %{version}-%{release}
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
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
93
94 #
95 # Additional package for Tizen
96 #
97 %if %{defined tizen_version}
98 BuildRequires: pkgconfig(dlog)
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 %prep
126 %setup -q -n %{name}-%{version}%{?beta_dot}
127 %build
128 PATH=$PATH:/usr/sbin:/sbin %configure $args \
129 %if "x%{_unitdir}" != "x"
130 --with-systemdsystemunitdir=%{_unitdir} \
131 %endif
132 %{?_with_runtime_path} \
133 --disable-rpath \
134 --with-init-script=%{init_script}
135 make %{?_smp_mflags}
136
137 %install
138 rm -rf %{buildroot}
139 make install DESTDIR=%{buildroot}
140 find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
141
142 %clean
143 rm -rf %{buildroot}
144
145 %pre
146 # Ensure that lxc-dnsmasq uid & gid gets correctly allocated
147 if getent passwd lxc-dnsmasq >/dev/null 2>&1 ; then : ; else \
148 /usr/sbin/useradd -M -r -s /sbin/nologin \
149 -c "LXC Networking Service" -d %_localstatedir/%name lxc-dnsmasq 2> /dev/null \
150 || exit 1
151 fi
152
153 %post
154 # This test should trigger a network configure on a new install.
155 if [ ! -f @LXC_DISTRO_SYSCONF@/lxc-net ] || ! grep -q 'USE_LXC_BRIDGE=' @LXC_DISTRO_SYSCONF@/lxc-net
156 then
157 # Grab a random 10net subnet. Need to add test logic...
158 while [ true ]
159 do
160 SUBNET=10.$(($RANDOM % 256)).$(($RANDOM % 256))
161 if ! ip -4 route ls | grep -q "^$SUBNET"
162 then
163 break
164 fi
165 done
166
167 cat > @LXC_DISTRO_SYSCONF@/lxc-net <<EOF
168 # Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your
169 # containers. Set to "false" if you'll use virbr0 or another existing
170 # bridge, or macvlan to your host's NIC.
171 USE_LXC_BRIDGE="true"
172
173 # If you change the LXC_BRIDGE to something other than lxcbr0, then
174 # you will also need to update your /etc/lxc/default.conf as well as the
175 # configuration (/var/lib/lxc/<container>/config) for any containers
176 # already created using the default config to reflect the new bridge
177 # name.
178 # If you have the dnsmasq daemon installed, you'll also have to update
179 # /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon.
180 LXC_BRIDGE="lxcbr0"
181 LXC_BRIDGE_MAC="00:16:3e:00:00:00"
182 LXC_ADDR="$SUBNET.1"
183 LXC_NETMASK="255.255.255.0"
184 LXC_NETWORK="$SUBNET.0/24"
185 LXC_DHCP_RANGE="$SUBNET.2,$SUBNET.254"
186 LXC_DHCP_MAX="253"
187 # Uncomment the next line if you'd like to use a conf-file for the lxcbr0
188 # dnsmasq. For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have
189 # container 'mail1' always get ip address 10.0.3.100.
190 #LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf
191
192 # Uncomment the next line if you want lxcbr0's dnsmasq to resolve the .lxc
193 # domain. You can then add "server=/lxc/10.0.3.1' (or your actual $LXC_ADDR)
194 # to /etc/dnsmasq.conf, after which 'container1.lxc' will resolve on your
195 # host.
196 #LXC_DOMAIN="lxc"
197 EOF
198 fi
199
200 %postun
201 /usr/sbin/userdel lxc-dnsmasq > /dev/null 2>&1 || :
202
203 %post libs -p /sbin/ldconfig
204 %postun libs -p /sbin/ldconfig
205
206 %files
207 %defattr(-,root,root)
208 %{_bindir}/*
209 # openSUSE/SUSE
210 %if 0%{?suse_version} >= 1210
211 %dir %{_sysconfdir}/apparmor.d
212 %dir %{_sysconfdir}/apparmor.d/abstractions
213 %dir %{_sysconfdir}/apparmor.d/abstractions/%{name}
214 %config %{_sysconfdir}/apparmor.d/abstractions/%{name}/container-base
215 %config %{_sysconfdir}/apparmor.d/abstractions/%{name}/start-container
216 %config %{_sysconfdir}/apparmor.d/%{name}-containers
217 %dir %{_sysconfdir}/apparmor.d/%{name}
218 %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default
219 %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default-with-mounting
220 %config %{_sysconfdir}/apparmor.d/%{name}/%{name}-default-with-nesting
221 %config %{_sysconfdir}/apparmor.d/usr.bin.%{name}-start
222 %endif
223 %{_mandir}/man1/lxc*
224 %{_mandir}/man5/lxc*
225 %{_mandir}/man7/lxc*
226 # not openSUSE/SUSE
227 %if %{undefined suse_version}
228 %{_mandir}/ja/man1/lxc*
229 %{_mandir}/ja/man5/lxc*
230 %{_mandir}/ja/man7/lxc*
231 %{_mandir}/ko/man1/lxc*
232 %{_mandir}/ko/man5/lxc*
233 %{_mandir}/ko/man7/lxc*
234 %endif
235 %{_datadir}/doc/*
236 %{_datadir}/lxc/*
237 %{_sysconfdir}/bash_completion.d
238 %config(noreplace) %{_sysconfdir}/lxc/*
239 %config(noreplace) %{_sysconfdir}/sysconfig/*
240
241 %if %{with_systemd}
242 %{_unitdir}/lxc-net.service
243 %{_unitdir}/lxc.service
244 %{_unitdir}/lxc@.service
245 %else
246 %{_sysconfdir}/rc.d/init.d/lxc
247 %{_sysconfdir}/rc.d/init.d/lxc-net
248 %endif
249
250 %files libs
251 %defattr(-,root,root)
252 %{_sbindir}/*
253 %{_libdir}/*.so.*
254 %{_libdir}/%{name}
255 %{_localstatedir}/*
256 %{_libexecdir}/%{name}/hooks/unmount-namespace
257 %{_libexecdir}/%{name}/lxc-apparmor-load
258 %{_libexecdir}/%{name}/lxc-monitord
259 %attr(4111,root,root) %{_libexecdir}/%{name}/lxc-user-nic
260 %if %{with_systemd}
261 %attr(555,root,root) %{_libexecdir}/%{name}/lxc-net
262 %attr(555,root,root) %{_libexecdir}/%{name}/lxc-containers
263 %endif
264
265 %files devel
266 %defattr(-,root,root)
267 %{_includedir}/%{name}/*
268 %{_libdir}/*.so
269 %{_libdir}/pkgconfig/*
270
271 %changelog
272 * Tue Oct 22 2013 Dwight Engen <dwight.engen@oracle.com> - 1.0.0-0.1.alpha2
273 - fix some rpmlint warnings/errors
274 - split lua bits into separate package
275
276 * Mon Sep 10 2012 Dwight Engen <dwight.engen@oracle.com> - 0.8.0
277 - fix lxc-init moved to libexec
278 - .pc moved to _libdir
279 - package template files /usr/share/lxc/templates
280
281 * Thu Sep 8 2011 Greg Kurz <gkurz@fr.ibm.com> - 0.7.5.1
282 - fix installed files for rpmbuild
283 - introduce lxc-libs package
284
285 * Fri Jul 23 2010 Daniel Lezcano <dlezcano@fr.ibm.com> - 0.7.2
286 - set attribute for installed files
287 - fix libraries installation
288
289 * Tue Mar 24 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.1
290 - Removed capability setting, let the user to do that through "lxc-setcap"
291
292 * Mon Feb 16 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.0
293 - Added more capabilities to the executables
294
295 * Sun Jan 25 2009 Daniel Lezcano <daniel.lezcano@free.fr> - 0.6.0
296 - Reduced spec file
297
298 * Sun Aug 3 2008 Daniel Lezcano <dlezcano@fr.ibm.com> - 0.1.0
299 - Initial RPM release.
300
301 # Local variables:
302 # mode: shell-script
303 # sh-shell: rpm
304 # end: