1 |
commit: c23bc69c9cb9a3d2aacf0462f78b90676ba1e743 |
2 |
Author: Justin Lecher <jlec <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jun 8 08:45:43 2014 +0000 |
4 |
Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jun 8 08:45:43 2014 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/betagarden.git;a=commit;h=c23bc69c |
7 |
|
8 |
app-emulation/lxc: Drop installation of non existing TODO file; import tree changes |
9 |
|
10 |
Package-Manager: portage-2.2.10 |
11 |
|
12 |
--- |
13 |
app-emulation/lxc/ChangeLog | 6 +- |
14 |
app-emulation/lxc/files/lxc.initd.2 | 132 +++++++++++++++++++++++++++++++++ |
15 |
app-emulation/lxc/files/lxc_at.service | 12 +++ |
16 |
app-emulation/lxc/lxc-9999.ebuild | 109 +++++++++++++++++---------- |
17 |
app-emulation/lxc/metadata.xml | 10 +++ |
18 |
5 files changed, 229 insertions(+), 40 deletions(-) |
19 |
|
20 |
diff --git a/app-emulation/lxc/ChangeLog b/app-emulation/lxc/ChangeLog |
21 |
index 73ba9fd..e6e8494 100644 |
22 |
--- a/app-emulation/lxc/ChangeLog |
23 |
+++ b/app-emulation/lxc/ChangeLog |
24 |
@@ -1,7 +1,11 @@ |
25 |
# ChangeLog for app-emulation/lxc |
26 |
-# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 |
27 |
+# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 |
28 |
# $Header: $ |
29 |
|
30 |
+ 08 Jun 2014; Justin Lecher <jlec@g.o> lxc-9999.ebuild, |
31 |
+ +files/lxc.initd.2, +files/lxc_at.service, metadata.xml: |
32 |
+ Drop installation of non existing TODO file; import tree changes |
33 |
+ |
34 |
*lxc-9999 (25 Dec 2013) |
35 |
|
36 |
25 Dec 2013; Justin Lecher <jlec@g.o> +lxc-9999.ebuild, +metadata.xml: |
37 |
|
38 |
diff --git a/app-emulation/lxc/files/lxc.initd.2 b/app-emulation/lxc/files/lxc.initd.2 |
39 |
new file mode 100644 |
40 |
index 0000000..554019a |
41 |
--- /dev/null |
42 |
+++ b/app-emulation/lxc/files/lxc.initd.2 |
43 |
@@ -0,0 +1,132 @@ |
44 |
+#!/sbin/runscript |
45 |
+# Copyright 1999-2014 Gentoo Foundation |
46 |
+# Distributed under the terms of the GNU General Public License v2 |
47 |
+# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.6 2012/11/14 02:15:10 flameeyes Exp $ |
48 |
+ |
49 |
+CONTAINER=${SVCNAME#*.} |
50 |
+ |
51 |
+lxc_get_configfile() { |
52 |
+ if [ -f "/etc/lxc/${CONTAINER}.conf" ]; then |
53 |
+ echo "/etc/lxc/${CONTAINER}.conf" |
54 |
+ elif [ -f "/etc/lxc/${CONTAINER}/config" ]; then |
55 |
+ echo "/etc/lxc/${CONTAINER}/config" |
56 |
+ else |
57 |
+ eerror "Unable to find a suitable configuration file." |
58 |
+ eerror "If you set up the container in a non-standard" |
59 |
+ eerror "location, please set the CONFIGFILE variable." |
60 |
+ return 1 |
61 |
+ fi |
62 |
+} |
63 |
+ |
64 |
+[ $CONTAINER != $SVCNAME ] && CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)} |
65 |
+ |
66 |
+lxc_get_var() { |
67 |
+ awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE} |
68 |
+} |
69 |
+ |
70 |
+checkconfig() { |
71 |
+ if [ ${CONTAINER} = ${SVCNAME} ]; then |
72 |
+ eerror "You have to create an init script for each container:" |
73 |
+ eerror " ln -s lxc /etc/init.d/lxc.container" |
74 |
+ return 1 |
75 |
+ fi |
76 |
+ |
77 |
+ # no need to output anything, the function takes care of that. |
78 |
+ [ -z "${CONFIGFILE}" ] && return 1 |
79 |
+ |
80 |
+ utsname=$(lxc_get_var lxc.utsname) |
81 |
+ if [ ${CONTAINER} != ${utsname} ]; then |
82 |
+ eerror "You should use the same name for the service and the" |
83 |
+ eerror "container. Right now the container is called ${utsname}" |
84 |
+ return 1 |
85 |
+ fi |
86 |
+} |
87 |
+ |
88 |
+depend() { |
89 |
+ # be quiet, since we have to run depend() also for the |
90 |
+ # non-muxed init script, unfortunately. |
91 |
+ checkconfig 2>/dev/null || return 0 |
92 |
+ |
93 |
+ config ${CONFIGFILE} |
94 |
+ need localmount |
95 |
+ |
96 |
+ # find out which network interface the container is linked to, |
97 |
+ # and then require that to be enabled, so that the |
98 |
+ # dependencies are correct. |
99 |
+ netif=$(lxc_get_var lxc.network.link) |
100 |
+ |
101 |
+ # when the network type is set to phys, we can make use of a |
102 |
+ # network service (for instance to set it up before we disable |
103 |
+ # the net_admin capability), but we might also not set it up |
104 |
+ # at all on the host and leave the net_admin capable service |
105 |
+ # to take care of it. |
106 |
+ nettype=$(lxc_get_var lxc.network.type) |
107 |
+ |
108 |
+ if [ -n "${netif}" ]; then |
109 |
+ case "${nettype}" in |
110 |
+ phys) use net.${netif} ;; |
111 |
+ *) need net.${netif} ;; |
112 |
+ esac |
113 |
+ fi |
114 |
+} |
115 |
+ |
116 |
+start() { |
117 |
+ checkconfig || return 1 |
118 |
+ rm /var/log/lxc/${CONTAINER}.log |
119 |
+ |
120 |
+ rootpath=$(lxc_get_var lxc.rootfs) |
121 |
+ |
122 |
+ # Check the format of our init and the chroot's init, to see |
123 |
+ # if we have to use linux32 or linux64; always use setarch |
124 |
+ # when required, as that makes it easier to deal with |
125 |
+ # x32-based containers. |
126 |
+ case $(scanelf -BF '%a#f' ${rootpath}/sbin/init) in |
127 |
+ EM_X86_64) setarch=linux64;; |
128 |
+ EM_386) setarch=linux32;; |
129 |
+ esac |
130 |
+ |
131 |
+ ebegin "Starting ${CONTAINER}" |
132 |
+ env -i ${setarch} $(type -p lxc-start) -l WARN -n ${CONTAINER} -f ${CONFIGFILE} -d -o /var/log/lxc/${CONTAINER}.log |
133 |
+ sleep 0.5 |
134 |
+ |
135 |
+ # lxc-start -d will _always_ report a correct startup, even if it |
136 |
+ # failed, so rather than trust that, check that the cgroup exists. |
137 |
+ [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ] |
138 |
+ eend $? |
139 |
+} |
140 |
+ |
141 |
+stop() { |
142 |
+ checkconfig || return 1 |
143 |
+ |
144 |
+ |
145 |
+ if ! [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]; then |
146 |
+ ewarn "${CONTAINER} doesn't seem to be started." |
147 |
+ return 0 |
148 |
+ fi |
149 |
+ |
150 |
+ init_pid=$(lxc-info -n ${CONTAINER} --pid | awk '{ print $2 }') |
151 |
+ |
152 |
+ if [ "${init_pid}" = "-1" ]; then |
153 |
+ ewarn "${CONTAINER} doesn't seem to be running." |
154 |
+ return 0 |
155 |
+ fi |
156 |
+ |
157 |
+ ebegin "Shutting down system in ${CONTAINER}" |
158 |
+ kill -PWR ${init_pid} |
159 |
+ eend $? |
160 |
+ |
161 |
+ TIMEOUT=${TIMEOUT:-30} |
162 |
+ i=0 |
163 |
+ while [ -n "$(pgrep -P ${init_pid})" -a $i -lt ${TIMEOUT} ]; do |
164 |
+ sleep 1 |
165 |
+ i=$(expr $i + 1) |
166 |
+ done |
167 |
+ |
168 |
+ if [ -n "${missingprocs}" ]; then |
169 |
+ ewarn "Something failed to properly shut down in ${CONTAINER}" |
170 |
+ fi |
171 |
+ |
172 |
+ ebegin "Stopping ${CONTAINER}" |
173 |
+ lxc-stop -n ${CONTAINER} |
174 |
+ eend $? |
175 |
+} |
176 |
|
177 |
diff --git a/app-emulation/lxc/files/lxc_at.service b/app-emulation/lxc/files/lxc_at.service |
178 |
new file mode 100644 |
179 |
index 0000000..1ef4497 |
180 |
--- /dev/null |
181 |
+++ b/app-emulation/lxc/files/lxc_at.service |
182 |
@@ -0,0 +1,12 @@ |
183 |
+[Unit] |
184 |
+Description=Linux Container %I |
185 |
+After=network.target |
186 |
+ |
187 |
+[Service] |
188 |
+Restart=always |
189 |
+ExecStart=/usr/sbin/lxc-start -n %i |
190 |
+ExecReload=/usr/sbin/lxc-restart -n %i |
191 |
+ExecStop=/usr/sbin/lxc-stop -n %i |
192 |
+ |
193 |
+[Install] |
194 |
+WantedBy=multi-user.target |
195 |
|
196 |
diff --git a/app-emulation/lxc/lxc-9999.ebuild b/app-emulation/lxc/lxc-9999.ebuild |
197 |
index 0f2cdcd..5adf1b5 100644 |
198 |
--- a/app-emulation/lxc/lxc-9999.ebuild |
199 |
+++ b/app-emulation/lxc/lxc-9999.ebuild |
200 |
@@ -1,13 +1,13 @@ |
201 |
-# Copyright 1999-2013 Gentoo Foundation |
202 |
+# Copyright 1999-2014 Gentoo Foundation |
203 |
# Distributed under the terms of the GNU General Public License v2 |
204 |
# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/lxc-0.8.0-r1.ebuild,v 1.3 2013/09/10 05:22:55 maekke Exp $ |
205 |
|
206 |
EAPI=5 |
207 |
|
208 |
-AUTOTOOLS_AUTORECONF=true |
209 |
-AUTOTOOLS_IN_SOURCE_BUILD=1 |
210 |
+MY_P="${P/_/-}" |
211 |
+PYTHON_COMPAT=( python{3_2,3_3,3_4} ) |
212 |
|
213 |
-inherit autotools-utils eutils git-2 linux-info versionator flag-o-matic |
214 |
+inherit autotools distutils-r1 eutils git-r3 linux-info versionator flag-o-matic systemd |
215 |
|
216 |
DESCRIPTION="LinuX Containers userspace utilities" |
217 |
HOMEPAGE="http://lxc.sourceforge.net/" |
218 |
@@ -17,18 +17,22 @@ EGIT_REPO_URI="https://github.com/lxc/lxc.git" |
219 |
LICENSE="LGPL-3" |
220 |
SLOT="0" |
221 |
KEYWORDS="" |
222 |
-IUSE="examples" |
223 |
+IUSE="doc examples lua python seccomp" |
224 |
|
225 |
-RDEPEND="sys-libs/libcap" |
226 |
+RDEPEND=" |
227 |
+ net-libs/gnutls |
228 |
+ sys-libs/libcap |
229 |
+ lua? ( >=dev-lang/lua-5.1 ) |
230 |
+ python? ( ${PYTHON_DEPS} ) |
231 |
+ seccomp? ( sys-libs/libseccomp )" |
232 |
|
233 |
DEPEND="${RDEPEND} |
234 |
- app-text/docbook-sgml-utils |
235 |
+ doc? ( app-text/docbook-sgml-utils ) |
236 |
>=sys-kernel/linux-headers-3.2" |
237 |
|
238 |
RDEPEND="${RDEPEND} |
239 |
sys-apps/util-linux |
240 |
app-misc/pax-utils |
241 |
- >=sys-apps/openrc-0.9.9.1 |
242 |
virtual/awk" |
243 |
|
244 |
CONFIG_CHECK="~CGROUPS ~CGROUP_DEVICE |
245 |
@@ -54,8 +58,6 @@ CONFIG_CHECK="~CGROUPS ~CGROUP_DEVICE |
246 |
~!GRKERNSEC_CHROOT_CAPS |
247 |
" |
248 |
|
249 |
-#S="${WORKDIR}/${MY_P}" |
250 |
- |
251 |
ERROR_DEVPTS_MULTIPLE_INSTANCES="CONFIG_DEVPTS_MULTIPLE_INSTANCES: needed for pts inside container" |
252 |
|
253 |
ERROR_CGROUP_FREEZER="CONFIG_CGROUP_FREEZER: needed to freeze containers" |
254 |
@@ -76,45 +78,64 @@ ERROR_GRKERNSEC_CHROOT_PIVOT=":CONFIG_GRKERNSEC_CHROOT_PIVOT some GRSEC features |
255 |
ERROR_GRKERNSEC_CHROOT_CHMOD=":CONFIG_GRKERNSEC_CHROOT_CHMOD some GRSEC features make LXC unusable see postinst notes" |
256 |
ERROR_GRKERNSEC_CHROOT_CAPS=":CONFIG_GRKERNSEC_CHROOT_CAPS some GRSEC features make LXC unusable see postinst notes" |
257 |
|
258 |
-DOCS=(AUTHORS CONTRIBUTING MAINTAINERS TODO README doc/FAQ.txt) |
259 |
+DOCS=( AUTHORS CONTRIBUTING MAINTAINERS README doc/FAQ.txt ) |
260 |
|
261 |
-src_prepare() { |
262 |
- sed \ |
263 |
- -e "/PKG_CHECK_MODULES/s:python3:python-3.3:g" \ |
264 |
- -i configure.ac || die |
265 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
266 |
|
267 |
- autotools-utils_src_prepare |
268 |
+src_prepare() { |
269 |
+ sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.ac || die |
270 |
+ if [[ -n ${BACKPORTS} ]]; then |
271 |
+ epatch "${WORKDIR}"/patches/* |
272 |
+ fi |
273 |
+ if use python; then |
274 |
+ python_setup |
275 |
+ # We will handle python on our own |
276 |
+ echo > "${S}/src/python-${PN}/Makefile.am"; |
277 |
+ fi |
278 |
+ |
279 |
+ eautoreconf |
280 |
} |
281 |
|
282 |
src_configure() { |
283 |
append-flags -fno-strict-aliasing |
284 |
|
285 |
- local myeconfargs=( |
286 |
- --localstatedir=/var |
287 |
- --bindir=/usr/sbin |
288 |
- --docdir=/usr/share/doc/${PF} |
289 |
- --disable-rpath |
290 |
- --enable-doc |
291 |
- --with-config-path=/etc/lxc |
292 |
- --with-rootfs-path=/usr/lib/lxc/rootfs |
293 |
- --with-log-path=/var/log/lxc |
294 |
- --with-distro=gentoo |
295 |
- --disable-apparmor |
296 |
- --disable-selinux |
297 |
- --disable-lua |
298 |
- --enable-python |
299 |
-# --enable-seccomp |
300 |
- --disable-seccomp |
301 |
- $(use_enable examples) |
302 |
- ) |
303 |
- autotools-utils_src_configure |
304 |
+ econf \ |
305 |
+ --localstatedir=/var \ |
306 |
+ --bindir=/usr/sbin \ |
307 |
+ --docdir=/usr/share/doc/${PF} \ |
308 |
+ --with-config-path=/etc/lxc \ |
309 |
+ --with-rootfs-path=/usr/lib/lxc/rootfs \ |
310 |
+ $(use_enable doc) \ |
311 |
+ --disable-apparmor \ |
312 |
+ $(use_enable examples) \ |
313 |
+ $(use_enable lua) \ |
314 |
+ $(use_enable python) |
315 |
+} |
316 |
+ |
317 |
+python_compile() { |
318 |
+ distutils-r1_python_compile build_ext -I ../ -L ../${PN} |
319 |
+} |
320 |
+ |
321 |
+src_compile() { |
322 |
+ default |
323 |
+ |
324 |
+ if use python; then |
325 |
+ pushd "${S}/src/python-${PN}" > /dev/null |
326 |
+ distutils-r1_src_compile |
327 |
+ popd > /dev/null |
328 |
+ fi |
329 |
} |
330 |
|
331 |
-_src_install() { |
332 |
+src_install() { |
333 |
default |
334 |
|
335 |
-# rm -r "${D}"/usr/sbin/lxc-setcap \ |
336 |
-# || die "unable to remove lxc-setcap" |
337 |
+ if use python; then |
338 |
+ pushd "${S}/src/python-lxc" > /dev/null |
339 |
+ # Unset DOCS. This has been handled by the default target |
340 |
+ unset DOCS |
341 |
+ distutils-r1_src_install |
342 |
+ popd > /dev/null |
343 |
+ fi |
344 |
|
345 |
keepdir /etc/lxc /usr/lib/lxc/rootfs /var/log/lxc |
346 |
|
347 |
@@ -122,7 +143,17 @@ _src_install() { |
348 |
|
349 |
# Gentoo-specific additions! |
350 |
newinitd "${FILESDIR}/${PN}.initd.2" ${PN} |
351 |
- keepdir /var/log/lxc |
352 |
+ # lxc-devsetup script |
353 |
+ exeinto /usr/libexec/${PN} |
354 |
+ doexe config/init/systemd/${PN}-devsetup |
355 |
+ # Use that script with the systemd service (Similar to upstream |
356 |
+ # Makefile.am |
357 |
+ cp "${FILESDIR}"/${PN}_at.service ${PN}_at.service |
358 |
+ sed -i \ |
359 |
+ "/Restart=always/a ExecStartPre=/usr/libexec/${PN}/${PN}-devsetup" \ |
360 |
+ ${PN}_at.service \ |
361 |
+ || die "Failed to add ${PN}-devsetup to the systemd service file" |
362 |
+ systemd_newunit ${PN}_at.service "lxc@.service" |
363 |
} |
364 |
|
365 |
pkg_postinst() { |
366 |
|
367 |
diff --git a/app-emulation/lxc/metadata.xml b/app-emulation/lxc/metadata.xml |
368 |
index a759be0..7b3a2fe 100644 |
369 |
--- a/app-emulation/lxc/metadata.xml |
370 |
+++ b/app-emulation/lxc/metadata.xml |
371 |
@@ -4,4 +4,14 @@ |
372 |
<maintainer> |
373 |
<email>maintainer-wanted@g.o</email> |
374 |
</maintainer> |
375 |
+ <use> |
376 |
+ <flag name="seccomp">Use seccomp syscall filters using <pkg>sys-libs/libseccomp</pkg></flag> |
377 |
+ <flag name="vanilla"> |
378 |
+ Avoid adding Gentoo Linux-specific modifications, which include |
379 |
+ the custom init script. This is present as a flag to avoid |
380 |
+ forcing dependencies over users that might not want have them |
381 |
+ around as they use LXC in contexts where the init script is not |
382 |
+ useful. |
383 |
+ </flag> |
384 |
+ </use> |
385 |
</pkgmetadata> |