| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/app-emulation/lxc/lxc-0.8.0_rc2.ebuild,v 1.1 2012/07/21 05:07:14 flameeyes Exp $
|
| 4 |
|
| 5 |
EAPI="4"
|
| 6 |
|
| 7 |
MY_P="${P/_/-}"
|
| 8 |
|
| 9 |
BACKPORTS=2
|
| 10 |
|
| 11 |
inherit eutils linux-info versionator flag-o-matic
|
| 12 |
|
| 13 |
if [[ -n ${BACKPORTS} ]]; then
|
| 14 |
inherit autotools
|
| 15 |
fi
|
| 16 |
|
| 17 |
DESCRIPTION="LinuX Containers userspace utilities"
|
| 18 |
HOMEPAGE="http://lxc.sourceforge.net/"
|
| 19 |
SRC_URI="http://lxc.sourceforge.net/download/lxc/${MY_P}.tar.gz
|
| 20 |
${BACKPORTS:+http://dev.gentoo.org/~flameeyes/${PN}/${MY_P}-backports-${BACKPORTS}.tar.xz}"
|
| 21 |
S="${WORKDIR}/${MY_P}"
|
| 22 |
|
| 23 |
KEYWORDS="~amd64 ~ppc64 ~x86"
|
| 24 |
|
| 25 |
LICENSE="LGPL-3"
|
| 26 |
SLOT="0"
|
| 27 |
IUSE="examples vanilla"
|
| 28 |
|
| 29 |
RDEPEND="sys-libs/libcap"
|
| 30 |
|
| 31 |
DEPEND="${RDEPEND}
|
| 32 |
app-text/docbook-sgml-utils
|
| 33 |
>=sys-kernel/linux-headers-3.2"
|
| 34 |
|
| 35 |
# For init script, so protect with vanilla, they are not strictly
|
| 36 |
# needed.
|
| 37 |
RDEPEND="${RDEPEND}
|
| 38 |
!vanilla? (
|
| 39 |
sys-apps/util-linux
|
| 40 |
app-misc/pax-utils
|
| 41 |
>=sys-apps/openrc-0.9.9.1
|
| 42 |
virtual/awk
|
| 43 |
)"
|
| 44 |
|
| 45 |
CONFIG_CHECK="~CGROUPS ~CGROUP_DEVICE
|
| 46 |
~CPUSETS ~CGROUP_CPUACCT
|
| 47 |
~RESOURCE_COUNTERS ~CGROUP_MEM_RES_CTLR
|
| 48 |
~CGROUP_SCHED
|
| 49 |
|
| 50 |
~NAMESPACES
|
| 51 |
~IPC_NS ~USER_NS ~PID_NS
|
| 52 |
|
| 53 |
~DEVPTS_MULTIPLE_INSTANCES
|
| 54 |
~CGROUP_FREEZER
|
| 55 |
~UTS_NS ~NET_NS
|
| 56 |
~VETH ~MACVLAN
|
| 57 |
|
| 58 |
~POSIX_MQUEUE
|
| 59 |
~!NETPRIO_CGROUP
|
| 60 |
|
| 61 |
~!GRKERNSEC_CHROOT_MOUNT
|
| 62 |
~!GRKERNSEC_CHROOT_DOUBLE
|
| 63 |
~!GRKERNSEC_CHROOT_PIVOT
|
| 64 |
~!GRKERNSEC_CHROOT_CHMOD
|
| 65 |
~!GRKERNSEC_CHROOT_CAPS
|
| 66 |
"
|
| 67 |
|
| 68 |
ERROR_DEVPTS_MULTIPLE_INSTANCES="CONFIG_DEVPTS_MULTIPLE_INSTANCES: needed for pts inside container"
|
| 69 |
|
| 70 |
ERROR_CGROUP_FREEZER="CONFIG_CGROUP_FREEZER: needed to freeze containers"
|
| 71 |
|
| 72 |
ERROR_UTS_NS="CONFIG_UTS_NS: needed to unshare hostnames and uname info"
|
| 73 |
ERROR_NET_NS="CONFIG_NET_NS: needed for unshared network"
|
| 74 |
|
| 75 |
ERROR_VETH="CONFIG_VETH: needed for internal (host-to-container) networking"
|
| 76 |
ERROR_MACVLAN="CONFIG_MACVLAN: needed for internal (inter-container) networking"
|
| 77 |
|
| 78 |
ERROR_POSIX_MQUEUE="CONFIG_POSIX_MQUEUE: needed for lxc-execute command"
|
| 79 |
|
| 80 |
ERROR_NETPRIO_CGROUP="CONFIG_NETPRIO_CGROUP: as of kernel 3.3 and lxc 0.8.0_rc1 this causes LXCs to fail booting."
|
| 81 |
|
| 82 |
ERROR_GRKERNSEC_CHROOT_MOUNT=":CONFIG_GRKERNSEC_CHROOT_MOUNT some GRSEC features make LXC unusable see postinst notes"
|
| 83 |
ERROR_GRKERNSEC_CHROOT_DOUBLE=":CONFIG_GRKERNSEC_CHROOT_DOUBLE some GRSEC features make LXC unusable see postinst notes"
|
| 84 |
ERROR_GRKERNSEC_CHROOT_PIVOT=":CONFIG_GRKERNSEC_CHROOT_PIVOT some GRSEC features make LXC unusable see postinst notes"
|
| 85 |
ERROR_GRKERNSEC_CHROOT_CHMOD=":CONFIG_GRKERNSEC_CHROOT_CHMOD some GRSEC features make LXC unusable see postinst notes"
|
| 86 |
ERROR_GRKERNSEC_CHROOT_CAPS=":CONFIG_GRKERNSEC_CHROOT_CAPS some GRSEC features make LXC unusable see postinst notes"
|
| 87 |
|
| 88 |
DOCS=(AUTHORS CONTRIBUTING MAINTAINERS TODO README doc/FAQ.txt)
|
| 89 |
|
| 90 |
src_prepare() {
|
| 91 |
if [[ -n ${BACKPORTS} ]]; then
|
| 92 |
epatch "${WORKDIR}"/patches/*
|
| 93 |
eautoreconf
|
| 94 |
fi
|
| 95 |
}
|
| 96 |
|
| 97 |
src_configure() {
|
| 98 |
append-flags -fno-strict-aliasing
|
| 99 |
|
| 100 |
econf \
|
| 101 |
--localstatedir=/var \
|
| 102 |
--bindir=/usr/sbin \
|
| 103 |
--docdir=/usr/share/doc/${PF} \
|
| 104 |
--with-config-path=/etc/lxc \
|
| 105 |
--with-rootfs-path=/usr/lib/lxc/rootfs \
|
| 106 |
--enable-doc \
|
| 107 |
$(use_enable examples)
|
| 108 |
}
|
| 109 |
|
| 110 |
src_install() {
|
| 111 |
default
|
| 112 |
|
| 113 |
rm -r "${D}"/usr/sbin/lxc-setcap \
|
| 114 |
|| die "unable to remove lxc-setcap"
|
| 115 |
|
| 116 |
keepdir /etc/lxc /usr/lib/lxc/rootfs
|
| 117 |
|
| 118 |
find "${D}" -name '*.la' -delete
|
| 119 |
|
| 120 |
use vanilla && return 0
|
| 121 |
|
| 122 |
# Gentoo-specific additions!
|
| 123 |
newinitd "${FILESDIR}/${PN}.initd.2" ${PN}
|
| 124 |
keepdir /var/log/lxc
|
| 125 |
}
|
| 126 |
|
| 127 |
pkg_postinst() {
|
| 128 |
if ! use vanilla; then
|
| 129 |
elog "There is an init script provided with the package now; no documentation"
|
| 130 |
elog "is currently available though, so please check out /etc/init.d/lxc ."
|
| 131 |
elog "You _should_ only need to symlink it to /etc/init.d/lxc.configname"
|
| 132 |
elog "to start the container defined into /etc/lxc/configname.conf ."
|
| 133 |
elog "For further information about LXC development see"
|
| 134 |
elog "http://blog.flameeyes.eu/tag/lxc" # remove once proper doc is available
|
| 135 |
elog ""
|
| 136 |
fi
|
| 137 |
ewarn "With version 0.7.4, the mountpoint syntax came back to the one used by 0.7.2"
|
| 138 |
ewarn "and previous versions. This means you'll have to use syntax like the following"
|
| 139 |
ewarn ""
|
| 140 |
ewarn " lxc.rootfs = /container"
|
| 141 |
ewarn " lxc.mount.entry = /usr/portage /container/usr/portage none bind 0 0"
|
| 142 |
ewarn ""
|
| 143 |
ewarn "To use the Fedora, Debian and (various) Ubuntu auto-configuration scripts, you"
|
| 144 |
ewarn "will need sys-apps/yum or dev-util/debootstrap."
|
| 145 |
ewarn ""
|
| 146 |
ewarn "Some GrSecurity settings in relation to chroot security will cause LXC not to"
|
| 147 |
ewarn "work, while others will actually make it much more secure. Please refer to"
|
| 148 |
ewarn "Diego Elio Pettenò's weblog at http://blog.flameeyes.eu/tag/lxc for further"
|
| 149 |
ewarn "details."
|
| 150 |
}
|