/[gentoo-x86]/app-backup/amanda/amanda-3.3.1.ebuild
Gentoo

Contents of /app-backup/amanda/amanda-3.3.1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Tue Feb 26 23:00:38 2013 UTC (3 months, 3 weeks ago) by robbat2
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +4 -1 lines
Bug #376169: avoid blkid writes from /usr/sbin/dump testing.

(Portage version: 2.2.0_alpha163/cvs/Linux x86_64, unsigned Manifest commit)

1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/app-backup/amanda/amanda-3.3.1.ebuild,v 1.7 2013/02/26 22:38:33 robbat2 Exp $
4
5 EAPI=3
6 inherit autotools eutils perl-module user
7
8 MY_P="${P/_}"
9 DESCRIPTION="The Advanced Maryland Automatic Network Disk Archiver"
10 HOMEPAGE="http://www.amanda.org/"
11 SRC_URI="mirror://sourceforge/amanda/${P}.tar.gz"
12 LICENSE="HPND BSD BSD-2 GPL-2+ GPL-3+"
13 SLOT="0"
14 KEYWORDS="amd64 ppc ppc64 ~sparc x86"
15 RDEPEND="sys-libs/readline
16 virtual/inetd
17 virtual/awk
18 app-arch/tar
19 >=dev-lang/perl-5.6
20 app-arch/dump
21 net-misc/openssh
22 >=dev-libs/glib-2.26.0
23 nls? ( virtual/libintl )
24 s3? ( >=net-misc/curl-7.10.0 )
25 !s3? ( curl? ( >=net-misc/curl-7.10.0 ) )
26 samba? ( net-fs/samba )
27 kerberos? ( app-crypt/mit-krb5 )
28 xfs? ( sys-fs/xfsdump )
29 readline? ( sys-libs/readline )
30 !minimal? (
31 virtual/mailx
32 app-arch/mt-st
33 sys-block/mtx
34 gnuplot? ( sci-visualization/gnuplot )
35 app-crypt/aespipe
36 app-crypt/gnupg
37 )"
38
39 DEPEND="${RDEPEND}
40 virtual/pkgconfig
41 nls? ( sys-devel/gettext )
42 >=app-text/docbook-xsl-stylesheets-1.72.0
43 app-text/docbook-xml-dtd
44 dev-libs/libxslt
45 "
46
47 IUSE="curl gnuplot ipv6 kerberos minimal nls readline s3 samba xfs"
48
49 S="${WORKDIR}/${MY_P}"
50
51 MYFILESDIR="${T}/files"
52 ENVDIR="/etc/env.d"
53 ENVDFILE="97amanda"
54 TMPENVFILE="${T}/${ENVDFILE}"
55
56 # This is a complete list of Amanda settings that the ebuild takes from the
57 # build environment. This allows users to alter the behavior of the package as
58 # upstream intended, but keeping with Gentoo style. We store a copy of them in
59 # /etc/env.d/97amanda during the install, so that they are preserved for future
60 # installed. This variable name must not start with AMANDA_, as we do not want
61 # it captured into the env file.
62 ENV_SETTINGS_AMANDA="
63 AMANDA_GROUP_GID AMANDA_GROUP_NAME
64 AMANDA_USER_NAME AMANDA_USER_UID AMANDA_USER_SH AMANDA_USER_HOMEDIR AMANDA_USER_GROUPS
65 AMANDA_SERVER AMANDA_SERVER_TAPE AMANDA_SERVER_INDEX
66 AMANDA_TAR_LISTDIR AMANDA_TAR
67 AMANDA_PORTS_UDP AMANDA_PORTS_TCP AMANDA_PORTS_BOTH AMANDA_PORTS
68 AMANDA_CONFIG_NAME AMANDA_TMPDIR"
69
70 amanda_variable_setup() {
71
72 # Setting vars
73 local currentamanda
74
75 # Grab the current settings
76 currentamanda="$(set | egrep "^AMANDA_" | grep -v '^AMANDA_ENV_SETTINGS' | xargs)"
77
78 # First we set the defaults
79 [ -z "${AMANDA_GROUP_GID}" ] && AMANDA_GROUP_GID=87
80 [ -z "${AMANDA_GROUP_NAME}" ] && AMANDA_GROUP_NAME=amanda
81 [ -z "${AMANDA_USER_NAME}" ] && AMANDA_USER_NAME=amanda
82 [ -z "${AMANDA_USER_UID}" ] && AMANDA_USER_UID=87
83 [ -z "${AMANDA_USER_SH}" ] && AMANDA_USER_SH=/bin/bash
84 [ -z "${AMANDA_USER_HOMEDIR}" ] && AMANDA_USER_HOMEDIR=/var/spool/amanda
85 [ -z "${AMANDA_USER_GROUPS}" ] && AMANDA_USER_GROUPS="${AMANDA_GROUP_NAME}"
86
87 # This installs Amanda, with the server. However, it could be a client,
88 # just specify an alternate server name in AMANDA_SERVER.
89 [ -z "${AMANDA_SERVER}" ] && AMANDA_SERVER="${HOSTNAME}"
90 [ -z "${AMANDA_SERVER_TAPE}" ] && AMANDA_SERVER_TAPE="${AMANDA_SERVER}"
91 [ -z "${AMANDA_SERVER_INDEX}" ] && AMANDA_SERVER_INDEX="${AMANDA_SERVER}"
92 [ -z "${AMANDA_TAR_LISTDIR}" ] && AMANDA_TAR_LISTDIR=${AMANDA_USER_HOMEDIR}/tar-lists
93 [ -z "${AMANDA_CONFIG_NAME}" ] && AMANDA_CONFIG_NAME=DailySet1
94 [ -z "${AMANDA_TMPDIR}" ] && AMANDA_TMPDIR=/var/tmp/amanda
95 [ -z "${AMANDA_DBGDIR}" ] && AMANDA_DBGDIR="$AMANDA_TMPDIR"
96 # These are left empty by default
97 [ -z "${AMANDA_PORTS_UDP}" ] && AMANDA_PORTS_UDP=
98 [ -z "${AMANDA_PORTS_TCP}" ] && AMANDA_PORTS_TCP=
99 [ -z "${AMANDA_PORTS_BOTH}" ] && AMANDA_PORTS_BOTH=
100 [ -z "${AMANDA_PORTS}" ] && AMANDA_PORTS=
101
102 # What tar to use
103 [ -z "${AMANDA_TAR}" ] && AMANDA_TAR=/bin/tar
104
105 # Now pull in the old stuff
106 if [ -f "${ROOT}${ENVDIR}/${ENVDFILE}" ]; then
107 # We don't just source it as we don't want everything in there.
108 eval $(egrep "^AMANDA_" "${ROOT}${ENVDIR}/${ENVDFILE}" | grep -v '^AMANDA_ENV_SETTINGS')
109 fi
110
111 # Re-apply the new settings if any
112 [ -n "${currentamanda}" ] && eval `echo "${currentamanda}"`
113
114 }
115
116 pkg_setup() {
117 amanda_variable_setup
118
119 # If USE=minimal, give out a warning, if AMANDA_SERVER is not set to
120 # another host than HOSTNAME.
121 if use minimal && [ "${AMANDA_SERVER}" = "${HOSTNAME}" ] ; then
122 elog "You are installing a client-only version of Amanda."
123 elog "You should set the variable \$AMANDA_SERVER to point at your"
124 elog "Amanda-tape-server, otherwise you will have to specify its name"
125 elog "when using amrecover on the client."
126 elog "For example: Use something like"
127 elog "AMANDA_SERVER=\"myserver\" emerge amanda"
128 elog
129 fi
130
131 enewgroup "${AMANDA_GROUP_NAME}" "${AMANDA_GROUP_GID}"
132 enewuser "${AMANDA_USER_NAME}" "${AMANDA_USER_UID}" "${AMANDA_USER_SH}" "${AMANDA_USER_HOMEDIR}" "${AMANDA_USER_GROUPS}"
133 }
134
135 src_unpack() {
136 # we do not want the perl src_unpack
137 base_src_unpack
138 }
139
140 src_prepare() {
141 # Fix a fun race condition if you use encryption.
142 # This is one of the reasons you should test your recovery procedures often.
143 #epatch "${FILESDIR}"/${PN}-2.6.0p2-amcrypt-ossl-asym-race-fix.patch
144
145 # gentoo bug 248838, check /sbin stuff before /bin
146 #epatch "${FILESDIR}"/${PN}-2.6.0_p2-syslocpath.patch
147
148 # gentoo bug #415587
149 epatch "${FILESDIR}"/amanda-r4593.patch
150 epatch "${FILESDIR}"/amanda-r4595.patch
151 epatch "${FILESDIR}"/amanda-r4698.patch
152
153 # gentoo bug #331111
154 sed -i '/^check-local: check-perl$/d' "${S}"/config/automake/scripts.am
155 sed -i '/^check-local:/s,syntax-check,,g' "${S}"/perl/Makefile.am
156
157 eautoreconf
158
159 # places for us to work in
160 mkdir -p "${MYFILESDIR}"
161 # Now we store the settings we just created
162 set | egrep "^AMANDA_" | grep -v '^AMANDA_ENV_SETTINGS' > "${TMPENVFILE}"
163
164 # Prepare our custom files
165 einfo "Building custom configuration files"
166 local i # our iterator
167 local sedexpr # var for sed expr
168 sedexpr=''
169 for i in ${ENV_SETTINGS_AMANDA} ; do
170 local val
171 eval "val=\"\${${i}}\""
172 sedexpr="${sedexpr}s|__${i}__|${val}|g;"
173 done
174
175 # now apply the sed expr
176 for i in "${FILESDIR}"/amanda-* ; do
177 sed -re "${sedexpr}" <"${i}" >"${MYFILESDIR}/`basename ${i}`"
178 done
179
180 (
181 cat "${MYFILESDIR}"/amanda-amandahosts-client-2.5.1_p3-r1
182 use minimal || cat "${MYFILESDIR}"/amanda-amandahosts-server-2.5.1_p3-r1
183 ) > "${T}"/amandahosts
184
185 if ! use minimal; then
186 sed -i -e 's:^\(my $amandahomedir\)=.*:\1 = $localstatedir;:' \
187 server-src/am{addclient,serverconfig}.pl || die
188 fi
189 }
190
191 src_configure() {
192 # fix bug #36316
193 addpredict /var/cache/samba/gencache.tdb
194 # fix bug #376169
195 addpredict /run/blkid
196 addpredict /etc/blkid.tab
197
198 [ ! -f "${TMPENVFILE}" ] && die "Variable setting file (${TMPENVFILE}) should exist!"
199 source "${TMPENVFILE}"
200 local myconf
201
202 einfo "Using ${AMANDA_SERVER_TAPE} for tape server."
203 myconf="${myconf} --with-tape-server=${AMANDA_SERVER_TAPE}"
204 einfo "Using ${AMANDA_SERVER_INDEX} for index server."
205 myconf="${myconf} --with-index-server=${AMANDA_SERVER_INDEX}"
206 einfo "Using ${AMANDA_USER_NAME} for amanda user."
207 myconf="${myconf} --with-user=${AMANDA_USER_NAME}"
208 einfo "Using ${AMANDA_GROUP_NAME} for amanda group."
209 myconf="${myconf} --with-group=${AMANDA_GROUP_NAME}"
210 einfo "Using ${AMANDA_TAR} as Tar implementation."
211 myconf="${myconf} --with-gnutar=${AMANDA_TAR}"
212 einfo "Using ${AMANDA_TAR_LISTDIR} as tar listdir."
213 myconf="${myconf} --with-gnutar-listdir=${AMANDA_TAR_LISTDIR}"
214 einfo "Using ${AMANDA_CONFIG_NAME} as default config name."
215 myconf="${myconf} --with-config=${AMANDA_CONFIG_NAME}"
216 einfo "Using ${AMANDA_TMPDIR} as Amanda temporary directory."
217 myconf="${myconf} --with-tmpdir=${AMANDA_TMPDIR}"
218
219 if [ -n "${AMANDA_PORTS_UDP}" ] && [ -n "${AMANDA_PORTS_TCP}" ] && [ -z "${AMANDA_PORTS_BOTH}" ] ; then
220 eerror "If you want _both_ UDP and TCP ports, please use only the"
221 eerror "AMANDA_PORTS environment variable for identical ports, or set"
222 eerror "AMANDA_PORTS_BOTH."
223 die "Bad port setup!"
224 fi
225 if [ -n "${AMANDA_PORTS_UDP}" ]; then
226 einfo "Using UDP ports ${AMANDA_PORTS_UDP/,/-}"
227 myconf="${myconf} --with-udpportrange=${AMANDA_PORTS_UDP}"
228 fi
229 if [ -n "${AMANDA_PORTS_TCP}" ]; then
230 einfo "Using TCP ports ${AMANDA_PORTS_TCP/,/-}"
231 myconf="${myconf} --with-tcpportrange=${AMANDA_PORTS_TCP}"
232 fi
233 if [ -n "${AMANDA_PORTS}" ]; then
234 einfo "Using ports ${AMANDA_PORTS/,/-}"
235 myconf="${myconf} --with-portrange=${AMANDA_PORTS}"
236 fi
237
238 # Extras
239 # Speed option
240 myconf="${myconf} --with-buffered-dump"
241 # "debugging" in the configuration is NOT debug in the conventional sense.
242 # It is actually just useful output in the application, and should remain
243 # enabled. There are some cases of breakage with MTX tape changers as of
244 # 2.5.1p2 that it exposes when turned off as well.
245 myconf="${myconf} --with-debugging"
246 # Where to put our files
247 myconf="${myconf} --localstatedir=${AMANDA_USER_HOMEDIR}"
248
249 # Samba support
250 myconf="${myconf} `use_with samba smbclient /usr/bin/smbclient`"
251
252 # Support for BSD, SSH, BSDUDP, BSDTCP security methods all compiled in by
253 # default
254 myconf="${myconf} --with-bsd-security"
255 myconf="${myconf} --with-ssh-security"
256 myconf="${myconf} --with-bsdudp-security"
257 myconf="${myconf} --with-bsdtcp-security"
258
259 # kerberos-security mechanism version 5
260 myconf="${myconf} `use_with kerberos krb5-security`"
261
262 # Amazon S3 support
263 myconf="${myconf} `use_enable s3 s3-device`"
264
265 # libcurl is required for S3 but otherwise optional
266 if ! use s3; then
267 myconf="${myconf} $(use_with curl libcurl)"
268 fi
269
270 # Client only, as requested in bug #127725
271 if use minimal ; then
272 myconf="${myconf} --without-server"
273 else
274 # amplot
275 myconf="${myconf} $(use_with gnuplot)"
276 fi
277
278 # IPv6 fun.
279 myconf="${myconf} `use_with ipv6`"
280 # This is to prevent the IPv6-is-working test
281 # As the test fails on binpkg build hosts with no IPv6.
282 use ipv6 && export amanda_cv_working_ipv6=yes
283
284 # I18N
285 myconf="${myconf} `use_enable nls`"
286
287 # Bug #296634: Perl location
288 perlinfo
289 myconf="${myconf} --with-amperldir=${VENDOR_LIB}"
290
291 # Bug 296633: --disable-syntax-checks
292 # Some tests are not safe for production systems
293 myconf="${myconf} --disable-syntax-checks"
294
295 # build manpages
296 myconf="${myconf} --enable-manpage-build"
297
298 econf \
299 $(use_with readline) \
300 ${myconf}
301 }
302
303 src_compile() {
304 # Again, do not want the perl-module src_compile
305 base_src_compile
306 }
307
308 src_install() {
309 [ ! -f "${TMPENVFILE}" ] && die "Variable setting file (${TMPENVFILE}) should exist!"
310 source ${TMPENVFILE}
311
312 einfo "Doing stock install"
313 # parallel make install b0rked
314 emake -j1 DESTDIR="${D}" install || die
315
316 # Build the envdir file
317 # Don't forget this..
318 einfo "Building environment file"
319 (
320 echo "# These settings are what was present in the environment when this"
321 echo "# Amanda was compiled. Changing anything below this comment will"
322 echo "# have no effect on your application, but it merely exists to"
323 echo "# preserve them for your next emerge of Amanda"
324 cat "${TMPENVFILE}" | sed "s,=\$,='',g"
325 ) >> "${MYFILESDIR}/${ENVDFILE}"
326
327 # Env.d
328 einfo "Installing environment config file"
329 doenvd "${MYFILESDIR}/${ENVDFILE}"
330
331 # Lock down next section (up until docs).
332 insopts -m0640
333 # Installing Amanda Xinetd Services Definition
334 einfo "Installing xinetd service file"
335 insinto /etc/xinetd.d
336 if use minimal ; then
337 newins "${MYFILESDIR}"/amanda-xinetd-2.6.1_p1-client amanda
338 else
339 newins "${MYFILESDIR}"/amanda-xinetd-2.6.1_p1-server amanda
340 fi
341
342 if ! use minimal; then
343 einfo "Installing Sample Daily Cron Job for Amanda"
344 insinto /etc/cron.daily
345 newins "${MYFILESDIR}/amanda-cron" amanda
346 fi
347
348 insinto /etc/amanda
349 einfo "Installing .amandahosts File for ${AMANDA_USER_NAME} user"
350 doins "${T}/amandahosts"
351 fperms 600 /etc/amanda/amandahosts
352
353 dosym /etc/amanda/amandahosts "${AMANDA_USER_HOMEDIR}/.amandahosts"
354 insinto "${AMANDA_USER_HOMEDIR}"
355 einfo "Installing .profile for ${AMANDA_USER_NAME} user"
356 newins "${MYFILESDIR}/amanda-profile" .profile
357
358 insinto /etc/amanda
359 doins "${S}/example/amanda-client.conf"
360 if ! use minimal ; then
361 insinto "/etc/amanda/${AMANDA_CONFIG_NAME}"
362 doins "${S}/example/amanda.conf"
363 doins "${S}/example/disklist"
364 keepdir "${AMANDA_USER_HOMEDIR}/${AMANDA_CONFIG_NAME}/index"
365 fi
366
367 keepdir "${AMANDA_TAR_LISTDIR}"
368 keepdir "${AMANDA_USER_HOMEDIR}/amanda"
369 keepdir "${AMANDA_TMPDIR}/dumps"
370 # Just make sure it exists for XFS to work...
371 use xfs && keepdir /var/xfsdump/inventory
372
373 local i
374 for i in "${AMANDA_USER_HOMEDIR}" "${AMANDA_TAR_LISTDIR}" \
375 "${AMANDA_TMPDIR}" /etc/amanda; do
376 einfo "Securing directory (${i})"
377 fowners -R ${AMANDA_USER_NAME}:${AMANDA_GROUP_NAME} ${i}
378 done
379 # Do NOT use -R
380 fperms 0700 \
381 "${AMANDA_USER_HOMEDIR}" "${AMANDA_TAR_LISTDIR}" \
382 "${AMANDA_TMPDIR}" "${AMANDA_TMPDIR}/dumps" \
383 "${AMANDA_USER_HOMEDIR}/amanda" \
384 "${AMANDA_USER_HOMEDIR}/${AMANDA_CONFIG_NAME}" \
385 /etc/amanda /etc/amanda/${AMANDA_CONFIG_NAME}
386
387 einfo "Setting setuid permissions"
388 amanda_permissions_fix "${D}"
389
390 # Relax permissions again
391 insopts -m0644
392
393 # docs
394 einfo "Installing documentation"
395 dodoc AUTHORS ChangeLog DEVELOPING NEWS README ReleaseNotes UPGRADING
396 # our inetd sample
397 einfo "Installing standard inetd sample"
398 newdoc "${MYFILESDIR}/amanda-inetd.amanda.sample-2.6.0_p2-r2" amanda-inetd.amanda.sample
399 # Amanda example configs
400 einfo "Installing example configurations"
401 rm "${D}"/usr/share/amanda/{COPYRIGHT,ChangeLog,NEWS,ReleaseNotes}
402 mv "${D}/usr/share/amanda/example" "${D}/usr/share/doc/${PF}/"
403 docinto example1
404 newdoc "${FILESDIR}/example_amanda.conf" amanda.conf
405 newdoc "${FILESDIR}/example_disklist-2.5.1_p3-r1" disklist
406 newdoc "${FILESDIR}/example_global.conf" global.conf
407
408 einfo "Cleaning up dud .la files"
409 perlinfo
410 find "${D}"/"${VENDOR_LIB}" -name '*.la' -print0 |xargs -0 rm -f
411 }
412
413 pkg_postinst() {
414 [ ! -f "${TMPENVFILE}" -a "$EMERGE_FROM" == "binary" ] && \
415 TMPENVFILE="${ROOT}${ENVDIR}/${ENVDFILE}"
416 [ ! -f "${TMPENVFILE}" ] && die "Variable setting file (${TMPENVFILE}) should exist!"
417 source "${TMPENVFILE}"
418
419 # Migration of amandates from /etc to $localstatedir/amanda
420 if [ -f "${ROOT}/etc/amandates" -a \
421 ! -f "${ROOT}/${AMANDA_USER_HOMEDIR}/amanda/amandates" ]; then
422 einfo "Migrating amandates from /etc/ to ${AMANDA_USER_HOMEDIR}/amanda"
423 einfo "A backup is also placed at /etc/amandates.orig"
424 cp -dp "${ROOT}/etc/amandates" "${ROOT}/etc/amandates.orig"
425 mkdir -p "${ROOT}/${AMANDA_USER_HOMEDIR}/amanda/"
426 cp -dp "${ROOT}/etc/amandates" "${ROOT}/${AMANDA_USER_HOMEDIR}/amanda/amandates"
427 fi
428 if [ -f "${ROOT}/etc/amandates" ]; then
429 einfo "If you have migrated safely, please delete /etc/amandates"
430 fi
431
432 einfo "Checking setuid permissions"
433 amanda_permissions_fix "${ROOT}"
434
435 elog "You should configure Amanda in /etc/amanda now."
436 elog
437 elog "If you use xinetd, Don't forget to check /etc/xinetd.d/amanda"
438 elog "and restart xinetd afterwards!"
439 elog
440 elog "Otherwise, please look at /usr/share/doc/${PF}/inetd.amanda.sample"
441 elog "as an example of how to configure your inetd."
442 elog
443 elog "NOTICE: If you need raw access to partitions you need to add the"
444 elog "amanda user to the 'disk' group."
445 elog
446 elog "NOTICE: If you have a tape changer, you need to add the amanda user"
447 elog "to the 'tape' group."
448 elog
449 elog "If you use localhost in your disklist your restores may break."
450 elog "You should replace it with the actual hostname!"
451 elog "Please also see the syntax changes to amandahosts."
452 }
453
454 # We have had reports of amanda file permissions getting screwed up.
455 # Losing setuid, becoming too lax etc.
456 # ONLY root and users in the amanda group should be able to run these binaries!
457 amanda_permissions_fix() {
458 local root="$1"
459 [ -z "${root}" ] && die "Failed to pass root argument to amanda_permissions_fix!"
460 local le="/usr/libexec/amanda"
461 for i in /usr/sbin/amcheck "${le}"/calcsize "${le}"/killpgrp \
462 "${le}"/rundump "${le}"/runtar "${le}"/dumper \
463 "${le}"/planner ; do
464 chown root:${AMANDA_GROUP_NAME} "${root}"/${i}
465 chmod u=srwx,g=rx,o= "${root}"/${i}
466 done
467 }

  ViewVC Help
Powered by ViewVC 1.1.20