From 11b6f039bd0375c57a548176168c28e56765b8b7 Mon Sep 17 00:00:00 2001 From: Diego Elio Pettenò Date: Wed, 28 Sep 2011 21:47:46 +0000 Subject: Fix init script to find the correct PID for the container's init and use a 30-seconds timeout to see if it has stopped correctly. Thanks to Stef Simoens for both (bug #384265). Package-Manager: portage-2.2.0_alpha59/cvs/Linux x86_64 --- app-emulation/lxc/ChangeLog | 10 ++- app-emulation/lxc/Manifest | 12 ++-- app-emulation/lxc/files/lxc.initd | 14 +++-- app-emulation/lxc/lxc-0.7.5-r1.ebuild | 111 ---------------------------------- app-emulation/lxc/lxc-0.7.5-r2.ebuild | 111 ++++++++++++++++++++++++++++++++++ 5 files changed, 135 insertions(+), 123 deletions(-) delete mode 100644 app-emulation/lxc/lxc-0.7.5-r1.ebuild create mode 100644 app-emulation/lxc/lxc-0.7.5-r2.ebuild (limited to 'app-emulation') diff --git a/app-emulation/lxc/ChangeLog b/app-emulation/lxc/ChangeLog index d1add772c90b..992a2ecc8361 100644 --- a/app-emulation/lxc/ChangeLog +++ b/app-emulation/lxc/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for app-emulation/lxc # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/ChangeLog,v 1.27 2011/09/14 19:39:40 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/ChangeLog,v 1.28 2011/09/28 21:47:46 flameeyes Exp $ + +*lxc-0.7.5-r2 (28 Sep 2011) + + 28 Sep 2011; Diego E. Pettenò -lxc-0.7.5-r1.ebuild, + +lxc-0.7.5-r2.ebuild, files/lxc.initd: + Fix init script to find the correct PID for the container's init and use a + 30-seconds timeout to see if it has stopped correctly. Thanks to Stef Simoens + for both (bug #384265). *lxc-0.7.5-r1 (14 Sep 2011) diff --git a/app-emulation/lxc/Manifest b/app-emulation/lxc/Manifest index b29b9bf01bec..4b2826580a60 100644 --- a/app-emulation/lxc/Manifest +++ b/app-emulation/lxc/Manifest @@ -1,15 +1,15 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -AUX lxc.initd 3555 RMD160 b9bed6bf618d5da2e3e0db99ef0337c383a22fbe SHA1 81eb36e4286b623cb778ca6495fa1e50b9e0fa95 SHA256 1cf87a6fecf50e43828daf58b9bdd9a7a22006c16ea32137ac1d7d9d7f2984f5 +AUX lxc.initd 3669 RMD160 6826f16014989faca6461f020875f58982dc3d15 SHA1 7727b75b59ec71147ae2478bc6c7a838c96ec4b4 SHA256 71cbb6ecbfa10a43ff6e9bdddad2b9a331e55d18d49d63f4ee651dc03818f519 DIST lxc-0.7.5.tar.gz 265562 RMD160 93407be1ebf31bdcfa617e60672d9f86ba2940d1 SHA1 9712dccdcd2c10a522134fa17384a5b9e38fce0e SHA256 019ec63f250c874bf7625b1f1bf555b1a6e3a947937a4fca73100abddf829b1c -EBUILD lxc-0.7.5-r1.ebuild 3206 RMD160 d51c3d6e0910dea9d6e116b5955fca23a092cb73 SHA1 0c19a7257477147b44f7ec9d8e7f64f71b6e9d58 SHA256 dd6bb65d5add92e2e4606b32138cfce7a886182d603e2632c831bac581e74335 -MISC ChangeLog 6319 RMD160 230592f68e012f79671599ba8f7bee8873fd8c8b SHA1 9f5ab12069ba29fb0d132b9bc42e3dfc1f3f2e47 SHA256 24b343e8bfa4905468ba975359ec536da44751f93239314606c5fca7a87aaa69 +EBUILD lxc-0.7.5-r2.ebuild 3206 RMD160 1a476cf353c04c30b71c75a034a856c46a460146 SHA1 f877e25376e79352f199ec056c6b00155530bdf0 SHA256 2c15ec330886091bce73323aeef5198cd58e1f75dfe64dcaae7fe053b7a53781 +MISC ChangeLog 6651 RMD160 d4ab541e29d4e92f665e1995f98852abc2c09ec8 SHA1 da732d308d63ec13f6eda3df286cf2774daed2ed SHA256 fdc3bfb4cdd883597155b9ae63fce07fb6b78763f6d943c1eda088b973714d4c MISC metadata.xml 653 RMD160 d6139a7ce3a5dab18f33c7f111f2e7827c290723 SHA1 47ba631625b4f2b20e491a964e65c78dd236f6f2 SHA256 35f64761067f47ff7abd0e3f3cb57f4bab888a2546bf3267d59987505101a190 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) -iEYEARECAAYFAk5xAvEACgkQAiZjviIA2XjrUACgmSt25ZuZ5vbnCoS1hWXOyeFv -uc4An2dp4Qx5EMlaH/0JiQCk6jsBqEZV -=Aaos +iEYEARECAAYFAk6DlfMACgkQAiZjviIA2Xhu9QCfYsZxzeigfp+SkqVLfy0T2gvI +YkgAnA4h5OzDEpbSTTmSfOEFBIuiTaqw +=VnMl -----END PGP SIGNATURE----- diff --git a/app-emulation/lxc/files/lxc.initd b/app-emulation/lxc/files/lxc.initd index 6266193031e6..7275826025a1 100644 --- a/app-emulation/lxc/files/lxc.initd +++ b/app-emulation/lxc/files/lxc.initd @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v 1.7 2011/09/14 19:39:40 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd,v 1.8 2011/09/28 21:47:46 flameeyes Exp $ CONTAINER=${SVCNAME#*.} @@ -111,15 +111,19 @@ stop() { return 0 fi - init_pid=$(head -n1 ${cgroupmount}/${CONTAINER}/tasks) + init_pid=$(lxc-info -n ${CONTAINER} --pid | cut -d: -f 2) ebegin "Shutting down system in ${CONTAINER}" kill -INT ${init_pid} eend $? - sleep 15 - - missingprocs=$(pgrep -P ${init_pid}) + TIMEOUT=${TIMEOUT:-30} + i=0 + while [ -n "${missingprocs}" -a $i -lt ${TIMEOUT} ]; do + sleep 1 + missingprocs=$(pgrep -P ${init_pid}) + i=$(expr $i + 1) + done if [ -n "${missingprocs}" ]; then ewarn "Something failed to properly shut down in ${CONTAINER}" diff --git a/app-emulation/lxc/lxc-0.7.5-r1.ebuild b/app-emulation/lxc/lxc-0.7.5-r1.ebuild deleted file mode 100644 index 8b729caa0fce..000000000000 --- a/app-emulation/lxc/lxc-0.7.5-r1.ebuild +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright 1999-2011 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/lxc-0.7.5-r1.ebuild,v 1.1 2011/09/14 19:39:40 flameeyes Exp $ - -EAPI="4" - -MY_P="${P/_/-}" - -inherit eutils linux-info versionator flag-o-matic - -DESCRIPTION="LinuX Containers userspace utilities" -HOMEPAGE="http://lxc.sourceforge.net/" -SRC_URI="http://lxc.sourceforge.net/download/lxc/${MY_P}.tar.gz" -S="${WORKDIR}/${MY_P}" - -KEYWORDS="~amd64 ~ppc64 ~x86" - -LICENSE="LGPL-3" -SLOT="0" -IUSE="examples vanilla" - -RDEPEND="sys-libs/libcap" - -DEPEND="${RDEPEND} - app-text/docbook-sgml-utils - >=sys-kernel/linux-headers-2.6.29" - -# For init script, so protect with vanilla, they are not strictly -# needed. -RDEPEND="${RDEPEND} - vanilla? ( - sys-apps/util-linux - app-misc/pax-utils - )" - -CONFIG_CHECK="~CGROUPS - ~CPUSETS ~CGROUP_CPUACCT - ~RESOURCE_COUNTERS ~CGROUP_MEM_RES_CTLR - ~CGROUP_SCHED - - ~NAMESPACES - ~IPC_NS ~USER_NS ~PID_NS - - ~DEVPTS_MULTIPLE_INSTANCES - ~CGROUP_FREEZER - ~UTS_NS ~NET_NS - ~VETH ~MACVLAN" - -ERROR_DEVPTS_MULTIPLE_INSTANCES="CONFIG_DEVPTS_MULTIPLE_INSTANCES: needed for pts inside container" - -ERROR_CGROUP_FREEZER="CONFIG_CGROUP_FREEZER: needed to freeze containers" - -ERROR_UTS_NS="CONFIG_UTS_NS: needed to unshare hostnames and uname info" -ERROR_NET_NS="CONFIG_NET_NS: needed for unshared network" - -ERROR_VETH="CONFIG_VETH: needed for internal (host-to-container) networking" -ERROR_MACVLAN="CONFIG_MACVLAN: needed for internal (inter-container) networking" - -DOCS=(AUTHORS CONTRIBUTING MAINTAINERS NEWS TODO README doc/FAQ.txt) - -src_configure() { - append-flags -fno-strict-aliasing - - econf \ - --localstatedir=/var \ - --bindir=/usr/sbin \ - --docdir=/usr/share/doc/${PF} \ - --with-config-path=/etc/lxc \ - --with-rootfs-path=/usr/lib/lxc/rootfs \ - --with-linuxdir="${KERNEL_DIR}" \ - --enable-doc \ - $(use_enable examples) -} - -src_install() { - default - - rm -r "${D}"/usr/sbin/lxc-{setcap,ls} \ - "${D}"/usr/share/man/man1/lxc-ls.1 \ - || die "unable to remove extraenous content" - - keepdir /etc/lxc /usr/lib/lxc/rootfs - - find "${D}" -name '*.la' -delete - - use vanilla && return 0 - - # Gentoo-specific additions! - newinitd "${FILESDIR}/${PN}.initd" ${PN} - keepdir /var/log/lxc -} - -pkg_postinst() { - if ! use vanilla; then - elog "There is an init script provided with the package now; no documentation" - elog "is currently available though, so please check out /etc/init.d/lxc ." - elog "You _should_ only need to symlink it to /etc/init.d/lxc.configname" - elog "to start the container defined into /etc/lxc/configname.conf ." - elog "For further information about LXC development see" - elog "http://blog.flameeyes.eu/tag/lxc" # remove once proper doc is available - elog "" - fi - ewarn "With version 0.7.4, the mountpoint syntax came back to the one used by 0.7.2" - ewarn "and previous versions. This means you'll have to use syntax like the following" - ewarn "" - ewarn " lxc.rootfs = /container" - ewarn " lxc.mount.entry = /usr/portage /container/usr/portage none bind 0 0" - ewarn "" - ewarn "To use the Fedora, Debian and (various) Ubuntu auto-configuration scripts, you" - ewarn "will need sys-apps/yum or dev-util/debootstrap." -} diff --git a/app-emulation/lxc/lxc-0.7.5-r2.ebuild b/app-emulation/lxc/lxc-0.7.5-r2.ebuild new file mode 100644 index 000000000000..991e418a521f --- /dev/null +++ b/app-emulation/lxc/lxc-0.7.5-r2.ebuild @@ -0,0 +1,111 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/lxc-0.7.5-r2.ebuild,v 1.1 2011/09/28 21:47:46 flameeyes Exp $ + +EAPI="4" + +MY_P="${P/_/-}" + +inherit eutils linux-info versionator flag-o-matic + +DESCRIPTION="LinuX Containers userspace utilities" +HOMEPAGE="http://lxc.sourceforge.net/" +SRC_URI="http://lxc.sourceforge.net/download/lxc/${MY_P}.tar.gz" +S="${WORKDIR}/${MY_P}" + +KEYWORDS="~amd64 ~ppc64 ~x86" + +LICENSE="LGPL-3" +SLOT="0" +IUSE="examples vanilla" + +RDEPEND="sys-libs/libcap" + +DEPEND="${RDEPEND} + app-text/docbook-sgml-utils + >=sys-kernel/linux-headers-2.6.29" + +# For init script, so protect with vanilla, they are not strictly +# needed. +RDEPEND="${RDEPEND} + vanilla? ( + sys-apps/util-linux + app-misc/pax-utils + )" + +CONFIG_CHECK="~CGROUPS + ~CPUSETS ~CGROUP_CPUACCT + ~RESOURCE_COUNTERS ~CGROUP_MEM_RES_CTLR + ~CGROUP_SCHED + + ~NAMESPACES + ~IPC_NS ~USER_NS ~PID_NS + + ~DEVPTS_MULTIPLE_INSTANCES + ~CGROUP_FREEZER + ~UTS_NS ~NET_NS + ~VETH ~MACVLAN" + +ERROR_DEVPTS_MULTIPLE_INSTANCES="CONFIG_DEVPTS_MULTIPLE_INSTANCES: needed for pts inside container" + +ERROR_CGROUP_FREEZER="CONFIG_CGROUP_FREEZER: needed to freeze containers" + +ERROR_UTS_NS="CONFIG_UTS_NS: needed to unshare hostnames and uname info" +ERROR_NET_NS="CONFIG_NET_NS: needed for unshared network" + +ERROR_VETH="CONFIG_VETH: needed for internal (host-to-container) networking" +ERROR_MACVLAN="CONFIG_MACVLAN: needed for internal (inter-container) networking" + +DOCS=(AUTHORS CONTRIBUTING MAINTAINERS NEWS TODO README doc/FAQ.txt) + +src_configure() { + append-flags -fno-strict-aliasing + + econf \ + --localstatedir=/var \ + --bindir=/usr/sbin \ + --docdir=/usr/share/doc/${PF} \ + --with-config-path=/etc/lxc \ + --with-rootfs-path=/usr/lib/lxc/rootfs \ + --with-linuxdir="${KERNEL_DIR}" \ + --enable-doc \ + $(use_enable examples) +} + +src_install() { + default + + rm -r "${D}"/usr/sbin/lxc-{setcap,ls} \ + "${D}"/usr/share/man/man1/lxc-ls.1 \ + || die "unable to remove extraenous content" + + keepdir /etc/lxc /usr/lib/lxc/rootfs + + find "${D}" -name '*.la' -delete + + use vanilla && return 0 + + # Gentoo-specific additions! + newinitd "${FILESDIR}/${PN}.initd" ${PN} + keepdir /var/log/lxc +} + +pkg_postinst() { + if ! use vanilla; then + elog "There is an init script provided with the package now; no documentation" + elog "is currently available though, so please check out /etc/init.d/lxc ." + elog "You _should_ only need to symlink it to /etc/init.d/lxc.configname" + elog "to start the container defined into /etc/lxc/configname.conf ." + elog "For further information about LXC development see" + elog "http://blog.flameeyes.eu/tag/lxc" # remove once proper doc is available + elog "" + fi + ewarn "With version 0.7.4, the mountpoint syntax came back to the one used by 0.7.2" + ewarn "and previous versions. This means you'll have to use syntax like the following" + ewarn "" + ewarn " lxc.rootfs = /container" + ewarn " lxc.mount.entry = /usr/portage /container/usr/portage none bind 0 0" + ewarn "" + ewarn "To use the Fedora, Debian and (various) Ubuntu auto-configuration scripts, you" + ewarn "will need sys-apps/yum or dev-util/debootstrap." +} -- cgit v1.2.3-65-gdbad