gentoo-overlay/sys-cluster/util-vserver/util-vserver-0.30.216_pre3131.ebuild

150 lines
3.8 KiB
Bash
Raw Normal View History

2019-02-18 23:34:11 -06:00
# Copyright 1999-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
2019-02-19 02:59:05 -06:00
EAPI=6
2019-02-18 23:34:11 -06:00
inherit eutils bash-completion-r1
MY_P="${P/_/-}"
DESCRIPTION="Linux-VServer admin utilities"
HOMEPAGE="http://www.nongnu.org/util-vserver/"
SRC_URI="http://people.linux-vserver.org/~dhozac/t/uv-testing/${MY_P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
2019-02-19 02:59:05 -06:00
KEYWORDS="~alpha ~amd64 ~x86"
2019-03-29 13:53:25 -05:00
IUSE="beecrypt +dietlibc +nss"
2019-02-18 23:34:11 -06:00
CDEPEND="
net-misc/vconfig
2019-03-29 13:53:25 -05:00
beecrypt? ( dev-libs/beecrypt )
nss? ( dev-libs/nss )
2019-02-19 02:59:05 -06:00
sys-apps/iproute2
net-firewall/iptables"
2019-02-18 23:34:11 -06:00
DEPEND="
${CDEPEND}
2019-03-26 06:09:54 -05:00
dietlibc? ( >dev-libs/dietlibc-0.33 )"
2019-02-18 23:34:11 -06:00
RDEPEND="
${CDEPEND}"
2019-03-29 13:53:25 -05:00
REQUIRED_USE="
?? (
beecrypt
nss
)"
2019-02-18 23:34:11 -06:00
S="${WORKDIR}/${MY_P}"
2019-03-26 06:09:54 -05:00
DOCS=( README ChangeLog NEWS AUTHORS THANKS util-vserver.spec )
src_prepare() {
if use dietlibc ; then
eapply "${FILESDIR}/${P}-dietlibc.patch"
fi
eapply "${FILESDIR}/${PN}-init-functions.patch"
eapply_user
}
2019-02-19 02:59:05 -06:00
2019-02-18 23:34:11 -06:00
pkg_setup() {
if [[ -z "${VDIRBASE}" ]]; then
einfo
einfo "You can change the default vserver base directory (/vservers)"
einfo "by setting the VDIRBASE environment variable."
fi
: ${VDIRBASE:=/vservers}
einfo
einfo "Using \"${VDIRBASE}\" as vserver base directory"
einfo
}
src_test() {
# do not use $D from portage by accident (#297982)
sed -i -e 's/^\$D //' "${S}"/src/testsuite/vunify-test.sh || die
default
}
src_configure() {
2019-04-11 10:15:57 -05:00
local myeconf=" --with-vrootdir=${VDIRBASE} --with-initscripts=gentoo --localstatedir=/var"
2019-02-18 23:34:11 -06:00
2019-03-26 06:09:54 -05:00
if ! use dietlibc ; then
2019-04-11 10:15:57 -05:00
myeconf+=" --disable-dietlibc"
2019-03-26 06:09:54 -05:00
fi
2019-03-29 13:53:25 -05:00
if use nss ; then
2019-04-11 10:15:57 -05:00
myeconf+=" --with-crypto-api=nss"
2019-03-29 13:53:25 -05:00
elif use beecrypt ; then
2019-04-11 10:15:57 -05:00
myeconf+=" --with-crypto-api=beecrypt"
2019-03-29 13:53:25 -05:00
else
2019-04-11 10:15:57 -05:00
myeconf+=" --with-crypto-api=none"
2019-03-29 13:53:25 -05:00
fi
2019-04-11 10:15:57 -05:00
econf ${myeconf}
2019-02-18 23:34:11 -06:00
}
src_compile() {
2019-02-19 02:59:05 -06:00
emake -j1
2019-02-18 23:34:11 -06:00
}
src_install() {
2019-02-19 02:59:05 -06:00
make DESTDIR="${D}" install install-distribution || die
2019-02-18 23:34:11 -06:00
2019-02-19 05:27:35 -06:00
# remove runtime paths
rm -rf "${D}"/var/run
rm -rf "${D}"/var/cache
2019-02-18 23:34:11 -06:00
# keep dirs
keepdir "${VDIRBASE}"
keepdir "${VDIRBASE}"/.pkg
# bash-completion
newbashcomp "${FILESDIR}"/bash_completion ${PN}
}
pkg_postinst() {
2019-03-26 06:09:54 -05:00
if ! use dietlibc ; then
ewarn "dietlibc isn't just used to replace glibc, it is used to"
ewarn "build static binaries which are actually 'static'"
ewarn "note that glibc cannot build self contained binaries"
ewarn "anymore, even if you build them 'statically' they will"
ewarn "dynamically load resolver libraries, which in the case"
ewarn "of guest management might be from the host or from the"
ewarn "guest."
ewarn "Anytime you start or enter the guest, you"
ewarn "have a certain chance that the host will execute some"
ewarn "code from the guest system (nss) which in turn gives"
ewarn "guest root a good chance to do evil things on the host"
ewarn "and even if security is not a concern in your case, you"
2019-03-29 13:53:25 -05:00
ewarn "might end up with unexpected failures"
2019-03-26 06:09:54 -05:00
fi
2019-02-18 23:34:11 -06:00
# Create VDIRBASE in postinst, so it is (a) not unmerged and (b) also
# present when merging.
mkdir -p "${VDIRBASE}" || die
if ! setattr --barrier "${VDIRBASE}"; then
ewarn "Filesystem on ${VDIRBASE} does not support chroot barriers."
ewarn "Chroot barrier is additional security measure that is used"
ewarn "when two vservers or the host system share the same filesystem."
ewarn "If you intend to use separate filesystem for every vserver"
ewarn "you can safely ignore this warning."
ewarn "To manually apply a barrier use: setattr --barrier ${VDIRBASE}"
ewarn "For details see: http://linux-vserver.org/Secure_chroot_Barrier"
fi
rm /etc/vservers/.defaults/vdirbase || die
ln -sf "${VDIRBASE}" /etc/vservers/.defaults/vdirbase || die
elog
elog "You have to run the vprocunhide command after every reboot"
elog "in order to setup /proc permissions correctly for vserver"
elog "use. An init script has been installed by this package."
elog "To use it you should add it to a runlevel:"
elog
elog " rc-update add vprocunhide default"
elog
}