| 1 |
mrness |
1.1 |
# Copyright 1999-2008 Gentoo Foundation
|
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
jer |
1.8 |
# $Header: /var/cvsroot/gentoo-x86/net-proxy/wwwoffle/wwwoffle-2.9d.ebuild,v 1.7 2008/07/24 17:45:13 armin76 Exp $
|
| 4 |
mrness |
1.1 |
|
| 5 |
|
|
inherit eutils
|
| 6 |
|
|
|
| 7 |
mrness |
1.2 |
DESCRIPTION="Web caching proxy suitable for non-permanent Internet connections"
|
| 8 |
mrness |
1.1 |
SRC_URI="http://www.gedanken.demon.co.uk/download-wwwoffle/${P}.tgz"
|
| 9 |
|
|
HOMEPAGE="http://www.gedanken.demon.co.uk/wwwoffle"
|
| 10 |
|
|
|
| 11 |
armin76 |
1.7 |
KEYWORDS="amd64 ppc ppc64 sparc x86"
|
| 12 |
mrness |
1.1 |
SLOT="0"
|
| 13 |
|
|
LICENSE="GPL-2"
|
| 14 |
|
|
IUSE="gnutls ipv6 zlib"
|
| 15 |
|
|
|
| 16 |
|
|
RDEPEND="gnutls? ( net-libs/gnutls )
|
| 17 |
|
|
zlib? ( sys-libs/zlib )"
|
| 18 |
|
|
DEPEND="dev-lang/perl
|
| 19 |
|
|
sys-devel/flex
|
| 20 |
|
|
${RDEPEND}"
|
| 21 |
|
|
|
| 22 |
|
|
# Unsure whether to depend on >=www-misc/htdig-3.1.6-r4 or not
|
| 23 |
|
|
|
| 24 |
|
|
src_unpack() {
|
| 25 |
|
|
unpack ${A}
|
| 26 |
|
|
|
| 27 |
|
|
sed -i -e 's#$(TAR) xpf #$(TAR) --no-same-owner -xpf #' \
|
| 28 |
|
|
"${S}/cache/Makefile.in"
|
| 29 |
|
|
}
|
| 30 |
|
|
|
| 31 |
|
|
src_compile() {
|
| 32 |
|
|
econf $(use_with zlib) \
|
| 33 |
|
|
$(use_with gnutls) \
|
| 34 |
|
|
$(use_with ipv6) || die "econf failed"
|
| 35 |
|
|
emake || die "emake failed"
|
| 36 |
|
|
}
|
| 37 |
|
|
|
| 38 |
|
|
src_install() {
|
| 39 |
|
|
emake DESTDIR="${D}" install || die "emake install failed"
|
| 40 |
|
|
|
| 41 |
|
|
# documentation fix
|
| 42 |
|
|
# del empty doc dirs
|
| 43 |
|
|
rmdir "${D}/usr/doc/${PN}"/{it,nl,ru}
|
| 44 |
|
|
dodir /usr/share/doc
|
| 45 |
|
|
mv "${D}/usr/doc/wwwoffle" "${D}/usr/share/doc/${PF}"
|
| 46 |
|
|
rmdir "${D}/usr/doc"
|
| 47 |
|
|
|
| 48 |
|
|
# install the wwwoffled init script
|
| 49 |
|
|
newinitd "${FILESDIR}/${PN}.initd" wwwoffled
|
| 50 |
|
|
newinitd "${FILESDIR}/${PN}-online.initd" wwwoffled-online
|
| 51 |
|
|
newconfd "${FILESDIR}/${PN}-online.confd" wwwoffled-online
|
| 52 |
|
|
|
| 53 |
|
|
keepdir /var/spool/wwwoffle/{http,outgoing,monitor,lasttime,lastout,local}
|
| 54 |
|
|
for number in 1 2 3 4 5 6 7 8 9; do
|
| 55 |
|
|
keepdir "/var/spool/wwwoffle/prevtime${number}" "/var/spool/wwwoffle/prevout${number}"
|
| 56 |
|
|
done
|
| 57 |
|
|
|
| 58 |
|
|
# empty dirs are removed during update
|
| 59 |
|
|
keepdir \
|
| 60 |
|
|
/var/spool/wwwoffle/search/{mnogosearch/db,htdig/tmp,htdig/db-lasttime,htdig/db,namazu/db}
|
| 61 |
|
|
|
| 62 |
|
|
touch \
|
| 63 |
|
|
"${D}/var/spool/wwwoffle/search/htdig/wwwoffle-htdig.log" \
|
| 64 |
|
|
"${D}/var/spool/wwwoffle/search/mnogosearch/wwwoffle-mnogosearch.log" \
|
| 65 |
|
|
"${D}/var/spool/wwwoffle/search/namazu/wwwoffle-namazu.log"
|
| 66 |
|
|
|
| 67 |
|
|
# TODO htdig indexing as part of initscripts
|
| 68 |
|
|
|
| 69 |
|
|
# robots.txt modification - /var/spool/wwwoffle/html/en
|
| 70 |
|
|
# - remove Disallow: /index
|
| 71 |
|
|
sed -i -e "s|Disallow:.*/index|#Disallow: /index|" "${D}/var/spool/wwwoffle/html/en/robots.txt"
|
| 72 |
|
|
}
|
| 73 |
|
|
|
| 74 |
|
|
pkg_preinst() {
|
| 75 |
|
|
# Add a wwwoffle user
|
| 76 |
|
|
enewgroup wwwoffle
|
| 77 |
|
|
enewuser wwwoffle -1 -1 /var/spool/wwwoffle wwwoffle
|
| 78 |
|
|
|
| 79 |
|
|
# Changing the user:group to wwwoffle:woffle
|
| 80 |
|
|
fowners -R wwwoffle:wwwoffle /var/spool/wwwoffle /etc/wwwoffle
|
| 81 |
|
|
sed -i -e 's/^[# \t]\(run-[gu]id[ \t]*=[ \t]*\)[a-zA-Z0-9]*[ \t]*$/ \1wwwoffle/g' \
|
| 82 |
|
|
"${D}/etc/wwwoffle/wwwoffle.conf"
|
| 83 |
|
|
|
| 84 |
|
|
# Stop the service if it is started
|
| 85 |
|
|
if [ "${ROOT}" = "/" ] ; then
|
| 86 |
|
|
source /etc/init.d/functions.sh
|
| 87 |
|
|
if [ -L "${svcdir}/started/wwwoffled" ]; then
|
| 88 |
|
|
einfo "The wwwoffled init script is running. I'll stop it, merge the new files and
|
| 89 |
|
|
restart the script."
|
| 90 |
|
|
/etc/init.d/wwwoffled stop
|
| 91 |
|
|
# Just to be sure...
|
| 92 |
|
|
start-stop-daemon --stop --quiet --name wwwoffled
|
| 93 |
|
|
touch "${T}/stopped"
|
| 94 |
|
|
fi
|
| 95 |
|
|
fi
|
| 96 |
|
|
}
|
| 97 |
|
|
|
| 98 |
|
|
pkg_postinst() {
|
| 99 |
|
|
# fix permissions for those upgrading
|
| 100 |
|
|
for number in 1 2 3 4 5 6 7 8 9;
|
| 101 |
|
|
do
|
| 102 |
|
|
[ ! -d "${ROOT}/var/spool/wwwoffle/prevtime${number}" ] && \
|
| 103 |
|
|
keepdir "${ROOT}/var/spool/wwwoffle/prevtime${number}"
|
| 104 |
|
|
[ ! -d "${ROOT}/var/spool/wwwoffle/prevout${number}" ] && \
|
| 105 |
|
|
keepdir "${ROOT}/var/spool/wwwoffle/prevout${number}"
|
| 106 |
|
|
done
|
| 107 |
|
|
chown -R wwwoffle:wwwoffle "${ROOT}/var/spool/wwwoffle" "${ROOT}/etc/wwwoffle"
|
| 108 |
|
|
|
| 109 |
|
|
[ -f "${T}/stopped" ] && \
|
| 110 |
|
|
ewarn "wwwoffled was stopped. /etc/init.d/wwwoffled start to restart AFTER etc-update"
|
| 111 |
|
|
|
| 112 |
|
|
einfo "wwwoffled should run as an ordinary user now. The run-uid and run-gid should be set"
|
| 113 |
|
|
einfo "to \"wwwoffle\" in your /etc/wwwoffle/wwwoffle.conf. Please uncomment this if it hasn't been already"
|
| 114 |
|
|
|
| 115 |
|
|
einfo "This is for your own security. Otherwise wwwoffle is run as root which is relay bad if"
|
| 116 |
|
|
einfo "there is an exploit in this program that allows remote/local users to execute arbitary"
|
| 117 |
|
|
einfo "commands as the root user."
|
| 118 |
|
|
|
| 119 |
|
|
if [ -f "${ROOT}/etc/wwwoffle.conf" ]; then
|
| 120 |
|
|
ewarn "Configuration file is /etc/wwwoffle/wwwoffle.conf now"
|
| 121 |
|
|
ewarn "Suggest you move ${ROOT}etc/wwwoffle.conf"
|
| 122 |
|
|
fi
|
| 123 |
|
|
|
| 124 |
|
|
# if htdig - run script for full database index
|
| 125 |
|
|
# TODO
|
| 126 |
|
|
}
|