Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-backup/amanda/files/, app-backup/amanda/
Date: Tue, 31 Jan 2017 21:57:19
Message-Id: 1485899832.5c2f58dbbbb60024a4237c563044f181dba4800a.robbat2@gentoo
1 commit: 5c2f58dbbbb60024a4237c563044f181dba4800a
2 Author: Stefan G. Weichinger <office <AT> oops <DOT> co <DOT> at>
3 AuthorDate: Fri Jan 13 17:17:09 2017 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 31 21:57:12 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5c2f58db
7
8 app-backup/amanda: version bump to 3.4.2, EAPI6 switch
9
10 (cherry picked from commit ed64d25637d041ff6116f3ccaf7a9656e282a9a7)
11 Fixes: https://github.com/gentoo/gentoo/pull/3507
12 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
13
14 app-backup/amanda/Manifest | 2 +
15 app-backup/amanda/amanda-3.4.1.ebuild | 483 +++++++++++++++++++++
16 app-backup/amanda/amanda-3.4.2.ebuild | 480 ++++++++++++++++++++
17 .../amanda/files/amanda-3.4.1-labelstr.patch | 164 +++++++
18 app-backup/amanda/files/amanda-3.4.1-slots.patch | 16 +
19 5 files changed, 1145 insertions(+)
20
21 diff --git a/app-backup/amanda/Manifest b/app-backup/amanda/Manifest
22 index ec3355b..8427d0c 100644
23 --- a/app-backup/amanda/Manifest
24 +++ b/app-backup/amanda/Manifest
25 @@ -2,3 +2,5 @@ DIST amanda-3.3.3.tar.gz 4394935 SHA256 c36c9cd61dc62a7824abb7ba74cc4b09527bd82a
26 DIST amanda-3.3.5.tar.gz 4530463 SHA256 17d14cdc64e5b98270a2ad6c1b58a5e317ab2fe0d518a4212f82f7e3d13d231b SHA512 bef1f5271939e804387424924e6423537efa3ac1a722fe68f3afd77677e5974d8325f1a32a2a22d510344ee3d7b8f480a969611388fcb632c0f3cd640315f812 WHIRLPOOL 5ba8c2734cbd3a7e771b9fc7f9561596e5cda3dce1ea60b7192893fcca401e1c5da6154dcac18084ce6ef5ccacdf4899a65e255424f1bbbdafc219e8405669e4
27 DIST amanda-3.3.7.tar.gz 4618547 SHA256 cd1534c7d9c5b97afcb52b189f05fb158972fadb2cf46249847ae8bc5ad8a78a SHA512 33066a34f5da5a37f4e8b18a365c2e5ae9cd9105a1ed05f74df95d03937bddee25167960e3daf519d3cf04b1580d9e617e48ba1a695fe683823a27ec298582f4 WHIRLPOOL 21c1c70d04bf8f503158d3facdf4dd479ae26d69bcbc89a9ee2812cc97667cc0c9109a7357971c0d43620cd949ea195c1affb23b754afa81438a56aad247e15d
28 DIST amanda-3.3.9.tar.gz 4673301 SHA256 2520b95ca96f1d521d582b7c94bd631486e7029eda1de8e1887d74b323549a41 SHA512 345670a20cff335453e8dcbf457d1fcdb9f266e4a03d729c2b1ba762f4fac323de4a87713d0fd54c11ca244a08dc97fb8c641625f7fa81cb241b3c17748b1b7e WHIRLPOOL e149ab7dbc30cf3585e41d9fb338dd96ab4dd440e31723be51b8ccc9e5841f8dda31d3b89418474e31c7c2498f40177c646f03713c256a4d9341152e2ce2c8e4
29 +DIST amanda-3.4.1.tar.gz 5338575 SHA256 1f69e9bdae774ac2394297dd9d7f98ccbce44ca9199317ada764ca173909d2ac SHA512 245bf334e36fe8b4361d9fc27ea7e7ef5bd2ecec74719caa16cc94d1ebb3abbef058e28d9afd85851654aaae0984531593a35c079d1ba4aed0fc5177e907ec16 WHIRLPOOL b9608456f28fb35137276f16ec24d79ae397a44450b42ec4fa28256763798dee623ab560ba0db147ff41d2abc57810e2318ae64741ea0a054a8ff853f4ad9c59
30 +DIST amanda-3.4.2.tar.gz 5353734 SHA256 175c6a2ef57fe480ddeeefc920a93c8d1cde4111eec76d76e088101a53eeafac SHA512 dea44ffa5eb30318336395ccbd582df2f83da9a4cf91def2834a2e65b2e0f36cafc1911f6b73c3afb63be256484a78b006bdeb1db5b3ecf87dc59d34754987fd WHIRLPOOL af08e2b7b42cead569b69edfa264c1439d21d455e36ba5d346a74631e037773f20cd0563c6cdf95eeea0ee0e1e45328e553a5490ef4c66545acc1a3bd85570d0
31
32 diff --git a/app-backup/amanda/amanda-3.4.1.ebuild b/app-backup/amanda/amanda-3.4.1.ebuild
33 new file mode 100644
34 index 00000000..824612f
35 --- /dev/null
36 +++ b/app-backup/amanda/amanda-3.4.1.ebuild
37 @@ -0,0 +1,483 @@
38 +# Copyright 1999-2017 Gentoo Foundation
39 +# Distributed under the terms of the GNU General Public License v2
40 +# $Id$
41 +
42 +EAPI=6
43 +inherit autotools perl-module user systemd
44 +
45 +DESCRIPTION="The Advanced Maryland Automatic Network Disk Archiver"
46 +HOMEPAGE="http://www.amanda.org/"
47 +SRC_URI="mirror://sourceforge/amanda/${P}.tar.gz"
48 +
49 +LICENSE="HPND BSD BSD-2 GPL-2+ GPL-3+"
50 +SLOT="0"
51 +IUSE="curl gnuplot ipv6 kerberos minimal nls readline s3 samba systemd xfs"
52 +
53 +KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
54 +RDEPEND="sys-libs/readline:=
55 + virtual/awk
56 + app-arch/tar
57 + dev-lang/perl:=
58 + app-arch/dump
59 + net-misc/openssh
60 + >=dev-libs/glib-2.26.0
61 + dev-perl/JSON
62 + dev-perl/Encode-Locale
63 + nls? ( virtual/libintl )
64 + s3? ( >=net-misc/curl-7.10.0 )
65 + !s3? ( curl? ( >=net-misc/curl-7.10.0 ) )
66 + samba? ( net-fs/samba:= )
67 + kerberos? ( app-crypt/mit-krb5 )
68 + xfs? ( sys-fs/xfsdump )
69 + !minimal? (
70 + dev-perl/XML-Simple
71 + virtual/mailx
72 + app-arch/mt-st:=
73 + sys-block/mtx
74 + gnuplot? ( sci-visualization/gnuplot )
75 + app-crypt/aespipe
76 + app-crypt/gnupg
77 + )"
78 +
79 +DEPEND="${RDEPEND}
80 + virtual/pkgconfig
81 + nls? ( sys-devel/gettext )
82 + >=app-text/docbook-xsl-stylesheets-1.72.0
83 + app-text/docbook-xml-dtd
84 + dev-libs/libxslt
85 + dev-lang/swig
86 + "
87 +
88 +MYFILESDIR="${T}/files"
89 +ENVDIR="/etc/env.d"
90 +ENVDFILE="97amanda"
91 +TMPENVFILE="${T}/${ENVDFILE}"
92 +
93 +# This is a complete list of Amanda settings that the ebuild takes from the
94 +# build environment. This allows users to alter the behavior of the package as
95 +# upstream intended, but keeping with Gentoo style. We store a copy of them in
96 +# /etc/env.d/97amanda during the install, so that they are preserved for future
97 +# installed. This variable name must not start with AMANDA_, as we do not want
98 +# it captured into the env file.
99 +ENV_SETTINGS_AMANDA="
100 +AMANDA_GROUP_GID AMANDA_GROUP_NAME
101 +AMANDA_USER_NAME AMANDA_USER_UID AMANDA_USER_SH AMANDA_USER_HOMEDIR AMANDA_USER_GROUPS
102 +AMANDA_SERVER AMANDA_SERVER_TAPE AMANDA_SERVER_TAPE_DEVICE AMANDA_SERVER_INDEX
103 +AMANDA_TAR_LISTDIR AMANDA_TAR
104 +AMANDA_PORTS_UDP AMANDA_PORTS_TCP AMANDA_PORTS_BOTH AMANDA_PORTS
105 +AMANDA_CONFIG_NAME AMANDA_TMPDIR"
106 +
107 +amanda_variable_setup() {
108 +
109 + # Setting vars
110 + local currentamanda
111 +
112 + # Grab the current settings
113 + currentamanda="$(set | egrep "^AMANDA_" | grep -v '^AMANDA_ENV_SETTINGS' | xargs)"
114 +
115 + # First we set the defaults
116 + [[ -z "${AMANDA_GROUP_GID}" ]] && AMANDA_GROUP_GID=87
117 + [[ -z "${AMANDA_GROUP_NAME}" ]] && AMANDA_GROUP_NAME=amanda
118 + [[ -z "${AMANDA_USER_NAME}" ]] && AMANDA_USER_NAME=amanda
119 + [[ -z "${AMANDA_USER_UID}" ]] && AMANDA_USER_UID=87
120 + [[ -z "${AMANDA_USER_SH}" ]] && AMANDA_USER_SH=/bin/bash
121 + [[ -z "${AMANDA_USER_HOMEDIR}" ]] && AMANDA_USER_HOMEDIR=/var/spool/amanda
122 + [[ -z "${AMANDA_USER_GROUPS}" ]] && AMANDA_USER_GROUPS="${AMANDA_GROUP_NAME}"
123 +
124 + # This installs Amanda, with the server. However, it could be a client,
125 + # just specify an alternate server name in AMANDA_SERVER.
126 + [[ -z "${AMANDA_SERVER}" ]] && AMANDA_SERVER="${HOSTNAME}"
127 + [[ -z "${AMANDA_SERVER_TAPE}" ]] && AMANDA_SERVER_TAPE="${AMANDA_SERVER}"
128 + [[ -z "${AMANDA_SERVER_TAPE_DEVICE}" ]] && AMANDA_SERVER_TAPE_DEVICE="/dev/nst0"
129 + [[ -z "${AMANDA_SERVER_INDEX}" ]] && AMANDA_SERVER_INDEX="${AMANDA_SERVER}"
130 + [[ -z "${AMANDA_TAR_LISTDIR}" ]] && AMANDA_TAR_LISTDIR=${AMANDA_USER_HOMEDIR}/tar-lists
131 + [[ -z "${AMANDA_CONFIG_NAME}" ]] && AMANDA_CONFIG_NAME=DailySet1
132 + [[ -z "${AMANDA_TMPDIR}" ]] && AMANDA_TMPDIR=/var/tmp/amanda
133 + [[ -z "${AMANDA_DBGDIR}" ]] && AMANDA_DBGDIR="$AMANDA_TMPDIR"
134 + # These are left empty by default
135 + [[ -z "${AMANDA_PORTS_UDP}" ]] && AMANDA_PORTS_UDP=
136 + [[ -z "${AMANDA_PORTS_TCP}" ]] && AMANDA_PORTS_TCP=
137 + [[ -z "${AMANDA_PORTS_BOTH}" ]] && AMANDA_PORTS_BOTH=
138 + [[ -z "${AMANDA_PORTS}" ]] && AMANDA_PORTS=
139 +
140 + # What tar to use
141 + [[ -z "${AMANDA_TAR}" ]] && AMANDA_TAR=/bin/tar
142 +
143 + # Now pull in the old stuff
144 + if [[ -f "${EROOT}${ENVDIR}/${ENVDFILE}" ]]; then
145 + # We don't just source it as we don't want everything in there.
146 + eval $(egrep "^AMANDA_" "${EROOT}${ENVDIR}/${ENVDFILE}" | grep -v '^AMANDA_ENV_SETTINGS')
147 + fi
148 +
149 + # Re-apply the new settings if any
150 + [ -n "${currentamanda}" ] && eval $(echo "${currentamanda}")
151 +
152 +}
153 +
154 +pkg_setup() {
155 + amanda_variable_setup
156 +
157 + # If USE=minimal, give out a warning, if AMANDA_SERVER is not set to
158 + # another host than HOSTNAME.
159 + if use minimal && [ "${AMANDA_SERVER}" = "${HOSTNAME}" ] ; then
160 + elog "You are installing a client-only version of Amanda."
161 + elog "You should set the variable \$AMANDA_SERVER to point at your"
162 + elog "Amanda-tape-server, otherwise you will have to specify its name"
163 + elog "when using amrecover on the client."
164 + elog "For example: Use something like"
165 + elog "AMANDA_SERVER=\"myserver\" emerge amanda"
166 + elog
167 + fi
168 +
169 + enewgroup "${AMANDA_GROUP_NAME}" "${AMANDA_GROUP_GID}"
170 + enewuser "${AMANDA_USER_NAME}" "${AMANDA_USER_UID}" "${AMANDA_USER_SH}" "${AMANDA_USER_HOMEDIR}" "${AMANDA_USER_GROUPS}"
171 +}
172 +
173 +src_unpack() {
174 + # we do not want the perl src_unpack
175 + default_src_unpack
176 +}
177 +
178 +src_prepare() {
179 + # gentoo bug #331111
180 + sed -i '/^check-local: check-perl$/d' "${S}"/config/automake/scripts.am || die
181 + sed -i '/^check-local:/s,syntax-check,,g' "${S}"/perl/Makefile.am || die
182 +
183 + # bug with glibc-2.16.0
184 + sed -i -e '/gets is a security/d' "${S}"/gnulib/stdio.in.h || die
185 +
186 + eautoreconf
187 +
188 + # places for us to work in
189 + mkdir -p "${MYFILESDIR}" || die
190 + # Now we store the settings we just created
191 + set | egrep "^AMANDA_" | grep -v '^AMANDA_ENV_SETTINGS' > "${TMPENVFILE}" || die
192 +
193 + # Prepare our custom files
194 + einfo "Building custom configuration files"
195 + local i # our iterator
196 + local sedexpr # var for sed expr
197 + sedexpr=''
198 + for i in ${ENV_SETTINGS_AMANDA} ; do
199 + local val
200 + eval "val=\"\${${i}}\""
201 + sedexpr="${sedexpr}s|__${i}__|${val}|g;"
202 + done
203 +
204 + # now apply the sed expr
205 + for i in "${FILESDIR}"/amanda-* ; do
206 + sed -re "${sedexpr}" <"${i}" >"${MYFILESDIR}/`basename ${i}`" || die
207 + done
208 +
209 + if use minimal; then
210 + cat "${MYFILESDIR}"/amanda-amandahosts-server.5.1_p3-r1 > "${T}"/amandahosts || die
211 + else
212 + sed -i -e 's:^\(my $amandahomedir\)=.*:\1 = $localstatedir;:' \
213 + server-src/am{addclient,serverconfig}.pl || die
214 + cat "${MYFILESDIR}"/amanda-amandahosts-client-2.5.1_p3-r1 > "${T}"/amandahosts || die
215 + fi
216 +
217 + eapply "${FILESDIR}"/${P}-slots.patch || die
218 + eapply "${FILESDIR}"/${P}-labelstr.patch || die
219 +
220 + eapply_user
221 +}
222 +
223 +src_configure() {
224 + # fix bug #36316
225 + addpredict /var/cache/samba/gencache.tdb
226 + # fix bug #376169
227 + addpredict /run/blkid
228 + addpredict /etc/blkid.tab
229 +
230 + [ ! -f "${TMPENVFILE}" ] && die "Variable setting file (${TMPENVFILE}) should exist!"
231 + source "${TMPENVFILE}"
232 + local myconf
233 +
234 + einfo "Using ${AMANDA_SERVER_TAPE} for tape server."
235 + myconf="${myconf} --with-tape-server=${AMANDA_SERVER_TAPE}"
236 + einfo "Using ${AMANDA_SERVER_TAPE_DEVICE} for tape server."
237 + myconf="${myconf} --with-tape-device=${AMANDA_SERVER_TAPE_DEVICE}"
238 + einfo "Using ${AMANDA_SERVER_INDEX} for index server."
239 + myconf="${myconf} --with-index-server=${AMANDA_SERVER_INDEX}"
240 + einfo "Using ${AMANDA_USER_NAME} for amanda user."
241 + myconf="${myconf} --with-user=${AMANDA_USER_NAME}"
242 + einfo "Using ${AMANDA_GROUP_NAME} for amanda group."
243 + myconf="${myconf} --with-group=${AMANDA_GROUP_NAME}"
244 + einfo "Using ${AMANDA_TAR} as Tar implementation."
245 + myconf="${myconf} --with-gnutar=${AMANDA_TAR}"
246 + einfo "Using ${AMANDA_TAR_LISTDIR} as tar listdir."
247 + myconf="${myconf} --with-gnutar-listdir=${AMANDA_TAR_LISTDIR}"
248 + einfo "Using ${AMANDA_CONFIG_NAME} as default config name."
249 + myconf="${myconf} --with-config=${AMANDA_CONFIG_NAME}"
250 + einfo "Using ${AMANDA_TMPDIR} as Amanda temporary directory."
251 + myconf="${myconf} --with-tmpdir=${AMANDA_TMPDIR}"
252 +
253 + if [ -n "${AMANDA_PORTS_UDP}" ] && [ -n "${AMANDA_PORTS_TCP}" ] && [ -z "${AMANDA_PORTS_BOTH}" ] ; then
254 + eerror "If you want _both_ UDP and TCP ports, please use only the"
255 + eerror "AMANDA_PORTS environment variable for identical ports, or set"
256 + eerror "AMANDA_PORTS_BOTH."
257 + die "Bad port setup!"
258 + fi
259 + if [ -n "${AMANDA_PORTS_UDP}" ]; then
260 + einfo "Using UDP ports ${AMANDA_PORTS_UDP/,/-}"
261 + myconf="${myconf} --with-udpportrange=${AMANDA_PORTS_UDP}"
262 + fi
263 + if [ -n "${AMANDA_PORTS_TCP}" ]; then
264 + einfo "Using TCP ports ${AMANDA_PORTS_TCP/,/-}"
265 + myconf="${myconf} --with-tcpportrange=${AMANDA_PORTS_TCP}"
266 + fi
267 + if [ -n "${AMANDA_PORTS}" ]; then
268 + einfo "Using ports ${AMANDA_PORTS/,/-}"
269 + myconf="${myconf} --with-portrange=${AMANDA_PORTS}"
270 + fi
271 +
272 + # Extras
273 + # Speed option
274 + myconf="${myconf} --with-buffered-dump"
275 + # "debugging" in the configuration is NOT debug in the conventional sense.
276 + # It is actually just useful output in the application, and should remain
277 + # enabled. There are some cases of breakage with MTX tape changers as of
278 + # 2.5.1p2 that it exposes when turned off as well.
279 + myconf="${myconf} --with-debugging"
280 + # Where to put our files
281 + myconf="${myconf} --localstatedir=${AMANDA_USER_HOMEDIR}"
282 +
283 + # Samba support
284 + myconf="${myconf} $(use_with samba smbclient /usr/bin/smbclient)"
285 +
286 + # Support for BSD, SSH, BSDUDP, BSDTCP security methods all compiled in by
287 + # default
288 + myconf="${myconf} --with-bsd-security"
289 + myconf="${myconf} --with-ssh-security"
290 + myconf="${myconf} --with-bsdudp-security"
291 + myconf="${myconf} --with-bsdtcp-security"
292 +
293 + # kerberos-security mechanism version 5
294 + myconf="${myconf} $(use_with kerberos krb5-security)"
295 +
296 + # Amazon S3 support
297 + myconf="${myconf} `use_enable s3 s3-device`"
298 +
299 + # libcurl is required for S3 but otherwise optional
300 + if ! use s3; then
301 + myconf="${myconf} $(use_with curl libcurl)"
302 + fi
303 +
304 + # Client only, as requested in bug #127725
305 + if use minimal ; then
306 + myconf="${myconf} --without-server"
307 + else
308 + # amplot
309 + myconf="${myconf} $(use_with gnuplot)"
310 + fi
311 +
312 + # IPv6 fun.
313 + myconf="${myconf} `use_with ipv6`"
314 + # This is to prevent the IPv6-is-working test
315 + # As the test fails on binpkg build hosts with no IPv6.
316 + use ipv6 && export amanda_cv_working_ipv6=yes
317 +
318 + # I18N
319 + myconf="${myconf} `use_enable nls`"
320 +
321 + # Bug #296634: Perl location
322 + perl_set_version
323 + myconf="${myconf} --with-amperldir=${VENDOR_LIB}"
324 +
325 + # Bug 296633: --disable-syntax-checks
326 + # Some tests are not safe for production systems
327 + myconf="${myconf} --disable-syntax-checks"
328 +
329 + # build manpages
330 + myconf="${myconf} --enable-manpage-build"
331 +
332 + # bug #483120
333 + tc-export AR
334 +
335 + econf \
336 + $(use_with readline) \
337 + ${myconf}
338 +}
339 +
340 +src_compile() {
341 + # Again, do not want the perl-module src_compile
342 + default_src_compile
343 +}
344 +
345 +src_install() {
346 + [ ! -f "${TMPENVFILE}" ] && die "Variable setting file (${TMPENVFILE}) should exist!"
347 + source ${TMPENVFILE}
348 +
349 + einfo "Doing stock install"
350 + emake DESTDIR="${D}" install || die
351 +
352 + # Build the envdir file
353 + # Don't forget this..
354 + einfo "Building environment file"
355 + (
356 + echo "# These settings are what was present in the environment when this"
357 + echo "# Amanda was compiled. Changing anything below this comment will"
358 + echo "# have no effect on your application, but it merely exists to"
359 + echo "# preserve them for your next emerge of Amanda"
360 + cat "${TMPENVFILE}" | sed "s,=\$,='',g"
361 + ) >> "${MYFILESDIR}/${ENVDFILE}"
362 +
363 + # Env.d
364 + einfo "Installing environment config file"
365 + doenvd "${MYFILESDIR}/${ENVDFILE}"
366 +
367 + # Lock down next section (up until docs).
368 + insopts -m0640
369 + # Installing Amanda Xinetd Services Definition
370 + einfo "Installing xinetd service file"
371 + insinto /etc/xinetd.d
372 + if use minimal ; then
373 + newins "${MYFILESDIR}"/amanda-xinetd-2.6.1_p1-client amanda
374 + else
375 + newins "${MYFILESDIR}"/amanda-xinetd-2.6.1_p1-server amanda
376 + fi
377 +
378 + if ! use minimal; then
379 + einfo "Installing Sample Daily Cron Job for Amanda"
380 + insinto /etc/cron.daily
381 + newins "${MYFILESDIR}/amanda-cron" amanda
382 + fi
383 +
384 + einfo "Installing systemd service and socket files for Amanda"
385 + systemd_dounit "${FILESDIR}"/amanda.socket || die
386 + systemd_newunit "${FILESDIR}"/amanda.service 'amanda@.service' || die
387 +
388 + insinto /etc/amanda
389 + einfo "Installing .amandahosts File for ${AMANDA_USER_NAME} user"
390 + doins "${T}/amandahosts"
391 + fperms 600 /etc/amanda/amandahosts
392 +
393 + dosym /etc/amanda/amandahosts "${AMANDA_USER_HOMEDIR}/.amandahosts"
394 + insinto "${AMANDA_USER_HOMEDIR}"
395 + einfo "Installing .profile for ${AMANDA_USER_NAME} user"
396 + newins "${MYFILESDIR}/amanda-profile" .profile
397 +
398 + insinto /etc/amanda
399 + doins "${S}/example/amanda-client.conf"
400 + if ! use minimal ; then
401 + insinto "/etc/amanda/${AMANDA_CONFIG_NAME}"
402 + doins "${S}/example/amanda.conf"
403 + doins "${S}/example/disklist"
404 + keepdir "${AMANDA_USER_HOMEDIR}/${AMANDA_CONFIG_NAME}/index"
405 + fi
406 +
407 + keepdir "${AMANDA_TAR_LISTDIR}"
408 + keepdir "${AMANDA_USER_HOMEDIR}/amanda"
409 + keepdir "${AMANDA_TMPDIR}/dumps"
410 + # Just make sure it exists for XFS to work...
411 + use xfs && keepdir /var/xfsdump/inventory
412 +
413 + local i
414 + for i in "${AMANDA_USER_HOMEDIR}" "${AMANDA_TAR_LISTDIR}" \
415 + "${AMANDA_TMPDIR}" /etc/amanda; do
416 + einfo "Securing directory (${i})"
417 + fowners -R ${AMANDA_USER_NAME}:${AMANDA_GROUP_NAME} ${i}
418 + done
419 + # Do NOT use -R
420 + fperms 0700 \
421 + "${AMANDA_USER_HOMEDIR}" "${AMANDA_TAR_LISTDIR}" \
422 + "${AMANDA_TMPDIR}" "${AMANDA_TMPDIR}/dumps" \
423 + "${AMANDA_USER_HOMEDIR}/amanda" \
424 + /etc/amanda
425 +
426 + if ! use minimal ; then
427 + fperms 0700 \
428 + "${AMANDA_USER_HOMEDIR}/${AMANDA_CONFIG_NAME}" \
429 + /etc/amanda/${AMANDA_CONFIG_NAME}
430 + fi
431 +
432 + einfo "Setting setuid permissions"
433 + amanda_permissions_fix "${D}"
434 +
435 + # Relax permissions again
436 + insopts -m0644
437 +
438 + # docs
439 + einfo "Installing documentation"
440 + dodoc AUTHORS ChangeLog DEVELOPING NEWS README ReleaseNotes UPGRADING
441 + # our inetd sample
442 + einfo "Installing standard inetd sample"
443 + newdoc "${MYFILESDIR}/amanda-inetd.amanda.sample-2.6.0_p2-r2" amanda-inetd.amanda.sample
444 + # Amanda example configs
445 + einfo "Installing example configurations"
446 + rm "${D}"/usr/share/amanda/{COPYRIGHT,ChangeLog,NEWS,ReleaseNotes}
447 + mv "${D}/usr/share/amanda/example" "${D}/usr/share/doc/${PF}/"
448 + docinto example1
449 + newdoc "${FILESDIR}/example_amanda.conf" amanda.conf
450 + newdoc "${FILESDIR}/example_disklist-2.5.1_p3-r1" disklist
451 + newdoc "${FILESDIR}/example_global.conf" global.conf
452 +
453 + einfo "Cleaning up dud .la files"
454 + perl_set_version
455 + find "${D}"/"${VENDOR_LIB}" -name '*.la' -print0 |xargs -0 rm -f
456 +}
457 +
458 +pkg_postinst() {
459 + [ ! -f "${TMPENVFILE}" -a "$MERGE_TYPE" == "binary" ] && \
460 + TMPENVFILE="${ROOT}${ENVDIR}/${ENVDFILE}"
461 + [ ! -f "${TMPENVFILE}" ] && die "Variable setting file (${TMPENVFILE}) should exist!"
462 + source "${TMPENVFILE}"
463 +
464 + # Migration of amandates from /etc to $localstatedir/amanda
465 + if [ -f "${ROOT}/etc/amandates" -a \
466 + ! -f "${ROOT}/${AMANDA_USER_HOMEDIR}/amanda/amandates" ]; then
467 + einfo "Migrating amandates from /etc/ to ${AMANDA_USER_HOMEDIR}/amanda"
468 + einfo "A backup is also placed at /etc/amandates.orig"
469 + cp -dp "${ROOT}/etc/amandates" "${ROOT}/etc/amandates.orig"
470 + mkdir -p "${ROOT}/${AMANDA_USER_HOMEDIR}/amanda/"
471 + cp -dp "${ROOT}/etc/amandates" "${ROOT}/${AMANDA_USER_HOMEDIR}/amanda/amandates"
472 + fi
473 + if [ -f "${ROOT}/etc/amandates" ]; then
474 + einfo "If you have migrated safely, please delete /etc/amandates"
475 + fi
476 +
477 + einfo "Checking setuid permissions"
478 + amanda_permissions_fix "${ROOT}"
479 +
480 + elog "You should configure Amanda in /etc/amanda now."
481 + elog
482 + elog "If you use xinetd, Don't forget to check /etc/xinetd.d/amanda"
483 + elog "and restart xinetd afterwards!"
484 + elog
485 + elog "Otherwise, please look at /usr/share/doc/${PF}/inetd.amanda.sample"
486 + elog "as an example of how to configure your inetd."
487 + elog
488 + elog "systemd-users: enable and start amanda.socket or the relevant services"
489 + elog "regarding what auth method you use."
490 + elog
491 + elog "NOTICE: If you need raw access to partitions you need to add the"
492 + elog "amanda user to the 'disk' group."
493 + elog
494 + elog "NOTICE: If you have a tape changer, you need to add the amanda user"
495 + elog "to the 'tape' group."
496 + elog
497 + elog "If you use localhost in your disklist your restores may break."
498 + elog "You should replace it with the actual hostname!"
499 + elog "Please also see the syntax changes to amandahosts."
500 + elog "The only exception is when you use the authentication method 'local'."
501 + elog
502 + elog "Please note that this package no longer explicitly depends on"
503 + elog "virtual/inetd, as it supports modes where an inetd is not needed"
504 + elog "(see bug #506028 for details)."
505 +}
506 +
507 +# We have had reports of amanda file permissions getting screwed up.
508 +# Losing setuid, becoming too lax etc.
509 +# ONLY root and users in the amanda group should be able to run these binaries!
510 +amanda_permissions_fix() {
511 + local root="$1"
512 + [ -z "${root}" ] && die "Failed to pass root argument to amanda_permissions_fix!"
513 + local le="/usr/libexec/amanda"
514 + for i in /usr/sbin/amcheck "${le}"/calcsize "${le}"/killpgrp \
515 + "${le}"/rundump "${le}"/runtar "${le}"/dumper \
516 + "${le}"/planner ; do
517 + chown root:${AMANDA_GROUP_NAME} "${root}"/${i}
518 + chmod u=srwx,g=rx,o= "${root}"/${i}
519 + done
520 +}
521
522 diff --git a/app-backup/amanda/amanda-3.4.2.ebuild b/app-backup/amanda/amanda-3.4.2.ebuild
523 new file mode 100644
524 index 00000000..472b5ab
525 --- /dev/null
526 +++ b/app-backup/amanda/amanda-3.4.2.ebuild
527 @@ -0,0 +1,480 @@
528 +# Copyright 1999-2017 Gentoo Foundation
529 +# Distributed under the terms of the GNU General Public License v2
530 +# $Id$
531 +
532 +EAPI=6
533 +inherit autotools perl-module user systemd
534 +
535 +DESCRIPTION="The Advanced Maryland Automatic Network Disk Archiver"
536 +HOMEPAGE="http://www.amanda.org/"
537 +SRC_URI="mirror://sourceforge/amanda/${P}.tar.gz"
538 +
539 +LICENSE="HPND BSD BSD-2 GPL-2+ GPL-3+"
540 +SLOT="0"
541 +IUSE="curl gnuplot ipv6 kerberos minimal nls readline s3 samba systemd xfs"
542 +
543 +KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
544 +RDEPEND="sys-libs/readline:=
545 + virtual/awk
546 + app-arch/tar
547 + dev-lang/perl:=
548 + app-arch/dump
549 + net-misc/openssh
550 + >=dev-libs/glib-2.26.0
551 + dev-perl/JSON
552 + dev-perl/Encode-Locale
553 + nls? ( virtual/libintl )
554 + s3? ( >=net-misc/curl-7.10.0 )
555 + !s3? ( curl? ( >=net-misc/curl-7.10.0 ) )
556 + samba? ( net-fs/samba:= )
557 + kerberos? ( app-crypt/mit-krb5 )
558 + xfs? ( sys-fs/xfsdump )
559 + !minimal? (
560 + dev-perl/XML-Simple
561 + virtual/mailx
562 + app-arch/mt-st:=
563 + sys-block/mtx
564 + gnuplot? ( sci-visualization/gnuplot )
565 + app-crypt/aespipe
566 + app-crypt/gnupg
567 + )"
568 +
569 +DEPEND="${RDEPEND}
570 + virtual/pkgconfig
571 + nls? ( sys-devel/gettext )
572 + >=app-text/docbook-xsl-stylesheets-1.72.0
573 + app-text/docbook-xml-dtd
574 + dev-libs/libxslt
575 + dev-lang/swig
576 + "
577 +
578 +MYFILESDIR="${T}/files"
579 +ENVDIR="/etc/env.d"
580 +ENVDFILE="97amanda"
581 +TMPENVFILE="${T}/${ENVDFILE}"
582 +
583 +# This is a complete list of Amanda settings that the ebuild takes from the
584 +# build environment. This allows users to alter the behavior of the package as
585 +# upstream intended, but keeping with Gentoo style. We store a copy of them in
586 +# /etc/env.d/97amanda during the install, so that they are preserved for future
587 +# installed. This variable name must not start with AMANDA_, as we do not want
588 +# it captured into the env file.
589 +ENV_SETTINGS_AMANDA="
590 +AMANDA_GROUP_GID AMANDA_GROUP_NAME
591 +AMANDA_USER_NAME AMANDA_USER_UID AMANDA_USER_SH AMANDA_USER_HOMEDIR AMANDA_USER_GROUPS
592 +AMANDA_SERVER AMANDA_SERVER_TAPE AMANDA_SERVER_TAPE_DEVICE AMANDA_SERVER_INDEX
593 +AMANDA_TAR_LISTDIR AMANDA_TAR
594 +AMANDA_PORTS_UDP AMANDA_PORTS_TCP AMANDA_PORTS_BOTH AMANDA_PORTS
595 +AMANDA_CONFIG_NAME AMANDA_TMPDIR"
596 +
597 +amanda_variable_setup() {
598 +
599 + # Setting vars
600 + local currentamanda
601 +
602 + # Grab the current settings
603 + currentamanda="$(set | egrep "^AMANDA_" | grep -v '^AMANDA_ENV_SETTINGS' | xargs)"
604 +
605 + # First we set the defaults
606 + [[ -z "${AMANDA_GROUP_GID}" ]] && AMANDA_GROUP_GID=87
607 + [[ -z "${AMANDA_GROUP_NAME}" ]] && AMANDA_GROUP_NAME=amanda
608 + [[ -z "${AMANDA_USER_NAME}" ]] && AMANDA_USER_NAME=amanda
609 + [[ -z "${AMANDA_USER_UID}" ]] && AMANDA_USER_UID=87
610 + [[ -z "${AMANDA_USER_SH}" ]] && AMANDA_USER_SH=/bin/bash
611 + [[ -z "${AMANDA_USER_HOMEDIR}" ]] && AMANDA_USER_HOMEDIR=/var/spool/amanda
612 + [[ -z "${AMANDA_USER_GROUPS}" ]] && AMANDA_USER_GROUPS="${AMANDA_GROUP_NAME}"
613 +
614 + # This installs Amanda, with the server. However, it could be a client,
615 + # just specify an alternate server name in AMANDA_SERVER.
616 + [[ -z "${AMANDA_SERVER}" ]] && AMANDA_SERVER="${HOSTNAME}"
617 + [[ -z "${AMANDA_SERVER_TAPE}" ]] && AMANDA_SERVER_TAPE="${AMANDA_SERVER}"
618 + [[ -z "${AMANDA_SERVER_TAPE_DEVICE}" ]] && AMANDA_SERVER_TAPE_DEVICE="/dev/nst0"
619 + [[ -z "${AMANDA_SERVER_INDEX}" ]] && AMANDA_SERVER_INDEX="${AMANDA_SERVER}"
620 + [[ -z "${AMANDA_TAR_LISTDIR}" ]] && AMANDA_TAR_LISTDIR=${AMANDA_USER_HOMEDIR}/tar-lists
621 + [[ -z "${AMANDA_CONFIG_NAME}" ]] && AMANDA_CONFIG_NAME=DailySet1
622 + [[ -z "${AMANDA_TMPDIR}" ]] && AMANDA_TMPDIR=/var/tmp/amanda
623 + [[ -z "${AMANDA_DBGDIR}" ]] && AMANDA_DBGDIR="$AMANDA_TMPDIR"
624 + # These are left empty by default
625 + [[ -z "${AMANDA_PORTS_UDP}" ]] && AMANDA_PORTS_UDP=
626 + [[ -z "${AMANDA_PORTS_TCP}" ]] && AMANDA_PORTS_TCP=
627 + [[ -z "${AMANDA_PORTS_BOTH}" ]] && AMANDA_PORTS_BOTH=
628 + [[ -z "${AMANDA_PORTS}" ]] && AMANDA_PORTS=
629 +
630 + # What tar to use
631 + [[ -z "${AMANDA_TAR}" ]] && AMANDA_TAR=/bin/tar
632 +
633 + # Now pull in the old stuff
634 + if [[ -f "${EROOT}${ENVDIR}/${ENVDFILE}" ]]; then
635 + # We don't just source it as we don't want everything in there.
636 + eval $(egrep "^AMANDA_" "${EROOT}${ENVDIR}/${ENVDFILE}" | grep -v '^AMANDA_ENV_SETTINGS')
637 + fi
638 +
639 + # Re-apply the new settings if any
640 + [ -n "${currentamanda}" ] && eval $(echo "${currentamanda}")
641 +
642 +}
643 +
644 +pkg_setup() {
645 + amanda_variable_setup
646 +
647 + # If USE=minimal, give out a warning, if AMANDA_SERVER is not set to
648 + # another host than HOSTNAME.
649 + if use minimal && [ "${AMANDA_SERVER}" = "${HOSTNAME}" ] ; then
650 + elog "You are installing a client-only version of Amanda."
651 + elog "You should set the variable \$AMANDA_SERVER to point at your"
652 + elog "Amanda-tape-server, otherwise you will have to specify its name"
653 + elog "when using amrecover on the client."
654 + elog "For example: Use something like"
655 + elog "AMANDA_SERVER=\"myserver\" emerge amanda"
656 + elog
657 + fi
658 +
659 + enewgroup "${AMANDA_GROUP_NAME}" "${AMANDA_GROUP_GID}"
660 + enewuser "${AMANDA_USER_NAME}" "${AMANDA_USER_UID}" "${AMANDA_USER_SH}" "${AMANDA_USER_HOMEDIR}" "${AMANDA_USER_GROUPS}"
661 +}
662 +
663 +src_unpack() {
664 + # we do not want the perl src_unpack
665 + default_src_unpack
666 +}
667 +
668 +src_prepare() {
669 + # gentoo bug #331111
670 + sed -i '/^check-local: check-perl$/d' "${S}"/config/automake/scripts.am || die
671 + sed -i '/^check-local:/s,syntax-check,,g' "${S}"/perl/Makefile.am || die
672 +
673 + # bug with glibc-2.16.0
674 + sed -i -e '/gets is a security/d' "${S}"/gnulib/stdio.in.h || die
675 +
676 + eautoreconf
677 +
678 + # places for us to work in
679 + mkdir -p "${MYFILESDIR}" || die
680 + # Now we store the settings we just created
681 + set | egrep "^AMANDA_" | grep -v '^AMANDA_ENV_SETTINGS' > "${TMPENVFILE}" || die
682 +
683 + # Prepare our custom files
684 + einfo "Building custom configuration files"
685 + local i # our iterator
686 + local sedexpr # var for sed expr
687 + sedexpr=''
688 + for i in ${ENV_SETTINGS_AMANDA} ; do
689 + local val
690 + eval "val=\"\${${i}}\""
691 + sedexpr="${sedexpr}s|__${i}__|${val}|g;"
692 + done
693 +
694 + # now apply the sed expr
695 + for i in "${FILESDIR}"/amanda-* ; do
696 + sed -re "${sedexpr}" <"${i}" >"${MYFILESDIR}/`basename ${i}`" || die
697 + done
698 +
699 + if use minimal; then
700 + cat "${MYFILESDIR}"/amanda-amandahosts-server.5.1_p3-r1 > "${T}"/amandahosts || die
701 + else
702 + sed -i -e 's:^\(my $amandahomedir\)=.*:\1 = $localstatedir;:' \
703 + server-src/am{addclient,serverconfig}.pl || die
704 + cat "${MYFILESDIR}"/amanda-amandahosts-client-2.5.1_p3-r1 > "${T}"/amandahosts || die
705 + fi
706 +
707 + eapply_user
708 +}
709 +
710 +src_configure() {
711 + # fix bug #36316
712 + addpredict /var/cache/samba/gencache.tdb
713 + # fix bug #376169
714 + addpredict /run/blkid
715 + addpredict /etc/blkid.tab
716 +
717 + [ ! -f "${TMPENVFILE}" ] && die "Variable setting file (${TMPENVFILE}) should exist!"
718 + source "${TMPENVFILE}"
719 + local myconf
720 +
721 + einfo "Using ${AMANDA_SERVER_TAPE} for tape server."
722 + myconf="${myconf} --with-tape-server=${AMANDA_SERVER_TAPE}"
723 + einfo "Using ${AMANDA_SERVER_TAPE_DEVICE} for tape server."
724 + myconf="${myconf} --with-tape-device=${AMANDA_SERVER_TAPE_DEVICE}"
725 + einfo "Using ${AMANDA_SERVER_INDEX} for index server."
726 + myconf="${myconf} --with-index-server=${AMANDA_SERVER_INDEX}"
727 + einfo "Using ${AMANDA_USER_NAME} for amanda user."
728 + myconf="${myconf} --with-user=${AMANDA_USER_NAME}"
729 + einfo "Using ${AMANDA_GROUP_NAME} for amanda group."
730 + myconf="${myconf} --with-group=${AMANDA_GROUP_NAME}"
731 + einfo "Using ${AMANDA_TAR} as Tar implementation."
732 + myconf="${myconf} --with-gnutar=${AMANDA_TAR}"
733 + einfo "Using ${AMANDA_TAR_LISTDIR} as tar listdir."
734 + myconf="${myconf} --with-gnutar-listdir=${AMANDA_TAR_LISTDIR}"
735 + einfo "Using ${AMANDA_CONFIG_NAME} as default config name."
736 + myconf="${myconf} --with-config=${AMANDA_CONFIG_NAME}"
737 + einfo "Using ${AMANDA_TMPDIR} as Amanda temporary directory."
738 + myconf="${myconf} --with-tmpdir=${AMANDA_TMPDIR}"
739 +
740 + if [ -n "${AMANDA_PORTS_UDP}" ] && [ -n "${AMANDA_PORTS_TCP}" ] && [ -z "${AMANDA_PORTS_BOTH}" ] ; then
741 + eerror "If you want _both_ UDP and TCP ports, please use only the"
742 + eerror "AMANDA_PORTS environment variable for identical ports, or set"
743 + eerror "AMANDA_PORTS_BOTH."
744 + die "Bad port setup!"
745 + fi
746 + if [ -n "${AMANDA_PORTS_UDP}" ]; then
747 + einfo "Using UDP ports ${AMANDA_PORTS_UDP/,/-}"
748 + myconf="${myconf} --with-udpportrange=${AMANDA_PORTS_UDP}"
749 + fi
750 + if [ -n "${AMANDA_PORTS_TCP}" ]; then
751 + einfo "Using TCP ports ${AMANDA_PORTS_TCP/,/-}"
752 + myconf="${myconf} --with-tcpportrange=${AMANDA_PORTS_TCP}"
753 + fi
754 + if [ -n "${AMANDA_PORTS}" ]; then
755 + einfo "Using ports ${AMANDA_PORTS/,/-}"
756 + myconf="${myconf} --with-portrange=${AMANDA_PORTS}"
757 + fi
758 +
759 + # Extras
760 + # Speed option
761 + myconf="${myconf} --with-buffered-dump"
762 + # "debugging" in the configuration is NOT debug in the conventional sense.
763 + # It is actually just useful output in the application, and should remain
764 + # enabled. There are some cases of breakage with MTX tape changers as of
765 + # 2.5.1p2 that it exposes when turned off as well.
766 + myconf="${myconf} --with-debugging"
767 + # Where to put our files
768 + myconf="${myconf} --localstatedir=${AMANDA_USER_HOMEDIR}"
769 +
770 + # Samba support
771 + myconf="${myconf} $(use_with samba smbclient /usr/bin/smbclient)"
772 +
773 + # Support for BSD, SSH, BSDUDP, BSDTCP security methods all compiled in by
774 + # default
775 + myconf="${myconf} --with-bsd-security"
776 + myconf="${myconf} --with-ssh-security"
777 + myconf="${myconf} --with-bsdudp-security"
778 + myconf="${myconf} --with-bsdtcp-security"
779 +
780 + # kerberos-security mechanism version 5
781 + myconf="${myconf} $(use_with kerberos krb5-security)"
782 +
783 + # Amazon S3 support
784 + myconf="${myconf} `use_enable s3 s3-device`"
785 +
786 + # libcurl is required for S3 but otherwise optional
787 + if ! use s3; then
788 + myconf="${myconf} $(use_with curl libcurl)"
789 + fi
790 +
791 + # Client only, as requested in bug #127725
792 + if use minimal ; then
793 + myconf="${myconf} --without-server"
794 + else
795 + # amplot
796 + myconf="${myconf} $(use_with gnuplot)"
797 + fi
798 +
799 + # IPv6 fun.
800 + myconf="${myconf} `use_with ipv6`"
801 + # This is to prevent the IPv6-is-working test
802 + # As the test fails on binpkg build hosts with no IPv6.
803 + use ipv6 && export amanda_cv_working_ipv6=yes
804 +
805 + # I18N
806 + myconf="${myconf} `use_enable nls`"
807 +
808 + # Bug #296634: Perl location
809 + perl_set_version
810 + myconf="${myconf} --with-amperldir=${VENDOR_LIB}"
811 +
812 + # Bug 296633: --disable-syntax-checks
813 + # Some tests are not safe for production systems
814 + myconf="${myconf} --disable-syntax-checks"
815 +
816 + # build manpages
817 + myconf="${myconf} --enable-manpage-build"
818 +
819 + # bug #483120
820 + tc-export AR
821 +
822 + econf \
823 + $(use_with readline) \
824 + ${myconf}
825 +}
826 +
827 +src_compile() {
828 + # Again, do not want the perl-module src_compile
829 + default_src_compile
830 +}
831 +
832 +src_install() {
833 + [ ! -f "${TMPENVFILE}" ] && die "Variable setting file (${TMPENVFILE}) should exist!"
834 + source ${TMPENVFILE}
835 +
836 + einfo "Doing stock install"
837 + emake DESTDIR="${D}" install || die
838 +
839 + # Build the envdir file
840 + # Don't forget this..
841 + einfo "Building environment file"
842 + (
843 + echo "# These settings are what was present in the environment when this"
844 + echo "# Amanda was compiled. Changing anything below this comment will"
845 + echo "# have no effect on your application, but it merely exists to"
846 + echo "# preserve them for your next emerge of Amanda"
847 + cat "${TMPENVFILE}" | sed "s,=\$,='',g"
848 + ) >> "${MYFILESDIR}/${ENVDFILE}"
849 +
850 + # Env.d
851 + einfo "Installing environment config file"
852 + doenvd "${MYFILESDIR}/${ENVDFILE}"
853 +
854 + # Lock down next section (up until docs).
855 + insopts -m0640
856 + # Installing Amanda Xinetd Services Definition
857 + einfo "Installing xinetd service file"
858 + insinto /etc/xinetd.d
859 + if use minimal ; then
860 + newins "${MYFILESDIR}"/amanda-xinetd-2.6.1_p1-client amanda
861 + else
862 + newins "${MYFILESDIR}"/amanda-xinetd-2.6.1_p1-server amanda
863 + fi
864 +
865 + if ! use minimal; then
866 + einfo "Installing Sample Daily Cron Job for Amanda"
867 + insinto /etc/cron.daily
868 + newins "${MYFILESDIR}/amanda-cron" amanda
869 + fi
870 +
871 + einfo "Installing systemd service and socket files for Amanda"
872 + systemd_dounit "${FILESDIR}"/amanda.socket || die
873 + systemd_newunit "${FILESDIR}"/amanda.service 'amanda@.service' || die
874 +
875 + insinto /etc/amanda
876 + einfo "Installing .amandahosts File for ${AMANDA_USER_NAME} user"
877 + doins "${T}/amandahosts"
878 + fperms 600 /etc/amanda/amandahosts
879 +
880 + dosym /etc/amanda/amandahosts "${AMANDA_USER_HOMEDIR}/.amandahosts"
881 + insinto "${AMANDA_USER_HOMEDIR}"
882 + einfo "Installing .profile for ${AMANDA_USER_NAME} user"
883 + newins "${MYFILESDIR}/amanda-profile" .profile
884 +
885 + insinto /etc/amanda
886 + doins "${S}/example/amanda-client.conf"
887 + if ! use minimal ; then
888 + insinto "/etc/amanda/${AMANDA_CONFIG_NAME}"
889 + doins "${S}/example/amanda.conf"
890 + doins "${S}/example/disklist"
891 + keepdir "${AMANDA_USER_HOMEDIR}/${AMANDA_CONFIG_NAME}/index"
892 + fi
893 +
894 + keepdir "${AMANDA_TAR_LISTDIR}"
895 + keepdir "${AMANDA_USER_HOMEDIR}/amanda"
896 + keepdir "${AMANDA_TMPDIR}/dumps"
897 + # Just make sure it exists for XFS to work...
898 + use xfs && keepdir /var/xfsdump/inventory
899 +
900 + local i
901 + for i in "${AMANDA_USER_HOMEDIR}" "${AMANDA_TAR_LISTDIR}" \
902 + "${AMANDA_TMPDIR}" /etc/amanda; do
903 + einfo "Securing directory (${i})"
904 + fowners -R ${AMANDA_USER_NAME}:${AMANDA_GROUP_NAME} ${i}
905 + done
906 + # Do NOT use -R
907 + fperms 0700 \
908 + "${AMANDA_USER_HOMEDIR}" "${AMANDA_TAR_LISTDIR}" \
909 + "${AMANDA_TMPDIR}" "${AMANDA_TMPDIR}/dumps" \
910 + "${AMANDA_USER_HOMEDIR}/amanda" \
911 + /etc/amanda
912 +
913 + if ! use minimal ; then
914 + fperms 0700 \
915 + "${AMANDA_USER_HOMEDIR}/${AMANDA_CONFIG_NAME}" \
916 + /etc/amanda/${AMANDA_CONFIG_NAME}
917 + fi
918 +
919 + einfo "Setting setuid permissions"
920 + amanda_permissions_fix "${D}"
921 +
922 + # Relax permissions again
923 + insopts -m0644
924 +
925 + # docs
926 + einfo "Installing documentation"
927 + dodoc AUTHORS ChangeLog DEVELOPING NEWS README ReleaseNotes UPGRADING
928 + # our inetd sample
929 + einfo "Installing standard inetd sample"
930 + newdoc "${MYFILESDIR}/amanda-inetd.amanda.sample-2.6.0_p2-r2" amanda-inetd.amanda.sample
931 + # Amanda example configs
932 + einfo "Installing example configurations"
933 + rm "${D}"/usr/share/amanda/{COPYRIGHT,ChangeLog,NEWS,ReleaseNotes}
934 + mv "${D}/usr/share/amanda/example" "${D}/usr/share/doc/${PF}/"
935 + docinto example1
936 + newdoc "${FILESDIR}/example_amanda.conf" amanda.conf
937 + newdoc "${FILESDIR}/example_disklist-2.5.1_p3-r1" disklist
938 + newdoc "${FILESDIR}/example_global.conf" global.conf
939 +
940 + einfo "Cleaning up dud .la files"
941 + perl_set_version
942 + find "${D}"/"${VENDOR_LIB}" -name '*.la' -print0 |xargs -0 rm -f
943 +}
944 +
945 +pkg_postinst() {
946 + [ ! -f "${TMPENVFILE}" -a "$MERGE_TYPE" == "binary" ] && \
947 + TMPENVFILE="${ROOT}${ENVDIR}/${ENVDFILE}"
948 + [ ! -f "${TMPENVFILE}" ] && die "Variable setting file (${TMPENVFILE}) should exist!"
949 + source "${TMPENVFILE}"
950 +
951 + # Migration of amandates from /etc to $localstatedir/amanda
952 + if [ -f "${ROOT}/etc/amandates" -a \
953 + ! -f "${ROOT}/${AMANDA_USER_HOMEDIR}/amanda/amandates" ]; then
954 + einfo "Migrating amandates from /etc/ to ${AMANDA_USER_HOMEDIR}/amanda"
955 + einfo "A backup is also placed at /etc/amandates.orig"
956 + cp -dp "${ROOT}/etc/amandates" "${ROOT}/etc/amandates.orig"
957 + mkdir -p "${ROOT}/${AMANDA_USER_HOMEDIR}/amanda/"
958 + cp -dp "${ROOT}/etc/amandates" "${ROOT}/${AMANDA_USER_HOMEDIR}/amanda/amandates"
959 + fi
960 + if [ -f "${ROOT}/etc/amandates" ]; then
961 + einfo "If you have migrated safely, please delete /etc/amandates"
962 + fi
963 +
964 + einfo "Checking setuid permissions"
965 + amanda_permissions_fix "${ROOT}"
966 +
967 + elog "You should configure Amanda in /etc/amanda now."
968 + elog
969 + elog "If you use xinetd, Don't forget to check /etc/xinetd.d/amanda"
970 + elog "and restart xinetd afterwards!"
971 + elog
972 + elog "Otherwise, please look at /usr/share/doc/${PF}/inetd.amanda.sample"
973 + elog "as an example of how to configure your inetd."
974 + elog
975 + elog "systemd-users: enable and start amanda.socket or the relevant services"
976 + elog "regarding what auth method you use."
977 + elog
978 + elog "NOTICE: If you need raw access to partitions you need to add the"
979 + elog "amanda user to the 'disk' group."
980 + elog
981 + elog "NOTICE: If you have a tape changer, you need to add the amanda user"
982 + elog "to the 'tape' group."
983 + elog
984 + elog "If you use localhost in your disklist your restores may break."
985 + elog "You should replace it with the actual hostname!"
986 + elog "Please also see the syntax changes to amandahosts."
987 + elog "The only exception is when you use the authentication method 'local'."
988 + elog
989 + elog "Please note that this package no longer explicitly depends on"
990 + elog "virtual/inetd, as it supports modes where an inetd is not needed"
991 + elog "(see bug #506028 for details)."
992 +}
993 +
994 +# We have had reports of amanda file permissions getting screwed up.
995 +# Losing setuid, becoming too lax etc.
996 +# ONLY root and users in the amanda group should be able to run these binaries!
997 +amanda_permissions_fix() {
998 + local root="$1"
999 + [ -z "${root}" ] && die "Failed to pass root argument to amanda_permissions_fix!"
1000 + local le="/usr/libexec/amanda"
1001 + for i in /usr/sbin/amcheck "${le}"/calcsize "${le}"/killpgrp \
1002 + "${le}"/rundump "${le}"/runtar "${le}"/dumper \
1003 + "${le}"/planner ; do
1004 + chown root:${AMANDA_GROUP_NAME} "${root}"/${i}
1005 + chmod u=srwx,g=rx,o= "${root}"/${i}
1006 + done
1007 +}
1008
1009 diff --git a/app-backup/amanda/files/amanda-3.4.1-labelstr.patch b/app-backup/amanda/files/amanda-3.4.1-labelstr.patch
1010 new file mode 100644
1011 index 00000000..b169c8a
1012 --- /dev/null
1013 +++ b/app-backup/amanda/files/amanda-3.4.1-labelstr.patch
1014 @@ -0,0 +1,164 @@
1015 +diff --git a/installcheck/Amanda_Rest_Storages.pl b/installcheck/Amanda_Rest_Storages.pl
1016 +index f3c699b..3e4e889 100644
1017 +--- a/installcheck/Amanda_Rest_Storages.pl
1018 ++++ b/installcheck/Amanda_Rest_Storages.pl
1019 +@@ -308,6 +308,7 @@ is_deeply (Installcheck::Rest::remove_source_line($reply),
1020 + 'inventory' => [
1021 + {'current' => 1,
1022 + 'label' => "DISKFLAT-001",
1023 ++ 'label_match' => '1',
1024 + 'device_status' => '0',
1025 + 'reserved' => 0,
1026 + 'f_type' => '1',
1027 +@@ -467,6 +468,7 @@ is_deeply (Installcheck::Rest::remove_source_line($reply),
1028 + 'label' => 'DISKFLAT-001',
1029 + 'datestamp' => '20140509113436',
1030 + 'write_protected' => '',
1031 ++ 'label_match' => '1',
1032 + 'process' => 'Amanda::Rest::Storages',
1033 + 'running_on' => 'amanda-server',
1034 + 'component' => 'rest-server',
1035 +diff --git a/installcheck/amtape.pl b/installcheck/amtape.pl
1036 +index 1a3527f..700c5a2 100644
1037 +--- a/installcheck/amtape.pl
1038 ++++ b/installcheck/amtape.pl
1039 +@@ -177,13 +177,13 @@ like($Installcheck::Run::stderr,
1040 + ok(run('amtape', 'TESTCONF', 'show'),
1041 + "'amtape TESTCONF show'");
1042 + like($Installcheck::Run::stderr,
1043 +- qr/slot +2:.*label MyTape\nslot +3/,
1044 ++ qr/slot +2:.*label MyTape \(label do not match labelstr\)\nslot +3/,
1045 + "'amtape TESTCONF show' ..result correct");
1046 +
1047 + ok(run('amtape', 'TESTCONF', 'show', '2'),
1048 + "'amtape TESTCONF show'");
1049 + like($Installcheck::Run::stderr,
1050 +- qr/^slot +2:.*label MyTape$/,
1051 ++ qr/^slot +2:.*label MyTape \(label do not match labelstr\)$/,
1052 + "'amtape TESTCONF show 2' ..result correct");
1053 +
1054 + ok(run('amtape', 'TESTCONF', 'show', '1,3'),
1055 +@@ -252,13 +252,13 @@ like(run_err('amtape', 'TESTCONF', 'update'),
1056 + ok(run('amtape', 'TESTCONF', 'show'),
1057 + "'amtape TESTCONF show'");
1058 + like($Installcheck::Run::stderr,
1059 +- qr/slot +2:.*label MyTape\nslot +3/,
1060 ++ qr/slot +2:.*label MyTape \(label do not match labelstr\)\nslot +3/,
1061 + "..result correct");
1062 +
1063 + ok(run('amtape', 'TESTCONF', 'inventory'),
1064 + "'amtape TESTCONF inventory'");
1065 + like($Installcheck::Run::stdout,
1066 +- qr/slot +1: blank\nslot +2: label MyTape \(current\)\nslot +3/,
1067 ++ qr/slot +1: blank\nslot +2: label MyTape \(current\) \(label do not match labelstr\)\nslot +3/,
1068 + "..result correct");
1069 +
1070 + ok(run('amtape', 'TESTCONF', 'taper'),
1071 +diff --git a/perl/Amanda/Changer.pm b/perl/Amanda/Changer.pm
1072 +index 92ed9b6..4b4aad4 100644
1073 +--- a/perl/Amanda/Changer.pm
1074 ++++ b/perl/Amanda/Changer.pm
1075 +@@ -60,9 +60,10 @@ sub local_message {
1076 + } elsif ($self->{'code'} == 1100014) {
1077 + return "$self->{'err'}";
1078 + } elsif ($self->{'code'} == 1100015) {
1079 +- return sprintf("slot %3s: date %-14s label %s%s", $self->{'slot'},
1080 ++ return sprintf("slot %3s: date %-14s label %s%s%s", $self->{'slot'},
1081 + $self->{'datestamp'}, $self->{'label'},
1082 +- $self->{'write_protected'}?" (Write protected)":"");
1083 ++ $self->{'write_protected'}?" (Write protected)":"",
1084 ++ $self->{'label_match'}?"":" (label do not match labelstr)");
1085 + } elsif ($self->{'code'} == 1100016) {
1086 + return sprintf("slot %3s: unlabeled volume%s", $self->{'slot'},
1087 + $self->{'write_protected'}?" (Write protected)":"");
1088 +@@ -2014,6 +2015,13 @@ sub show {
1089 + my $st = $dev->read_label();
1090 + my $write_protected = !$dev->check_writable();
1091 + if ($st == $DEVICE_STATUS_SUCCESS) {
1092 ++ my $label_match = match_labelstr(
1093 ++ $self->{'storage'}->{'labelstr'},
1094 ++ $self->{'storage'}->{'autolabel'},
1095 ++ $dev->volume_label(),
1096 ++ $res->{'barcode'},
1097 ++ $res->{'meta'},
1098 ++ $self->{'storage'}->{'storage_name'});
1099 + $params{'user_msg'}->(Amanda::Changer::Message->new(
1100 + source_filename => __FILE__,
1101 + source_line => __LINE__,
1102 +@@ -2022,7 +2030,8 @@ sub show {
1103 + slot => $last_slot,
1104 + datestamp => $dev->volume_time(),
1105 + label => $dev->volume_label(),
1106 +- write_protected => $write_protected));
1107 ++ write_protected => $write_protected,
1108 ++ label_match => $label_match));
1109 + } elsif ($st == $DEVICE_STATUS_VOLUME_UNLABELED) {
1110 + $params{'user_msg'}->(Amanda::Changer::Message->new(
1111 + source_filename => __FILE__,
1112 +diff --git a/perl/Amanda/Rest/Storages.pm b/perl/Amanda/Rest/Storages.pm
1113 +index 680115b..b1b59d2 100644
1114 +--- a/perl/Amanda/Rest/Storages.pm
1115 ++++ b/perl/Amanda/Rest/Storages.pm
1116 +@@ -436,6 +436,17 @@ sub inventory {
1117 + $inv->{'retention_type'} = $tl->get_retention_name($retention_type);
1118 + }
1119 + }
1120 ++ for my $inv (@$inventory) {
1121 ++ if ($inv->{label}) {
1122 ++ $inv->{'label_match'} = Amanda::Util::match_labelstr(
1123 ++ $storage->{'labelstr'},
1124 ++ $storage->{'autolabel'},
1125 ++ $inv->{'label'},
1126 ++ $inv->{'barcode'},
1127 ++ $inv->{'metae'},
1128 ++ $storage->{'storage_name'});
1129 ++ }
1130 ++ }
1131 + push @result_messages, Amanda::Changer::Message->new(
1132 + source_filename => __FILE__,
1133 + source_line => __LINE__,
1134 +diff --git a/server-src/amtape.pl b/server-src/amtape.pl
1135 +index b63607e..d06eefe 100644
1136 +--- a/server-src/amtape.pl
1137 ++++ b/server-src/amtape.pl
1138 +@@ -30,7 +30,7 @@ use Text::Wrap;
1139 + use Amanda::Device qw( :constants );
1140 + use Amanda::Debug qw( :logging );
1141 + use Amanda::Config qw( :init :getconf config_dir_relative );
1142 +-use Amanda::Util qw( :constants );
1143 ++use Amanda::Util qw( :constants match_labelstr );
1144 + use Amanda::Storage;
1145 + use Amanda::Changer;
1146 + use Amanda::Constants;
1147 +@@ -219,6 +219,7 @@ sub {
1148 + for my $sl (@$inv) {
1149 + my $line = "slot $sl->{slot}:";
1150 + my $tle;
1151 ++ my $meta;
1152 + if ($sl->{'state'} == Amanda::Changer::SLOT_EMPTY) {
1153 + $line .= " empty";
1154 + } elsif (!defined($sl->{device_status}) && !defined($sl->{label})) {
1155 +@@ -230,6 +231,7 @@ sub {
1156 + if (defined $tle) {
1157 + if ($tle->{'meta'}) {
1158 + $line .= " ($tle->{'meta'})";
1159 ++ $meta = $tle->{'meta'};
1160 + }
1161 + }
1162 + } elsif ($sl->{'device_status'} == $DEVICE_STATUS_VOLUME_UNLABELED) {
1163 +@@ -263,6 +265,15 @@ sub {
1164 + $line .= " [device error]";
1165 + }
1166 + }
1167 ++ if ($sl->{'label'}) {
1168 ++ if (!match_labelstr($storage->{'labelstr'},
1169 ++ $storage->{'autolabel'},
1170 ++ $sl->{label},
1171 ++ $sl->{'barcode'}, $meta,
1172 ++ $storage->{'storage_name'})) {
1173 ++ $line .= " (label do not match labelstr)";
1174 ++ }
1175 ++ }
1176 + if (defined $tle) {
1177 + my $retention_type = Amanda::Tapelist::get_retention_type($tle->{pool}, $tle->{label});
1178 + $line .= " [" . $tl->get_retention_name($retention_type) . "]";
1179
1180 diff --git a/app-backup/amanda/files/amanda-3.4.1-slots.patch b/app-backup/amanda/files/amanda-3.4.1-slots.patch
1181 new file mode 100644
1182 index 00000000..1e4e583
1183 --- /dev/null
1184 +++ b/app-backup/amanda/files/amanda-3.4.1-slots.patch
1185 @@ -0,0 +1,16 @@
1186 +diff --git a/perl/Amanda/Changer/aggregate.pm b/perl/Amanda/Changer/aggregate.pm
1187 +index a2bd962..ecf9d28 100644
1188 +--- a/perl/Amanda/Changer/aggregate.pm
1189 ++++ b/perl/Amanda/Changer/aggregate.pm
1190 +@@ -391,7 +391,10 @@ sub info_key {
1191 + my $kid = 0;
1192 + for (@$kid_results) {
1193 + my ($err, %kid_info) = @$_;
1194 +- next unless exists($kid_info{'slots'});
1195 ++ if (!exists($kid_info{'slots'})){
1196 ++ $kid++;
1197 ++ next;
1198 ++ }
1199 + my $kid_slots = $kid_info{'slots'};
1200 + push @slots, map "$kid:$_", @{$kid_slots};
1201 + $kid++;