1 |
1 |
# Copyright 1999-2025 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
inherit autotools perl-module systemd toolchain-funcs
|
|
6 |
inherit autotools perl-module systemd tmpfiles toolchain-funcs
|
7 |
7 |
|
8 |
8 |
DESCRIPTION="The Advanced Maryland Automatic Network Disk Archiver"
|
9 |
|
HOMEPAGE="http://www.amanda.org/"
|
10 |
|
SRC_URI="https://downloads.sourceforge.net/amanda/${P}.tar.gz"
|
|
9 |
HOMEPAGE="https://www.amanda.org/"
|
|
10 |
SRC_URI="https://github.com/zmanda/amanda/archive/refs/tags/tag-community-${PV}.tar.gz"
|
|
11 |
|
|
12 |
S="${WORKDIR}/amanda-tag-community-${PV}"
|
11 |
13 |
|
12 |
14 |
LICENSE="HPND BSD BSD-2 GPL-2+ GPL-3+"
|
13 |
15 |
SLOT="0"
|
14 |
|
IUSE="curl gnuplot ipv6 kerberos minimal ndmp nls readline s3 samba selinux systemd xfs"
|
15 |
16 |
KEYWORDS="amd64 ppc ppc64 ~sparc x86"
|
|
17 |
IUSE="curl gnuplot ipv6 kerberos minimal ndmp nls readline s3 samba selinux systemd xfs"
|
16 |
18 |
|
17 |
19 |
DEPEND="
|
18 |
20 |
acct-group/amanda
|
... | ... | |
27 |
29 |
sys-libs/readline:=
|
28 |
30 |
app-alternatives/awk
|
29 |
31 |
kerberos? ( app-crypt/mit-krb5 )
|
30 |
|
ndmp? ( net-libs/libtirpc:= )
|
|
32 |
ndmp? (
|
|
33 |
net-libs/libtirpc:=
|
|
34 |
net-libs/rpcsvc-proto )
|
31 |
35 |
nls? ( virtual/libintl )
|
32 |
36 |
samba? ( net-fs/samba:= )
|
33 |
37 |
s3? ( net-misc/curl )
|
... | ... | |
47 |
51 |
selinux? ( sec-policy/selinux-amanda )
|
48 |
52 |
"
|
49 |
53 |
BDEPEND="
|
|
54 |
app-alternatives/lex
|
|
55 |
app-alternatives/yacc
|
50 |
56 |
app-text/docbook-xsl-stylesheets
|
51 |
57 |
app-text/docbook-xml-dtd
|
52 |
58 |
dev-lang/swig
|
... | ... | |
55 |
61 |
nls? ( sys-devel/gettext )"
|
56 |
62 |
|
57 |
63 |
PATCHES=(
|
58 |
|
"${FILESDIR}"/${P}-fno-common.patch
|
59 |
64 |
"${FILESDIR}"/${PN}-3.5.1-configure-clang16.patch
|
|
65 |
"${FILESDIR}"/${PN}-3.5.4-no-ndmp.patch
|
|
66 |
"${FILESDIR}"/${PN}-3.5.4-const-whitelist-var.patch
|
|
67 |
"${FILESDIR}"/${PN}-3.5.4-remove-amanda-message-severity-use.patch
|
|
68 |
"${FILESDIR}"/${PN}-3.5.4-fix-tapelist-null-usage.patch
|
|
69 |
"${FILESDIR}"/${PN}-3.5.4-fix-finished_cb-invocation.patch
|
|
70 |
"${FILESDIR}"/${PN}-3.5.4-use-host-ar.patch
|
|
71 |
"${FILESDIR}"/${PN}-3.5.4-fix-curl-usage-for-newer-versions.patch
|
60 |
72 |
)
|
61 |
73 |
|
62 |
74 |
MYFILESDIR="${T}/files"
|
... | ... | |
142 |
154 |
|
143 |
155 |
src_prepare() {
|
144 |
156 |
default
|
145 |
|
use ndmp && eapply "${FILESDIR}"/${P}-tirpc.patch
|
146 |
157 |
# gentoo bug #331111
|
147 |
158 |
sed -i '/^check-local: check-perl$/d' config/automake/scripts.am || die
|
148 |
159 |
sed -i '/^check-local:/s,syntax-check,,g' perl/Makefile.am || die
|
... | ... | |
151 |
162 |
sed -i -e '/gets is a security/d' gnulib/stdio.in.h || die
|
152 |
163 |
|
153 |
164 |
# https://bugs.gentoo.org/701416 sandbox violation
|
154 |
|
sed -i -e 's/case `"$SAMBA_CLIENT.*/case "Connection to nosuchhost.amanda.org failed" in/' config/amanda/dumpers.m4 || die
|
|
165 |
sed -i -e 's/case `"$SAMBA_CLIENT.*/case "Connection to nosuchhost.amanda.org failed" in/' \
|
|
166 |
config/amanda/dumpers.m4 || die
|
|
167 |
|
|
168 |
# Generate file-list. Copied from autogen
|
|
169 |
(
|
|
170 |
cd config
|
|
171 |
for m4dir in amanda gettext-macros gnulib macro-archive; do
|
|
172 |
echo "## this file is automatically generated by autogen" > "$m4dir/file-list"
|
|
173 |
for f in $m4dir/*.m4; do echo "EXTRA_DIST += $f" >> "$m4dir/file-list"; done
|
|
174 |
done
|
|
175 |
|
|
176 |
echo "## this file is automatically generated by autogen" > "automake/file-list"
|
|
177 |
for f in automake/*.am; do echo "EXTRA_DIST += $f" >> "automake/file-list"; done
|
|
178 |
)
|
|
179 |
|
|
180 |
# Generate FULL_VERSION. Copied from autogen
|
|
181 |
config/set_full_version
|
155 |
182 |
|
156 |
183 |
eautoreconf
|
157 |
184 |
|
... | ... | |
177 |
204 |
done
|
178 |
205 |
|
179 |
206 |
if use minimal; then
|
180 |
|
cat "${MYFILESDIR}"/amanda-amandahosts-server-2.5.1_p3-r1 > "${T}"/amandahosts || die
|
|
207 |
cat "${MYFILESDIR}"/amanda-amandahosts-client-2.5.1_p3-r1 > "${T}"/amandahosts || die
|
181 |
208 |
else
|
182 |
209 |
sed -i -e 's:^\(my $amandahomedir\)=.*:\1 = $localstatedir;:' \
|
183 |
210 |
server-src/am{addclient,serverconfig}.pl || die
|
184 |
|
cat "${MYFILESDIR}"/amanda-amandahosts-client-2.5.1_p3-r1 > "${T}"/amandahosts || die
|
|
211 |
cat "${MYFILESDIR}"/amanda-amandahosts-server-2.5.1_p3-r1 > "${T}"/amandahosts || die
|
185 |
212 |
fi
|
186 |
213 |
}
|
187 |
214 |
|
... | ... | |
334 |
361 |
# world-readable
|
335 |
362 |
# 3.3.9: introduced in /etc/amanda-security.conf
|
336 |
363 |
# 3.4.2: moved to /etc/amanda/amanda-security.conf
|
337 |
|
f=/etc/amanda/amanda-security.conf
|
|
364 |
# must be in /etc as all files in /etc/amanda should be owned by amanda user/group
|
|
365 |
f=/etc/amanda-security.conf
|
338 |
366 |
chown root:root "${root}""${f}" || die
|
339 |
367 |
chmod u=rw,go=r "${root}""${f}" || die
|
340 |
368 |
}
|
... | ... | |
378 |
406 |
newins "${MYFILESDIR}"/amanda-cron amanda
|
379 |
407 |
fi
|
380 |
408 |
|
|
409 |
# Install amandahosts file into /etc/amanda so it gets config protection
|
381 |
410 |
insinto /etc/amanda
|
382 |
411 |
einfo "Installing .amandahosts File for ${AMANDA_USER_NAME} user"
|
383 |
412 |
doins "${T}/amandahosts"
|
384 |
413 |
fperms 600 /etc/amanda/amandahosts
|
385 |
414 |
|
386 |
|
dosym "${AMANDA_USER_HOMEDIR}/.amandahosts" /etc/amanda/amandahosts
|
|
415 |
dosym ../../../etc/amanda/amandahosts "${AMANDA_USER_HOMEDIR}/.amandahosts"
|
|
416 |
fowners -h ${AMANDA_USER_NAME}:${AMANDA_GROUP_NAME} "${AMANDA_USER_HOMEDIR}/.amandahosts"
|
|
417 |
|
387 |
418 |
insinto "${AMANDA_USER_HOMEDIR}"
|
388 |
419 |
einfo "Installing .profile for ${AMANDA_USER_NAME} user"
|
389 |
420 |
newins "${MYFILESDIR}"/amanda-profile .profile
|
|
421 |
fowners ${AMANDA_USER_NAME}:${AMANDA_GROUP_NAME} "${AMANDA_USER_HOMEDIR}/.profile"
|
390 |
422 |
|
391 |
423 |
insinto /etc/amanda
|
392 |
424 |
doins example/amanda-client.conf
|
... | ... | |
398 |
430 |
fi
|
399 |
431 |
|
400 |
432 |
keepdir "${AMANDA_TAR_LISTDIR}"
|
|
433 |
fowners ${AMANDA_USER_NAME}:${AMANDA_GROUP_NAME} "${AMANDA_TAR_LISTDIR}"
|
401 |
434 |
keepdir "${AMANDA_USER_HOMEDIR}/amanda"
|
402 |
|
keepdir "${AMANDA_TMPDIR}/dumps"
|
|
435 |
fowners ${AMANDA_USER_NAME}:${AMANDA_GROUP_NAME} "${AMANDA_USER_HOMEDIR}/amanda"
|
403 |
436 |
# Just make sure it exists for XFS to work...
|
404 |
437 |
use xfs && keepdir /var/xfsdump/inventory
|
405 |
438 |
|
|
439 |
fowners ${AMANDA_USER_NAME}:${AMANDA_GROUP_NAME} "${AMANDA_USER_HOMEDIR}"
|
|
440 |
|
|
441 |
newtmpfiles - amanda.conf <<- _EOF_
|
|
442 |
d ${AMANDA_TMPDIR} 0700 ${AMANDA_USER_NAME} ${AMANDA_GROUP_NAME}
|
|
443 |
_EOF_
|
|
444 |
|
406 |
445 |
local i
|
407 |
|
for i in "${AMANDA_TMPDIR}" /etc/amanda; do
|
|
446 |
for i in /etc/amanda; do
|
408 |
447 |
einfo "Securing directory (${i})"
|
409 |
448 |
fowners -R ${AMANDA_USER_NAME}:${AMANDA_GROUP_NAME} ${i}
|
410 |
449 |
done
|
411 |
450 |
# Do NOT use -R
|
412 |
451 |
fperms 0700 \
|
413 |
452 |
"${AMANDA_USER_HOMEDIR}" "${AMANDA_TAR_LISTDIR}" \
|
414 |
|
"${AMANDA_TMPDIR}" "${AMANDA_TMPDIR}/dumps" \
|
415 |
453 |
"${AMANDA_USER_HOMEDIR}/amanda" \
|
416 |
454 |
/etc/amanda
|
417 |
455 |
|
... | ... | |
421 |
459 |
/etc/amanda/${AMANDA_CONFIG_NAME}
|
422 |
460 |
fi
|
423 |
461 |
|
|
462 |
# move example security file to production location
|
|
463 |
mv "${ED}/etc/amanda/amanda-security.conf" "${ED}/etc/amanda-security.conf"
|
|
464 |
|
424 |
465 |
einfo "Setting setuid permissions"
|
425 |
466 |
amanda_permissions_fix "${ED}"
|
426 |
467 |
|
... | ... | |
429 |
470 |
|
430 |
471 |
# docs
|
431 |
472 |
einfo "Installing documentation"
|
432 |
|
dodoc AUTHORS ChangeLog DEVELOPING NEWS README ReleaseNotes UPGRADING
|
|
473 |
dodoc AUTHORS ChangeLog DEVELOPING NEWS ReleaseNotes UPGRADING
|
433 |
474 |
# our inetd sample
|
434 |
475 |
einfo "Installing standard inetd sample"
|
435 |
476 |
newdoc "${MYFILESDIR}"/amanda-inetd.amanda.sample-2.6.0_p2-r2 amanda-inetd.amanda.sample
|
... | ... | |
448 |
489 |
find "${ED}" -name '*.la' -delete || die
|
449 |
490 |
}
|
450 |
491 |
|
|
492 |
pkg_preinst() {
|
|
493 |
[[ -h "${EROOT}/etc/amanda/amandahosts" ]] && rm "${EROOT}/etc/amanda/amandahosts"
|
|
494 |
if [[ -f "${EROOT}/${AMANDA_USER_HOMEDIR}/.amandahosts" && ! -f ${EROOT}/etc/amanda/amandahosts ]]; then
|
|
495 |
einfo "Migrating amandahosts from ${AMANDA_USER_HOMEDIR} to /etc"
|
|
496 |
mv "${EROOT}/${AMANDA_USER_HOMEDIR}/.amandahosts" "${EROOT}/etc/amanda/amandahosts"
|
|
497 |
fi
|
|
498 |
}
|
|
499 |
|
451 |
500 |
pkg_postinst() {
|
452 |
501 |
[[ ! -f ${TMPENVFILE} && ${MERGE_TYPE} == "binary" ]] && TMPENVFILE="${EROOT}${ENVDIR}/${ENVDFILE}"
|
453 |
502 |
[[ ! -f ${TMPENVFILE} ]] && die "Variable setting file (${TMPENVFILE}) should exist!"
|
... | ... | |
468 |
517 |
einfo "Checking setuid permissions"
|
469 |
518 |
amanda_permissions_fix "${EROOT}"/
|
470 |
519 |
|
|
520 |
tmpfiles_process amanda.conf
|
|
521 |
|
471 |
522 |
elog "You should configure Amanda in /etc/amanda now."
|
472 |
523 |
elog
|
473 |
524 |
elog "If you use xinetd, Don't forget to check /etc/xinetd.d/amanda"
|