summaryrefslogtreecommitdiff
blob: 87174cf30c627708a46776b4a01bf7ae5e9b12cd (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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# Copyright 1999-2009 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 AntiVir Update Manager"
MY_P="avira_update_manager_unix-${PV%.*}-${PV##*.}"
SRC_URI="http://dl1.pro.antivir.de/package/ium/unix/en/avira_update_manager_unix_en.tar.gz"
HOMEPAGE="http://www.avira.com/"
LICENSE="AVIRA-AntiVir"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE=""
DEPEND=""
RDEPEND=">=app-antivirus/antivir-savapi-3"
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/avira}"
AVIUMHTTPDIR="${AVIUMHTTPDIR:-/var/avira/ium/HttpRoot}"
AVIUMLOGDIR="${AVIUMLOGDIR:-/var/log/ium}"
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}/ium"
	insinto "${AVHOMEDIR}/ium"
	exeopts -oroot -g"${AVGROUP}" -m2750
	insopts -oroot -g"${AVGROUP}" -m0640
	doexe bin/linux_glibc22/ium
	doins bin/linux_glibc22/ium_msg.avr
	doins bin/linux_glibc22/libcommon.so
	doins bin/linux_glibc22/common_msg.avr
	doins etc/iumproducts.xml

	local libupdate_ver=0.1.0.33
	doins bin/linux_glibc22/libupdate.so.${libupdate_ver}
	dosym "libupdate.so.${libupdate_ver}" "${AVHOMEDIR}/ium/libupdate.so.0"
	dosym "libupdate.so.${libupdate_ver}" "${AVHOMEDIR}/ium/libupdate.so"

	diropts ""
	dodir "${DESTTREE}/sbin"
	dosym "${AVHOMEDIR}/ium/ium" "${DESTTREE}/sbin/avium"

	newexe script/avira_start.sh.template avium
	doexe script/avium_start.sh
	doexe script/avium_restart.sh
	doexe script/avium_stop.sh

	insinto "${AVHOMEDIR}/ium/ssl"
	doins cert/cacert.pem
	doins cert/server.pem

	#
	# Init script
	#

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

	#
	# Config
	#

	insopts -oroot -g"${AVGROUP}" -m0640
	insinto "${AVCONFDIR}"
	doins "${FILESDIR}"/${PV}/ium.conf
	dosed "s:%AVIUMHTTPDIR%:${AVIUMHTTPDIR}:g" "${AVCONFDIR}/ium.conf"
	doins "${FILESDIR}"/${PV}/mirrorconfig.xml

	#
	# IUM log directory
	#

	diropts -o"${AVUSER}" -g"${AVGROUP}" -m0750
	dodir "${AVIUMLOGDIR}"
	dodir "${AVIUMHTTPDIR}"

	#
	# Documents
	#

	dodoc \
		LICENSE \
		LICENSE.DE \
		README \
		doc/MANUAL

	#
	# Templates
	#

	insinto "${AVHOMEDIR}/ium"
	insopts -m0644
	doins templates/*.htm
	doins doc/mail_template_iumstatus.txt

}

pkg_postinst() {

	#
	# Manual invocation
	#

	elog
	elog "Manually adding products to get updates for"
	elog "==========================================="
	elog
	elog "  ${AVHOMEDIR}/ium/ium --add_products"
	elog
	elog "Manually getting updates for products"
	elog "====================================="
	elog
	elog "  ${AVHOMEDIR}/ium/ium --get_updates"
	elog

	echo

	#
	# Automatic updates for products
	#

	rand="$(date +%N 2>/dev/null)"
	min="$[ (${rand:-${RANDOM}} % 59) + 1 ]"
	elog
	elog "Automatically getting updates for products"
	elog "=========================================="
	elog
	elog "Add the following line to your /etc/crontab or a new file"
	elog "in /etc/cron.d/ to make AntiVir check for updates"
	elog "${min} minutes after every full hour:"
	elog
	elog "  ${min} * * * * root exec ${AVHOMEDIR}/ium/ium --get_updates >/dev/null"
	elog

	echo

	#
	# Automatic updates for IUM
	#

	rand="$(date +%N 2>/dev/null)"
	min="$[ (${rand:-${RANDOM}} % 59) + 1 ]"
	elog
	elog "Automatically getting updates for IUM itself"
	elog "==========================================="
	elog
	elog "Add the following line to your /etc/crontab or a new file"
	elog "in /etc/cron.d/ to make AntiVir check for updates"
	elog "${min} minutes after every full hour:"
	elog
	elog "  ${min} * * * * root exec ${AVHOMEDIR}/avupdate --product=IUM >/dev/null"
	elog

	echo

	#
	# Client configuration info
	#

	elog
	elog "Configuring clients"
	elog "==================="
	elog
	elog "Windows clients"
	elog "---------------"
	elog
	elog "Options -> General -> Update -> Webserver -> Download Server:"
	elog "  http://iumserver:7080/upd"
	elog
	elog "Linux clients"
	elog "-------------"
	elog
	elog "For SAVAPI2 products add these two options in /etc/avupdater.conf:"
	elog "  HTTPUpdateServer 'iumserver':7080"
	elog "  IgnoreRemoteServerSpec yes"
	elog
	elog "For SAVAPI3 products adjust /etc/avupdate.conf as follows:"
	elog "  internet-srvs=http://iumserver:7080/upd"
	elog

	echo

	#
	# Templates
	#

	elog
	elog "Using the HTML templates"
	elog "========================"
	elog
	elog "The templates were installed into"
	elog
	elog "\t${AVHOMEDIR}/ium"
	elog

}