lxc-1.0.8.ebuild 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. MY_P="${P/_/-}"
  5. PYTHON_COMPAT=( python3_4 )
  6. DISTUTILS_OPTIONAL=1
  7. inherit autotools bash-completion-r1 distutils-r1 eutils linux-info versionator flag-o-matic systemd
  8. DESCRIPTION="LinuX Containers userspace utilities"
  9. HOMEPAGE="https://linuxcontainers.org/"
  10. SRC_URI="https://github.com/lxc/lxc/archive/${MY_P}.tar.gz"
  11. KEYWORDS="amd64 ~arm ~arm64 ppc64 x86"
  12. LICENSE="LGPL-3"
  13. SLOT="0"
  14. IUSE="doc examples lua python seccomp"
  15. RDEPEND="net-libs/gnutls
  16. sys-libs/libcap
  17. lua? ( >=dev-lang/lua-5.1:= )
  18. python? ( ${PYTHON_DEPS} )
  19. seccomp? ( sys-libs/libseccomp )"
  20. DEPEND="${RDEPEND}
  21. doc? ( app-text/docbook-sgml-utils )
  22. >=sys-kernel/linux-headers-3.2"
  23. RDEPEND="${RDEPEND}
  24. sys-apps/util-linux
  25. app-misc/pax-utils
  26. virtual/awk"
  27. CONFIG_CHECK="~CGROUPS ~CGROUP_DEVICE
  28. ~CPUSETS ~CGROUP_CPUACCT
  29. ~RESOURCE_COUNTERS
  30. ~CGROUP_SCHED
  31. ~NAMESPACES
  32. ~IPC_NS ~USER_NS ~PID_NS
  33. ~DEVPTS_MULTIPLE_INSTANCES
  34. ~CGROUP_FREEZER
  35. ~UTS_NS ~NET_NS
  36. ~VETH ~MACVLAN
  37. ~POSIX_MQUEUE
  38. ~!NETPRIO_CGROUP
  39. ~!GRKERNSEC_CHROOT_MOUNT
  40. ~!GRKERNSEC_CHROOT_DOUBLE
  41. ~!GRKERNSEC_CHROOT_PIVOT
  42. ~!GRKERNSEC_CHROOT_CHMOD
  43. ~!GRKERNSEC_CHROOT_CAPS
  44. ~!GRKERNSEC_PROC
  45. "
  46. ERROR_DEVPTS_MULTIPLE_INSTANCES="CONFIG_DEVPTS_MULTIPLE_INSTANCES: needed for pts inside container"
  47. ERROR_CGROUP_FREEZER="CONFIG_CGROUP_FREEZER: needed to freeze containers"
  48. ERROR_UTS_NS="CONFIG_UTS_NS: needed to unshare hostnames and uname info"
  49. ERROR_NET_NS="CONFIG_NET_NS: needed for unshared network"
  50. ERROR_VETH="CONFIG_VETH: needed for internal (host-to-container) networking"
  51. ERROR_MACVLAN="CONFIG_MACVLAN: needed for internal (inter-container) networking"
  52. ERROR_POSIX_MQUEUE="CONFIG_POSIX_MQUEUE: needed for lxc-execute command"
  53. ERROR_NETPRIO_CGROUP="CONFIG_NETPRIO_CGROUP: as of kernel 3.3 and lxc 0.8.0_rc1 this causes LXCs to fail booting."
  54. ERROR_GRKERNSEC_CHROOT_MOUNT=":CONFIG_GRKERNSEC_CHROOT_MOUNT some GRSEC features make LXC unusable see postinst notes"
  55. ERROR_GRKERNSEC_CHROOT_DOUBLE=":CONFIG_GRKERNSEC_CHROOT_DOUBLE some GRSEC features make LXC unusable see postinst notes"
  56. ERROR_GRKERNSEC_CHROOT_PIVOT=":CONFIG_GRKERNSEC_CHROOT_PIVOT some GRSEC features make LXC unusable see postinst notes"
  57. ERROR_GRKERNSEC_CHROOT_CHMOD=":CONFIG_GRKERNSEC_CHROOT_CHMOD some GRSEC features make LXC unusable see postinst notes"
  58. ERROR_GRKERNSEC_CHROOT_CAPS=":CONFIG_GRKERNSEC_CHROOT_CAPS some GRSEC features make LXC unusable see postinst notes"
  59. ERROR_GRKERNSEC_PROC=":CONFIG_GRKERNSEC_PROC: this GRSEC feature is incompatible with unprivileged containers"
  60. DOCS=(AUTHORS CONTRIBUTING MAINTAINERS NEWS README doc/FAQ.txt)
  61. S="${WORKDIR}/${PN}-${MY_P}"
  62. REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
  63. src_prepare() {
  64. sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.ac || die
  65. if [[ -n ${BACKPORTS} ]]; then
  66. epatch "${WORKDIR}"/patches/*
  67. fi
  68. epatch "${FILESDIR}"/${PN}-1.0.8-bash-completion.patch
  69. eautoreconf
  70. }
  71. src_configure() {
  72. append-flags -fno-strict-aliasing
  73. econf \
  74. --localstatedir=/var \
  75. --bindir=/usr/sbin \
  76. --docdir=/usr/share/doc/${PF} \
  77. --with-config-path=/etc/lxc \
  78. --with-rootfs-path=/usr/lib/lxc/rootfs \
  79. --with-distro=gentoo \
  80. $(use_enable doc) \
  81. --disable-apparmor \
  82. $(use_enable examples) \
  83. $(use_enable lua) \
  84. $(use_enable seccomp) \
  85. --disable-python
  86. }
  87. python_compile() {
  88. distutils-r1_python_compile build_ext -I ../ -L ../${PN}
  89. }
  90. src_compile() {
  91. default
  92. if use python; then
  93. pushd "${S}/src/python-${PN}" > /dev/null
  94. distutils-r1_src_compile
  95. popd > /dev/null
  96. fi
  97. }
  98. src_install() {
  99. default
  100. mv "${ED}"/usr/share/bash-completion/completions/${PN} "${ED}"/$(get_bashcompdir)/${PN}-start || die
  101. bashcomp_alias ${PN}-start \
  102. ${PN}-{attach,cgroup,clone,console,create,destroy,device,execute,freeze,info,monitor,snapshot,start-ephemeral,stop,unfreeze,wait}
  103. if use python; then
  104. pushd "${S}/src/python-lxc" > /dev/null
  105. # Unset DOCS. This has been handled by the default target
  106. unset DOCS
  107. distutils-r1_src_install
  108. popd > /dev/null
  109. fi
  110. keepdir /etc/lxc /usr/lib/lxc/rootfs /var/log/lxc
  111. find "${D}" -name '*.la' -delete
  112. # Gentoo-specific additions!
  113. # Use initd.3 per #517144
  114. newinitd "${FILESDIR}/${PN}.initd.3" ${PN}
  115. # lxc-devsetup script
  116. exeinto /usr/libexec/${PN}
  117. doexe config/init/systemd/${PN}-devsetup
  118. # Use that script with the systemd service (Similar to upstream
  119. # Makefile.am
  120. cp "${FILESDIR}"/${PN}_at.service ${PN}_at.service || die
  121. sed -i \
  122. "/Restart=always/a ExecStartPre=/usr/libexec/${PN}/${PN}-devsetup" \
  123. ${PN}_at.service \
  124. || die "Failed to add ${PN}-devsetup to the systemd service file"
  125. systemd_newunit ${PN}_at.service "lxc@.service"
  126. }
  127. pkg_postinst() {
  128. elog "There is an init script provided with the package now; no documentation"
  129. elog "is currently available though, so please check out /etc/init.d/lxc ."
  130. elog "You _should_ only need to symlink it to /etc/init.d/lxc.configname"
  131. elog "to start the container defined into /etc/lxc/configname.conf ."
  132. elog "For further information about LXC development see"
  133. elog "http://blog.flameeyes.eu/tag/lxc" # remove once proper doc is available
  134. elog ""
  135. ewarn "With version 0.7.4, the mountpoint syntax came back to the one used by 0.7.2"
  136. ewarn "and previous versions. This means you'll have to use syntax like the following"
  137. ewarn ""
  138. ewarn " lxc.rootfs = /container"
  139. ewarn " lxc.mount.entry = /usr/portage /container/usr/portage none bind 0 0"
  140. ewarn ""
  141. ewarn "To use the Fedora, Debian and (various) Ubuntu auto-configuration scripts, you"
  142. ewarn "will need sys-apps/yum or dev-util/debootstrap."
  143. ewarn ""
  144. ewarn "Some GrSecurity settings in relation to chroot security will cause LXC not to"
  145. ewarn "work, while others will actually make it much more secure. Please refer to"
  146. ewarn "Diego Elio Pettenò's weblog at http://blog.flameeyes.eu/tag/lxc for further"
  147. ewarn "details."
  148. }