diff options
Diffstat (limited to 'app-misc/execwrap/execwrap-0.5.ebuild')
-rw-r--r-- | app-misc/execwrap/execwrap-0.5.ebuild | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/app-misc/execwrap/execwrap-0.5.ebuild b/app-misc/execwrap/execwrap-0.5.ebuild new file mode 100644 index 0000000..5870e86 --- /dev/null +++ b/app-misc/execwrap/execwrap-0.5.ebuild @@ -0,0 +1,76 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit eutils toolchain-funcs + +KEYWORDS="~amd64 ~x86" +DESCRIPTION="ExecWrap is a super-user exec wrapper (not only) for the lighttpd web-server" +HOMEPAGE="http://freebsd.unixfreunde.de/sources/" +SRC_URI="http://freebsd.unixfreunde.de/sources/ExecWrap-${PV}.tgz" +LICENSE="BSD" +SLOT="0" +IUSE="lighttpd" + +DEPEND="" +RDEPEND="lighttpd? ( www-servers/lighttpd )" + +pkg_setup() { + einfo + einfo "You can manipulate several configure options of this" + einfo "ebuild through environment variables:" + einfo + einfo "PARENT_UID: UID of the user your parent process runs as (default: 1)" + einfo "TARGET_MIN_UID: Minimum UID allowed to run scripts (default: 1000)" + einfo "TARGET_MIN_GID: Minimum GID allowed to run scripts (default: 100)" + einfo "TARGET_PATH_PREFIX: The prefix required for scripts to be executed (default: /usr/local/)" + einfo + + if use lighttpd; then + local -i lighttpd_uid=$(egetent passwd lighttpd 2>/dev/null | cut -d : -f 3) + if [[ ${lighttpd_uid} > 0 ]]; then + PARENT_UID=${lighttpd_uid} + TARGET_PATH_PREFIX="/var/www/" + einfo "Using values suitable for lighttpd." + einfo + fi + fi + + : ${PARENT_UID:=1} + : ${TARGET_MIN_UID:=1000} + : ${TARGET_MIN_GID:=100} + : ${TARGET_PATH_PREFIX:=/usr/local/} + + einfo "Using PARENT_UID ${PARENT_UID}" + einfo "Using TARGET_MIN_UID ${TARGET_MIN_UID}" + einfo "Using TARGET_MIN_GID ${TARGET_MIN_GID}" + einfo "Using TARGET_PATH_PREFIX ${TARGET_PATH_PREFIX}" + einfo +} + +src_unpack() { + unpack ${A} + cd ${WORKDIR} + sed -i \ + -e "s:^#define PARENT_UID[[:space:]].*$:#define PARENT_UID ${PARENT_UID}:g" \ + -e "s:^#define TARGET_MIN_UID[[:space:]].*$:#define TARGET_MIN_UID ${TARGET_MIN_UID}:g" \ + -e "s:^#define TARGET_MIN_GID[[:space:]].*$:#define TARGET_MIN_GID ${TARGET_MIN_GID}:g" \ + -e "s:^#define TARGET_PATH_PREFIX[[:space:]].*$:#define TARGET_PATH_PREFIX \"${TARGET_PATH_PREFIX}\":g" \ + execwrap_config.h \ + || die "sed failed" +} + +src_compile() { + $(tc-getCC) ${CFLAGS} -o ${PN} ${PN}.c || die "compilation failed" +} + +src_install() { + dobin ${PN} + dodoc README + if use lighttpd; then + fowners root:lighttpd "${ROOT}"usr/bin/${PN} + fperms 4710 "${ROOT}"usr/bin/${PN} + else + fperms 4711 "${ROOT}"usr/bin/${PN} + fi +} |