# Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: $ ## ugly but seems to be the only (semi-rename-proof) solution: MY_P="thttpd-${PV/_beta1/beta1-titan-}" DESCRIPTION="Small, fast, secure (select-model) webserver -- suitable for mass-hosting." HOMEPAGE="http://titan.hpcs.com/thttpd/ http://www.acme.com/software/thttpd/" SRC_URI="http://titan.hpcs.com/thttpd//${MY_P}.tar.gz" LICENSE="BSD" SLOT="0" KEYWORDS="x86" IUSE="" DEPEND="virtual/glibc" S=${WORKDIR}/${MY_P} src_unpack() { unpack ${A} cd ${S} ## adjust config.h: cp -a config.h config.h.org ## sed-bits: (some of this need a local USE-FLAG) ## 1. set php-interpreter to use. ## 2. prevent serving of cgis (files with exec-bit have to be cgis!). ## 3. supress our version -- only say we are "thttpd" (paranoia-setting). ## 4. user-homes live in webroot -- so we can chroot() the server. ## 5. running CGIs under the owner's uid prevents running thttpd as non-root. ## TODO: ## - syslog: errors to syslog instead of stderr. ## - stats-reporting: once a day instead of once per hour. ## - auth-file handling: recurse, use-global, ... ? ## - handlers: remove all, completely custom, ... ? ## ... chroot, vhost (vhost-dirlevels), default-user, indexes, ... (more?) cat config.h.org |\ sed -e "s@/usr/local/bin/php@/home/tom/bin/php@" \ -e "s@#define IGNORE_NON_CGI_EXEC@#undef IGNORE_NON_CGI_EXEC@" \ -e "s@#define SHOW_SERVER_VERSION@#undef SHOW_SERVER_VERSION@" \ -e 's@#define TILDE_MAP_2 "public_html"@#define TILDE_MAP_1 "users"@' \ > config.h #-e "s@#define RUN_CGI_AS_OWNER@#undef RUN_CGI_AS_OWNER@" \ ## f*ck off ... copy the config.h from ${FILESDIR} to make live easier: ## TODO: maybe some day we comment this out and reactivate the above sed-stuff. cp ${FILESDIR}/config.h ${S} || die "config.h-copy failed" ## ipv6 cannot be removed easily :( #echo -e "\n/* manually remove ipv6-support */\n#undef USE_IPV6" >> config.h } src_compile() { econf || die emake WEBDIR=/home/httpd/thttpd || die } src_install () { mkdir -p ${D}/usr/share/man/man1 einstall \ prefix=${D}/usr \ MANDIR=${D}/usr/share/man \ WEBGROUP=nogroup \ WEBDIR=${D}/var/www ## rename to allow the thttpd-variants to be installed in parallel: mv ${D}/usr/sbin/thttpd{,-titan} || die "rename failed" mv ${D}/usr/share/man/man8/thttpd{,-titan}.8 || die "rename failed" ## htpasswd is identical for all thttpd-variants: mv ${D}/usr/sbin/{,th_}htpasswd mv ${D}/usr/share/man/man1/{,th_}htpasswd.1 exeinto /etc/init.d newexe ${FILESDIR}/thttpd-titan.init thttpd-titan insinto /etc/conf.d newins ${FILESDIR}/thttpd-titan.confd thttpd-titan dodoc README FILES TODO INSTALL CHANGES-titan insinto /etc/thttpd/ doins ${FILESDIR}/thttpd-titan.conf.sample ## add original and our config.h used to the documentation: dodoc config.h.org config.h } pkg_postinst() { einfo "This is the patched (titan-) version of thttpd (see \"CHANGES-titan\")" einfo "Adjust THTTPD_DOCROOT in /etc/conf.d/thttpd !" echo einfo "If you switch between \"thttpd-vanilla\" and \"thttpd-titan\" BEWARE of blank-lines" einfo "in the config-file -- only the titan-version allows them." }