summaryrefslogtreecommitdiff
blob: 82e8cfb63b171b6c4eb8535ba3e303582046c88b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-apps/dspam-web/dspam-web-3.0.0.ebuild,v 1.1 2004/08/23 14:14:01 st_lim Exp $

inherit webapp

MY_PN=${PN/-web/}
MY_P=${MY_PN}-${PV}

DESCRIPTION="Web based administration and user controls for dspam"
SRC_URI="http://www.nuclearelephant.com/projects/dspam/sources/${MY_P}.tar.gz"

HOMEPAGE="http://www.nuclearelephant.com/projects/dspam/index.html"
LICENSE="GPL-2"
DEPEND=">=mail-filter/dspam-3.1.0_beta11
	>=net-www/apache-1.3
	>=dev-lang/perl-5.8.2
	>=dev-perl/GD-2.0
	dev-perl/GD-Graph3d
	dev-perl/GDGraph
	dev-perl/GDTextUtil"
KEYWORDS="~x86"
S=${WORKDIR}/${MY_P}/cgi

src_compile () {
	einfo "Nothing to compile"
}

src_install () {
	webapp_src_preinst

	sed -e 's,/var/dspam,/etc/mail/dspam,' \
		-e 's,/usr/local,/usr,' \
		-i ${S}/cgi/admin.cgi
	sed -e 's,/var/dspam,/etc/mail/dspam,' \
		-e 's,/usr/local,/usr,' \
		-i ${S}/cgi/dspam.cgi

	insinto ${MY_HTDOCSDIR}
	insopts -m644 -o apache -g apache

	doins *.css
	doins *.gif
	doins rgb.txt
	doins default.prefs
	doins admins

	newins ${FILESDIR}/htaccess .htaccess
	newins ${FILESDIR}/htpasswd .htpasswd

	insopts -m755 -o apache -g apache
	doins *.cgi

	for CGI_SCRIPT in admin.cgi  admingraph.cgi  dspam.cgi  graph.cgi; do
		webapp_runbycgibin perl ${MY_HTDOCSDIR}/${CGI_SCRIPT}
	done

	dodir ${MY_HTDOCSDIR}/templates

	insinto ${MY_HTDOCSDIR}/templates
	doins templates/*.html

	#All files must be owned by server
	cd ${D}${MY_HTDOCSDIR}
	for x in `find . -type f -print` ; do
		webapp_serverowned ${MY_HTDOCSDIR}/$x
	done

	webapp_src_install
}

pkg_config () {
	# add apache to the dspam group so the CGIs can access the data

	local groups
	groups=`groups apache`
	groups=`echo ${groups} | sed -e 's/ /,/g'`
	usermod -G "${groups},dspam" apache
}

pkg_postinst () {
	einfo "The CGIs need to be executed as group dspam in order to write"
	einfo "to the dspam data directory. You will need to configure apache"
	einfo "manually to do this. Another option is to add the user apache"
	einfo "to the dspam group. You can do this automatically by running:"
	echo
	einfo "ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config"
	echo
	einfo "This app requires basic auth in order to operate properly."
	einfo "You will need to add dspam users to the .htpasswd file or"
	einfo "configure a different authentication mechanism for the user"
	einfo "accounts."
}