diff options
author | Justin Lecher <jlec@gentoo.org> | 2014-06-08 10:45:43 +0200 |
---|---|---|
committer | Justin Lecher <jlec@gentoo.org> | 2014-06-08 10:45:43 +0200 |
commit | c23bc69c9cb9a3d2aacf0462f78b90676ba1e743 (patch) | |
tree | 4403ea86e5ae61fb24e08c5e59a2c969f9c3bf45 /app-emulation | |
parent | media-tv/mediathekview-bin: Fix manifest (diff) | |
download | betagarden-c23bc69c9cb9a3d2aacf0462f78b90676ba1e743.tar.gz betagarden-c23bc69c9cb9a3d2aacf0462f78b90676ba1e743.tar.bz2 betagarden-c23bc69c9cb9a3d2aacf0462f78b90676ba1e743.zip |
app-emulation/lxc: Drop installation of non existing TODO file; import tree changes
Package-Manager: portage-2.2.10
Diffstat (limited to 'app-emulation')
-rw-r--r-- | app-emulation/lxc/ChangeLog | 6 | ||||
-rw-r--r-- | app-emulation/lxc/files/lxc.initd.2 | 132 | ||||
-rw-r--r-- | app-emulation/lxc/files/lxc_at.service | 12 | ||||
-rw-r--r-- | app-emulation/lxc/lxc-9999.ebuild | 109 | ||||
-rw-r--r-- | app-emulation/lxc/metadata.xml | 10 |
5 files changed, 229 insertions, 40 deletions
diff --git a/app-emulation/lxc/ChangeLog b/app-emulation/lxc/ChangeLog index 73ba9fd..e6e8494 100644 --- a/app-emulation/lxc/ChangeLog +++ b/app-emulation/lxc/ChangeLog @@ -1,7 +1,11 @@ # ChangeLog for app-emulation/lxc -# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 +# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ + 08 Jun 2014; Justin Lecher <jlec@gentoo.org> lxc-9999.ebuild, + +files/lxc.initd.2, +files/lxc_at.service, metadata.xml: + Drop installation of non existing TODO file; import tree changes + *lxc-9999 (25 Dec 2013) 25 Dec 2013; Justin Lecher <jlec@gentoo.org> +lxc-9999.ebuild, +metadata.xml: diff --git a/app-emulation/lxc/files/lxc.initd.2 b/app-emulation/lxc/files/lxc.initd.2 new file mode 100644 index 0000000..554019a --- /dev/null +++ b/app-emulation/lxc/files/lxc.initd.2 @@ -0,0 +1,132 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/files/lxc.initd.2,v 1.6 2012/11/14 02:15:10 flameeyes Exp $ + +CONTAINER=${SVCNAME#*.} + +lxc_get_configfile() { + if [ -f "/etc/lxc/${CONTAINER}.conf" ]; then + echo "/etc/lxc/${CONTAINER}.conf" + elif [ -f "/etc/lxc/${CONTAINER}/config" ]; then + echo "/etc/lxc/${CONTAINER}/config" + else + eerror "Unable to find a suitable configuration file." + eerror "If you set up the container in a non-standard" + eerror "location, please set the CONFIGFILE variable." + return 1 + fi +} + +[ $CONTAINER != $SVCNAME ] && CONFIGFILE=${CONFIGFILE:-$(lxc_get_configfile)} + +lxc_get_var() { + awk 'BEGIN { FS="[ \t]*=[ \t]*" } $1 == "'$1'" { print $2; exit }' ${CONFIGFILE} +} + +checkconfig() { + if [ ${CONTAINER} = ${SVCNAME} ]; then + eerror "You have to create an init script for each container:" + eerror " ln -s lxc /etc/init.d/lxc.container" + return 1 + fi + + # no need to output anything, the function takes care of that. + [ -z "${CONFIGFILE}" ] && return 1 + + utsname=$(lxc_get_var lxc.utsname) + if [ ${CONTAINER} != ${utsname} ]; then + eerror "You should use the same name for the service and the" + eerror "container. Right now the container is called ${utsname}" + return 1 + fi +} + +depend() { + # be quiet, since we have to run depend() also for the + # non-muxed init script, unfortunately. + checkconfig 2>/dev/null || return 0 + + config ${CONFIGFILE} + need localmount + + # find out which network interface the container is linked to, + # and then require that to be enabled, so that the + # dependencies are correct. + netif=$(lxc_get_var lxc.network.link) + + # when the network type is set to phys, we can make use of a + # network service (for instance to set it up before we disable + # the net_admin capability), but we might also not set it up + # at all on the host and leave the net_admin capable service + # to take care of it. + nettype=$(lxc_get_var lxc.network.type) + + if [ -n "${netif}" ]; then + case "${nettype}" in + phys) use net.${netif} ;; + *) need net.${netif} ;; + esac + fi +} + +start() { + checkconfig || return 1 + rm /var/log/lxc/${CONTAINER}.log + + rootpath=$(lxc_get_var lxc.rootfs) + + # Check the format of our init and the chroot's init, to see + # if we have to use linux32 or linux64; always use setarch + # when required, as that makes it easier to deal with + # x32-based containers. + case $(scanelf -BF '%a#f' ${rootpath}/sbin/init) in + EM_X86_64) setarch=linux64;; + EM_386) setarch=linux32;; + esac + + ebegin "Starting ${CONTAINER}" + env -i ${setarch} $(type -p lxc-start) -l WARN -n ${CONTAINER} -f ${CONFIGFILE} -d -o /var/log/lxc/${CONTAINER}.log + sleep 0.5 + + # lxc-start -d will _always_ report a correct startup, even if it + # failed, so rather than trust that, check that the cgroup exists. + [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ] + eend $? +} + +stop() { + checkconfig || return 1 + + + if ! [ -d /sys/fs/cgroup/cpuset/lxc/${CONTAINER} ]; then + ewarn "${CONTAINER} doesn't seem to be started." + return 0 + fi + + init_pid=$(lxc-info -n ${CONTAINER} --pid | awk '{ print $2 }') + + if [ "${init_pid}" = "-1" ]; then + ewarn "${CONTAINER} doesn't seem to be running." + return 0 + fi + + ebegin "Shutting down system in ${CONTAINER}" + kill -PWR ${init_pid} + eend $? + + TIMEOUT=${TIMEOUT:-30} + i=0 + while [ -n "$(pgrep -P ${init_pid})" -a $i -lt ${TIMEOUT} ]; do + sleep 1 + i=$(expr $i + 1) + done + + if [ -n "${missingprocs}" ]; then + ewarn "Something failed to properly shut down in ${CONTAINER}" + fi + + ebegin "Stopping ${CONTAINER}" + lxc-stop -n ${CONTAINER} + eend $? +} diff --git a/app-emulation/lxc/files/lxc_at.service b/app-emulation/lxc/files/lxc_at.service new file mode 100644 index 0000000..1ef4497 --- /dev/null +++ b/app-emulation/lxc/files/lxc_at.service @@ -0,0 +1,12 @@ +[Unit] +Description=Linux Container %I +After=network.target + +[Service] +Restart=always +ExecStart=/usr/sbin/lxc-start -n %i +ExecReload=/usr/sbin/lxc-restart -n %i +ExecStop=/usr/sbin/lxc-stop -n %i + +[Install] +WantedBy=multi-user.target diff --git a/app-emulation/lxc/lxc-9999.ebuild b/app-emulation/lxc/lxc-9999.ebuild index 0f2cdcd..5adf1b5 100644 --- a/app-emulation/lxc/lxc-9999.ebuild +++ b/app-emulation/lxc/lxc-9999.ebuild @@ -1,13 +1,13 @@ -# Copyright 1999-2013 Gentoo Foundation +# Copyright 1999-2014 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $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 $ EAPI=5 -AUTOTOOLS_AUTORECONF=true -AUTOTOOLS_IN_SOURCE_BUILD=1 +MY_P="${P/_/-}" +PYTHON_COMPAT=( python{3_2,3_3,3_4} ) -inherit autotools-utils eutils git-2 linux-info versionator flag-o-matic +inherit autotools distutils-r1 eutils git-r3 linux-info versionator flag-o-matic systemd DESCRIPTION="LinuX Containers userspace utilities" HOMEPAGE="http://lxc.sourceforge.net/" @@ -17,18 +17,22 @@ EGIT_REPO_URI="https://github.com/lxc/lxc.git" LICENSE="LGPL-3" SLOT="0" KEYWORDS="" -IUSE="examples" +IUSE="doc examples lua python seccomp" -RDEPEND="sys-libs/libcap" +RDEPEND=" + net-libs/gnutls + sys-libs/libcap + lua? ( >=dev-lang/lua-5.1 ) + python? ( ${PYTHON_DEPS} ) + seccomp? ( sys-libs/libseccomp )" DEPEND="${RDEPEND} - app-text/docbook-sgml-utils + doc? ( app-text/docbook-sgml-utils ) >=sys-kernel/linux-headers-3.2" RDEPEND="${RDEPEND} sys-apps/util-linux app-misc/pax-utils - >=sys-apps/openrc-0.9.9.1 virtual/awk" CONFIG_CHECK="~CGROUPS ~CGROUP_DEVICE @@ -54,8 +58,6 @@ CONFIG_CHECK="~CGROUPS ~CGROUP_DEVICE ~!GRKERNSEC_CHROOT_CAPS " -#S="${WORKDIR}/${MY_P}" - ERROR_DEVPTS_MULTIPLE_INSTANCES="CONFIG_DEVPTS_MULTIPLE_INSTANCES: needed for pts inside container" ERROR_CGROUP_FREEZER="CONFIG_CGROUP_FREEZER: needed to freeze containers" @@ -76,45 +78,64 @@ ERROR_GRKERNSEC_CHROOT_PIVOT=":CONFIG_GRKERNSEC_CHROOT_PIVOT some GRSEC features ERROR_GRKERNSEC_CHROOT_CHMOD=":CONFIG_GRKERNSEC_CHROOT_CHMOD some GRSEC features make LXC unusable see postinst notes" ERROR_GRKERNSEC_CHROOT_CAPS=":CONFIG_GRKERNSEC_CHROOT_CAPS some GRSEC features make LXC unusable see postinst notes" -DOCS=(AUTHORS CONTRIBUTING MAINTAINERS TODO README doc/FAQ.txt) +DOCS=( AUTHORS CONTRIBUTING MAINTAINERS README doc/FAQ.txt ) -src_prepare() { - sed \ - -e "/PKG_CHECK_MODULES/s:python3:python-3.3:g" \ - -i configure.ac || die +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" - autotools-utils_src_prepare +src_prepare() { + sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.ac || die + if [[ -n ${BACKPORTS} ]]; then + epatch "${WORKDIR}"/patches/* + fi + if use python; then + python_setup + # We will handle python on our own + echo > "${S}/src/python-${PN}/Makefile.am"; + fi + + eautoreconf } src_configure() { append-flags -fno-strict-aliasing - local myeconfargs=( - --localstatedir=/var - --bindir=/usr/sbin - --docdir=/usr/share/doc/${PF} - --disable-rpath - --enable-doc - --with-config-path=/etc/lxc - --with-rootfs-path=/usr/lib/lxc/rootfs - --with-log-path=/var/log/lxc - --with-distro=gentoo - --disable-apparmor - --disable-selinux - --disable-lua - --enable-python -# --enable-seccomp - --disable-seccomp - $(use_enable examples) - ) - autotools-utils_src_configure + econf \ + --localstatedir=/var \ + --bindir=/usr/sbin \ + --docdir=/usr/share/doc/${PF} \ + --with-config-path=/etc/lxc \ + --with-rootfs-path=/usr/lib/lxc/rootfs \ + $(use_enable doc) \ + --disable-apparmor \ + $(use_enable examples) \ + $(use_enable lua) \ + $(use_enable python) +} + +python_compile() { + distutils-r1_python_compile build_ext -I ../ -L ../${PN} +} + +src_compile() { + default + + if use python; then + pushd "${S}/src/python-${PN}" > /dev/null + distutils-r1_src_compile + popd > /dev/null + fi } -_src_install() { +src_install() { default -# rm -r "${D}"/usr/sbin/lxc-setcap \ -# || die "unable to remove lxc-setcap" + if use python; then + pushd "${S}/src/python-lxc" > /dev/null + # Unset DOCS. This has been handled by the default target + unset DOCS + distutils-r1_src_install + popd > /dev/null + fi keepdir /etc/lxc /usr/lib/lxc/rootfs /var/log/lxc @@ -122,7 +143,17 @@ _src_install() { # Gentoo-specific additions! newinitd "${FILESDIR}/${PN}.initd.2" ${PN} - keepdir /var/log/lxc + # lxc-devsetup script + exeinto /usr/libexec/${PN} + doexe config/init/systemd/${PN}-devsetup + # Use that script with the systemd service (Similar to upstream + # Makefile.am + cp "${FILESDIR}"/${PN}_at.service ${PN}_at.service + sed -i \ + "/Restart=always/a ExecStartPre=/usr/libexec/${PN}/${PN}-devsetup" \ + ${PN}_at.service \ + || die "Failed to add ${PN}-devsetup to the systemd service file" + systemd_newunit ${PN}_at.service "lxc@.service" } pkg_postinst() { diff --git a/app-emulation/lxc/metadata.xml b/app-emulation/lxc/metadata.xml index a759be0..7b3a2fe 100644 --- a/app-emulation/lxc/metadata.xml +++ b/app-emulation/lxc/metadata.xml @@ -4,4 +4,14 @@ <maintainer> <email>maintainer-wanted@gentoo.org</email> </maintainer> + <use> + <flag name="seccomp">Use seccomp syscall filters using <pkg>sys-libs/libseccomp</pkg></flag> + <flag name="vanilla"> + Avoid adding Gentoo Linux-specific modifications, which include + the custom init script. This is present as a flag to avoid + forcing dependencies over users that might not want have them + around as they use LXC in contexts where the init script is not + useful. + </flag> + </use> </pkgmetadata> |