summaryrefslogtreecommitdiff
blob: d8963916f12d201cb75a0025026243a9a1f44d84 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
##
## Created by Wolfram Schlich <wschlich@gentoo.org>
##
## TODO
## - ?
##

inherit eutils pax-utils

DESCRIPTION="AVIRA WebGate HTTP/FTP proxy virus scanner"
MY_P="${PN}-prof-${PV/_p/-}"
SRC_URI="http://dl.antivir.de/down/unix/packages/${MY_P}.tar.gz"
HOMEPAGE="http://www.avira.com/"
LICENSE="AVIRA-AntiVir"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE=""
DEPEND=""
RDEPEND=">=app-antivirus/antivir-core-2.1.12_p19"
S="${WORKDIR}/${MY_P}"
# prevent installation functions from stripping binaries
# otherwise the antivir selfcheck fails. also don't try
# to fetch the distribution tarball from a mirror.
RESTRICT="strip mirror"

#
# Settings overridable by user supplied environment variables
#

AVHOMEDIR="${AVHOMEDIR:-/usr/lib/AntiVir}"
AVCONFDIR="${AVCONFDIR:-/etc}"
AVSPOOLDIR="${AVSPOOLDIR:-/var/spool/avwebgate}"
AVTMPDIR="${AVTMPDIR:-/var/tmp}"
AVPIDDIR="${AVPIDDIR:-/var/tmp}"
AVUSER="${AVUSER:-avgate}"
AVUID="${AVUID:-220}"
AVSH="${AVSH:--1}"
AVGROUP="${AVGROUP:-antivir}"
AVGID="${AVGID:-220}"
AVHOSTNAME="${AVHOSTNAME:-$(hostname -f)}"

pkg_setup() {

	#
	# Add USER + GROUP
	#

	enewgroup "${AVGROUP}" "${AVGID}"
	enewuser "${AVUSER}" "${AVUID}" "${AVSH}" -1 "${AVGROUP}" -c AntiVir

}

src_install() {

	#
	# Executables, libraries and misc components
	#

	exeinto "${AVHOMEDIR}"
	exeopts -oroot -g"${AVGROUP}" -m2750
	doexe bin/linux_glibc22/avwebgate.bin
	diropts ""
	dodir \
		"${DESTTREE}/sbin"
	dosym "${AVHOMEDIR}/avwebgate.bin" "${DESTTREE}/sbin/avwebgate"

	#
	# Init script
	#

	exeopts -oroot -groot -m0755
	exeinto /etc/init.d
	newexe "${FILESDIR}/${PV}/antivir-webgate.init.d" antivir-webgate

	#
	# Config
	#

	insopts -oroot -g"${AVGROUP}" -m0640
	insinto "${AVCONFDIR}"
	doins \
		"${FILESDIR}"/${PV}/avwebgate.conf
#	use gui && doins etc/avwebgate.conf-gui
	dosed "s:%AVHOMEDIR%:${AVHOMEDIR}:g" "${AVCONFDIR}/avwebgate.conf"
	dosed "s:%AVCONFDIR%:${AVCONFDIR}:g" "${AVCONFDIR}/avwebgate.conf"
	dosed "s:%AVSPOOLDIR%:${AVSPOOLDIR}:g" "${AVCONFDIR}/avwebgate.conf"
	dosed "s:%AVTMPDIR%:${AVTMPDIR}:g" "${AVCONFDIR}/avwebgate.conf"
	dosed "s:%AVPIDDIR%:${AVPIDDIR}:g" "${AVCONFDIR}/avwebgate.conf"
	dosed "s:%AVUSER%:${AVUSER}:g" "${AVCONFDIR}/avwebgate.conf"
	dosed "s:%AVGROUP%:${AVGROUP}:g" "${AVCONFDIR}/avwebgate.conf"
	dosed "s:%AVHOSTNAME%:${AVHOSTNAME}:g" "${AVCONFDIR}/avwebgate.conf"
	touch "${T}/avwebgate.acl"
	doins "${T}/avwebgate.acl"

	#
	# Spool directory
	#

	diropts -o"${AVUSER}" -g"${AVGROUP}" -m0700
	dodir "${AVSPOOLDIR}"
	keepdir "${AVSPOOLDIR}"
	for dir in quarantine; do
		dodir "${AVSPOOLDIR}/${dir}"
		keepdir "${AVSPOOLDIR}/${dir}"
	done

	## TODO:GUI

	## TODO:SMC

	#
	# Documents
	#

	dodoc \
		LICENSE \
		LICENSE.DE \
		README \
		doc/CHANGELOG \
		doc/MANUAL \
		doc/RELEASE_NOTES \
		doc/avwebgate_de.pdf \
		doc/avwebgate_en.pdf \
		doc/avwebgate.acl.example \
		legal/LICENSE.*

	#
	# Templates
	#

	diropts ""
	dodir "${AVHOMEDIR}/avwebgate.tpl"
	insopts -m0644
	insinto "${AVHOMEDIR}/avwebgate.tpl"
	doins templates/en/*

}

pkg_postinst() {

	#
	# Config
	#

	echo
	einfo ""
	einfo "Configuration"
	einfo "============="
	einfo ""
	einfo "Please run..."
	einfo ""
	einfo "\tebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config"
	einfo ""
	einfo "...to configure the package!"
	einfo ""
	echo

}

pkg_config() {

	#
	# Init script
	#

	echo
	einfo ""
	einfo "Using the init script"
	einfo "====================="
	einfo ""
	einfo "Simply run..."
	einfo ""
	einfo "\trc-update add antivir-webgate default"
	einfo ""
	einfo "...and your're done."
	einfo ""

	#
	# Templates
	#

	echo
	einfo ""
	einfo "Using the HTML templates"
	einfo "========================"
	einfo ""
	einfo "The templates were installed into"
	einfo ""
	einfo "\t${AVHOMEDIR}/avwebgate.tpl"
	einfo ""

}