lxc-2.0.3-r1.ebuild 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. MY_P="${P/_/-}"
  5. PYTHON_COMPAT=( python{3_4,3_5} )
  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"
  12. LICENSE="LGPL-3"
  13. SLOT="0"
  14. IUSE="cgmanager doc examples lua python seccomp"
  15. RDEPEND="net-libs/gnutls
  16. sys-libs/libcap
  17. cgmanager? ( app-admin/cgmanager )
  18. lua? ( >=dev-lang/lua-5.1:= )
  19. python? ( ${PYTHON_DEPS} )
  20. seccomp? ( sys-libs/libseccomp )"
  21. DEPEND="${RDEPEND}
  22. doc? ( app-text/docbook-sgml-utils )
  23. >=sys-kernel/linux-headers-3.2"
  24. RDEPEND="${RDEPEND}
  25. sys-process/criu
  26. sys-apps/util-linux
  27. app-misc/pax-utils
  28. virtual/awk"
  29. CONFIG_CHECK="~CGROUPS ~CGROUP_DEVICE
  30. ~CPUSETS ~CGROUP_CPUACCT
  31. ~CGROUP_SCHED
  32. ~NAMESPACES
  33. ~IPC_NS ~USER_NS ~PID_NS
  34. ~NETLINK_DIAG ~PACKET_DIAG
  35. ~INET_UDP_DIAG ~INET_TCP_DIAG
  36. ~UNIX_DIAG ~CHECKPOINT_RESTORE
  37. ~DEVPTS_MULTIPLE_INSTANCES
  38. ~CGROUP_FREEZER
  39. ~UTS_NS ~NET_NS
  40. ~VETH ~MACVLAN
  41. ~POSIX_MQUEUE
  42. ~!NETPRIO_CGROUP
  43. ~!GRKERNSEC_CHROOT_MOUNT
  44. ~!GRKERNSEC_CHROOT_DOUBLE
  45. ~!GRKERNSEC_CHROOT_PIVOT
  46. ~!GRKERNSEC_CHROOT_CHMOD
  47. ~!GRKERNSEC_CHROOT_CAPS
  48. ~!GRKERNSEC_PROC
  49. ~!GRKERNSEC_SYSFS_RESTRICT
  50. "
  51. ERROR_DEVPTS_MULTIPLE_INSTANCES="CONFIG_DEVPTS_MULTIPLE_INSTANCES: needed for pts inside container"
  52. ERROR_CGROUP_FREEZER="CONFIG_CGROUP_FREEZER: needed to freeze containers"
  53. ERROR_UTS_NS="CONFIG_UTS_NS: needed to unshare hostnames and uname info"
  54. ERROR_NET_NS="CONFIG_NET_NS: needed for unshared network"
  55. ERROR_VETH="CONFIG_VETH: needed for internal (host-to-container) networking"
  56. ERROR_MACVLAN="CONFIG_MACVLAN: needed for internal (inter-container) networking"
  57. ERROR_NETLINK_DIAG="CONFIG_NETLINK_DIAG: needed for lxc-checkpoint"
  58. ERROR_PACKET_DIAG="CONFIG_PACKET_DIAG: needed for lxc-checkpoint"
  59. ERROR_INET_UDP_DIAG="CONFIG_INET_UDP_DIAG: needed for lxc-checkpoint"
  60. ERROR_INET_TCP_DIAG="CONFIG_INET_TCP_DIAG: needed for lxc-checkpoint"
  61. ERROR_UNIX_DIAG="CONFIG_UNIX_DIAG: needed for lxc-checkpoint"
  62. ERROR_CHECKPOINT_RESTORE="CONFIG_CHECKPOINT_RESTORE: needed for lxc-checkpoint"
  63. ERROR_POSIX_MQUEUE="CONFIG_POSIX_MQUEUE: needed for lxc-execute command"
  64. ERROR_NETPRIO_CGROUP="CONFIG_NETPRIO_CGROUP: as of kernel 3.3 and lxc 0.8.0_rc1 this causes LXCs to fail booting."
  65. ERROR_GRKERNSEC_CHROOT_MOUNT="CONFIG_GRKERNSEC_CHROOT_MOUNT: some GRSEC features make LXC unusable see postinst notes"
  66. ERROR_GRKERNSEC_CHROOT_DOUBLE="CONFIG_GRKERNSEC_CHROOT_DOUBLE: some GRSEC features make LXC unusable see postinst notes"
  67. ERROR_GRKERNSEC_CHROOT_PIVOT="CONFIG_GRKERNSEC_CHROOT_PIVOT: some GRSEC features make LXC unusable see postinst notes"
  68. ERROR_GRKERNSEC_CHROOT_CHMOD="CONFIG_GRKERNSEC_CHROOT_CHMOD: some GRSEC features make LXC unusable see postinst notes"
  69. ERROR_GRKERNSEC_CHROOT_CAPS="CONFIG_GRKERNSEC_CHROOT_CAPS: some GRSEC features make LXC unusable see postinst notes"
  70. ERROR_GRKERNSEC_PROC="CONFIG_GRKERNSEC_PROC: this GRSEC feature is incompatible with unprivileged containers"
  71. ERROR_GRKERNSEC_SYSFS_RESTRICT="CONFIG_GRKERNSEC_SYSFS_RESTRICT: this GRSEC feature is incompatible with unprivileged containers"
  72. DOCS=(AUTHORS CONTRIBUTING MAINTAINERS NEWS README doc/FAQ.txt)
  73. S="${WORKDIR}/${PN}-${MY_P}"
  74. REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
  75. src_prepare() {
  76. epatch "${FILESDIR}"/${P}-bash-completion.patch
  77. #558854
  78. epatch "${FILESDIR}"/${P}-omit-sysconfig.patch
  79. eautoreconf
  80. }
  81. src_configure() {
  82. append-flags -fno-strict-aliasing
  83. if use python; then
  84. #541932
  85. python_setup "python3*"
  86. export PKG_CONFIG_PATH="${T}/${EPYTHON}/pkgconfig:${PKG_CONFIG_PATH}"
  87. fi
  88. # I am not sure about the --with-rootfs-path
  89. # /var/lib/lxc is probably more appropriate than
  90. # /usr/lib/lxc.
  91. econf \
  92. --localstatedir=/var \
  93. --bindir=/usr/bin \
  94. --sbindir=/usr/bin \
  95. --docdir=/usr/share/doc/${PF} \
  96. --with-config-path=/var/lib/lxc \
  97. --with-rootfs-path=/var/lib/lxc/rootfs \
  98. --with-distro=gentoo \
  99. --with-runtime-path=/run \
  100. --disable-apparmor \
  101. $(use_enable cgmanager) \
  102. $(use_enable doc) \
  103. $(use_enable examples) \
  104. $(use_enable lua) \
  105. $(use_enable python) \
  106. $(use_enable seccomp)
  107. }
  108. python_compile() {
  109. distutils-r1_python_compile build_ext -I ../ -L ../${PN}
  110. }
  111. src_compile() {
  112. default
  113. if use python; then
  114. pushd "${S}/src/python-${PN}" > /dev/null
  115. distutils-r1_src_compile
  116. popd > /dev/null
  117. fi
  118. }
  119. src_install() {
  120. default
  121. mv "${ED}"/usr/share/bash-completion/completions/${PN} "${ED}"/$(get_bashcompdir)/${PN}-start || die
  122. # start-ephemeral is no longer a command but removing it here
  123. # generates QA warnings (still in upstream completion script)
  124. bashcomp_alias ${PN}-start \
  125. ${PN}-{attach,cgroup,copy,console,create,destroy,device,execute,freeze,info,monitor,snapshot,start-ephemeral,stop,unfreeze,wait}
  126. if use python; then
  127. pushd "${S}/src/python-lxc" > /dev/null
  128. # Unset DOCS. This has been handled by the default target
  129. unset DOCS
  130. distutils-r1_src_install
  131. popd > /dev/null
  132. fi
  133. keepdir /etc/lxc /var/lib/lxc/rootfs /var/log/lxc
  134. find "${D}" -name '*.la' -delete
  135. # Gentoo-specific additions!
  136. newinitd "${FILESDIR}/${PN}.initd.5" ${PN}
  137. # Remember to compare our systemd unit file with the upstream one
  138. # config/init/systemd/lxc.service.in
  139. systemd_newunit "${FILESDIR}"/${PN}_at.service.4 "lxc@.service"
  140. }
  141. pkg_postinst() {
  142. elog ""
  143. elog "Starting from version ${PN}-1.1.0-r3, the default lxc path has been"
  144. elog "moved from /etc/lxc to /var/lib/lxc. If you still want to use /etc/lxc"
  145. elog "please add the following to your /etc/lxc/default.conf"
  146. elog "lxc.lxcpath = /etc/lxc"
  147. elog ""
  148. elog "There is an init script provided with the package now; no documentation"
  149. elog "is currently available though, so please check out /etc/init.d/lxc ."
  150. elog "You _should_ only need to symlink it to /etc/init.d/lxc.configname"
  151. elog "to start the container defined into /etc/lxc/configname.conf ."
  152. elog "For further information about LXC development see"
  153. elog "http://blog.flameeyes.eu/tag/lxc" # remove once proper doc is available
  154. elog ""
  155. }