+2008-08-22 Jean-Louis Martineau <martineau@zmanda.com>
+ * configure.in, packaging/deb/rules,
+ packaging/deb/buildpkg, packaging/rpm/buildpkg,
+ packaging/rpm/amanda.spec: Change release to 2.6.0p2
+ * NEWS: News in 2.6.0p2
+
+2008-08-22 Dustin J. Mitchell <dustin@zmanda.com>
+ * perl/amglue/bigint.c: add #include "stdint.h"
+
+2008-08-22 Jean-Louis Martineau <martineau@zmanda.com>
+ * server-src/amadmin.c (tape): Correctly print next tape to use.
+ * server-src/tapefile.c (print_new_tapes): New function to print new
+ tapes.
+ * server-src/tapefile.h (print_new_tapes): Prototype.
+ * server-src/reporter.c: Correctly print next tape to use.
+
+2008-08-22 Dustin J. Mitchell <dustin@zmanda.com>
+ Thanks to Stefan G. Weichinger <sgw@amanda.org>
+ * server-src/taper.c: check errors from device, and handle them by
+ either requesting a new tape or just using the next tape in the
+ changer
+
+2008-08-22 Olivier Nicole <on@cs.ait.ac.th>
+ * changer-src/chg-disk.sh: replace == with =
+
+2008-08-22 Dustin J. Mitchell <dustin@zmanda.com>
+ * changer-src/chg-lib.sh.in: fix sed invocation for BSD's sed
+
+2008-08-22 Jean-Louis Martineau <martineau@zmanda.com>
+ * server-src/reporter.c: Fix computation of compression ratio.
+
+2008-08-21 Jean-Louis Martineau <martineau@zmanda.com>
+ * common-src/krb5-security.c: Fix security_seterror use.
+
+2008-08-21 Jean-Louis Martineau <martineau@zmanda.com>
+ * device-src/queueing.c: Fix compiler warning.
+
+2008-08-19 Dustin J. Mitchell <dustin@zmanda.com>
+ * configure.in: check for getgrgid_r and getpwuid_r
+ * common-src/security-util.c: conditionalize on checks
+
+2008-08-18 Dustin J. Mitchell <dustin@zmanda.com>
+ * common-src/version.h: remove #include of config.h
+ * device-src/vfs-device.c: #include amanda.h first
+
+2008-08-15 Dustin J. Mitchell <dustin@zmanda.com>
+ * common-src/debug.c: include backtraces on fatal errors
+ * config/amanda/debugging.m4: look for glibc's backtrace support
+ * configure.in: ditto
+
+2008-08-05 Dan Locks <dwlocks@zmanda.com>
+ * packaging/rpm/amanda.spec: Merged fixes from trunk .spec for
+ parsing redhat-release for fedora versions correctly.
+
+2008-08-04 Dan Locks <dwlocks@zmanda.com>
+ * packaging/rpm/amanda.spec: add %{tarver} macro and set the correct
+ minimum version per distro (Thanks to Jesse Angell for the rhel4 tip)
+
+2008-07-30 Dustin J. Mitchell <dustin@zmanda.com>
+ * perl/Amanda/Changer.pm perl/Amanda/Cmdline.swg
+ perl/Amanda/Config.swg perl/Amanda/DB/Catalog.pm
+ perl/Amanda/Device.swg perl/Amanda/Logfile.swg
+ perl/Amanda/Util.swg: POD cleanup
+ * perl/Makefile.am: new files, rules to make HTML
+ * perl/amperl.css: CSS file for online POD
+ * perl/make_html.pl: make online POD
+
+2008-07-30 Dustin J. Mitchell <dustin@zmanda.com>
+ * man/Makefile.am man/amanda.css man/index.php man/xslt/html.xsl.in:
+ new files for HTML output
+ * man/xslt/man.xsl.in: substitute XSLT_VERS
+ * man/xml-source/amanda-devices.7.xml: tweaks
+ * man/xml-source/amanda.8.xml: tweaks
+ * man/xml-source/amanda.conf.5.xml: tweaks
+ * man/xml-source/amgetconf.8.xml: tweaks
+ * man/xml-source/amtoc.8.xml: tweaks
+
+2008-07-30 Dan Locks <dwlocks@zmanda.com>
+ * packaging/rpm/amanda.spec: removed activate-devpay from %files section
+
+2008-07-30 Dan Locks <dwlocks@zmanda.com>
+ * device-src/s3.c: Merged changes from 968 to work around a libcurl bug.
+ * config/amanda/s3-device.m4: Same
+
+2008-07-30 Dustin J. Mitchell <dustin@zmanda.com>
+ * installcheck/Amanda_Config.pl: add + to avoid perl-5.6.0 parsing bug
+ * installcheck/amgetconf.pl: ditto
+
+2008-07-28 Dustin J. Mitchell <dustin@zmanda.com>
+ * client-src/sendsize.c: remove cruft causing compile errors on HP/UX
+
+2008-07-28 Dustin J. Mitchell <dustin@zmanda.com>
+ * device-src/tests/semaphore-test.c: move function call out of
+ variable initialization
+
+2008-07-25 Dan Locks <dwlocks@zmanda.com>
+ * packaging/deb/control: added alternative dependency of libssl0.9.8 for
+ Ubuntu 8.x builds. Added build dependencies for debhelper, fakeroot,
+ libcurl-dev, libssl-dev. Updated server and client dependency for curl
+ to libcurl3
+
+2008-07-23 Dustin J. Mitchell <dustin@zmanda.com>
+ * common-src/conffile.c: fix handling for config overwrites of
+ non-string parameters
+
+2008-07-17 Jean-Louis Martineau <martineau@zmanda.com>
+ * amandad-src/amandad.c: amandad must be run by root for krb5 auth.
+
+200i-07-14 Dan Locks <dwlocks@zmanda.com>
+ * packaging/rpm/amanda.spec: fix distribution detection, add
+ activate-devpay to server files list
+
+2008-07-11 Dustin J. Mitchell <dustin@zmanda.com>
+ * device-src/rait-device.c: fix RAIT file numbers; don't pass
+ block-size-related properties down to child devices (we set the block
+ size in find_block_size); don't use union_robust for checking whether
+ labels changed, as it causes spurious failures
+
+2008-07-11 Dustin J. Mitchell <dustin@zmanda.com>
+ Thanks to Stefan G. Weichinger <sgw@amanda.org>
+ * device-src/tape-*.c: return DEVICE_ERROR|VOLUME_MISSING on EIO while
+ checking tape_is_tape_device
+ * changer-src/chg-lib.sh.in: keep waiting for a device if it *might*
+ be busy or offline
+
+2008-07-09 Dustin J. Mitchell <dustin@zmanda.com>
+ * device-src/rait-device.c: rewrite g_ptr_array_union_robust to
+ correctly detect and handle child device failures
+
+2008-07-09 Dustin J. Mitchell <dustin@zmanda.com>
+ * perl/Amanda/Logfile.swg: POD tweaks
+
+2008-07-06 Dan Locks <dwlocks@zmanda.com>
+ * packaging/deb/amanda-backup-server.postrm
+ packaging/deb/amanda-backup-client.postrm: removed unused
+ code
+ * packaging/deb/postrm: fixed typo in deluser command
+ * packaging/deb/rules: added specific preinst and postrm scripts for
+ client and server.
+
+2008-07-04 Dan Locks <dwlocks@zmanda.com>
+ * packaging/rpm/buildpkg: add lines to copy rpms to root of the build dir.
+
+2008-06-30 Ian Turner <ian@zmanda.com>
+ * device-src/rait-device.c: Fix a memory corruption issue on the last
+ block of a file.
+ * device-src/rait-device.c: Track file numbers properly when child
+ devices change them (that is, in rait_device_start_file() and
+ rait_device_seek_file()).
+
+2008-06-27 Ian Turner <ian@zmanda.com>
+ * device-src/rait-device.c (rait_device_start): Check for consistent
+ volume label on all child devices, otherwise fail
+
+2008-06-27 Ian Turner <ian@zmanda.com>
+ * device-src/rait-device.c: Silence a compiler warning.
+
+2008-06-27 Dustin J. Mitchell <dustin@zmanda.com>
+ * device-src/rait-device.c: hack around glib bug in versions <2.10.2
+
+2008-06-09 Dustin J. Mitchell <dustin@zmanda.com>
+ * common-src/conffile.c: don't complain about a missing client conf
+ file, as the complaint interferes with the network communication
+ ("invalid size: could not open conf file")
+
+2008-06-06 Dustin J. Mitchell <dustin@zmanda.com>
+ * device-src/*: bugfixes backported from trunk r1087
+ - device_read_block returns an int, not a gboolean, and sets in_file
+ = FALSE on EOF
+ - tape device only requires a label in READ and APPEND modes
+ - tape device isn't opened until start or read_label
+ - rait sets self->file correctly in start
+ - rait compares child devices' labels and times correctly
+ - vfs correctly chains up in property_get
+ - vfs sets self->file correctly in start with ACCESS_APPEND
+
+2008-06-03 Jean-Louis Martineau <martineau@zmanda.com>
+ * man/xml-source/amdump.8.xml, man/xml-source/amreport.8.xml,
+ man/xml-source/amcheck.8.xml, man/xml-source/amflush.8.xml,
+ man/xml-source/amstatus.8.xml: Add "EXIT CODE" section".
+
+2008-05-30 Jean-Louis Martineau <martineau@zmanda.com>
+ * common-src/security-util.c: Remove unneeded pointer cast.
+ * common-src/stream.c: Fix compiler error.
+
+2008-05-30 Dustin J. Mitchell <dustin@zmanda.com>
+ * common-src/amanda.h, common-src/bsd-security.c,
+ common-src/bsdtcp-security.c, common-src/bsdudp-security.c,
+ common-src/dgram.c, common-src/dgram.h, common-src/krb5-security.c,
+ common-src/security-util.c, common-src/security-util.h,
+ common-src/sockaddr-util.c, common-src/sockaddr-util.h,
+ common-src/stream.c, common-src/util.c, common-src/util.h,
+ restore-src/amidxtaped.c, server-src/amindexd.c: add sockaddr_union,
+ change all relevant functions to use it, to avoid aliasing violations
+
+2008-05-29 Orion Poplawski <orion@cora.nwra.com>
+ * device-src/tests/semaphore-test.c: fix call to amanda_thread_init
+ * device-src/tests/vfs_test.c: fix call to amanda_thread_init
+ * server-src/chunker.c: fix buffer overrun
+
+2008-05-29 Jean-Louis Martineau <martineau@zmanda.com>
+ * common-src/conffile.c (client_keytab): Remove "DEVICE-PROPERTY".
+
+2008-05-28 Dustin J. Mitchell <dustin@zmanda.com>
+ * device-src/rait-device.c: rait-device returns correct size when
+ blocksize is too small
+
+2008-05-25 Jean-Louis Martineau <martineau@zmanda.com>
+ * changer-src/chg-zd-mtx.sh: Fix logging.
+
+2008-05-25 Jean-Louis Martineau <martineau@zmanda.com>
+ * packaging/rpm/amanda.spec: Fix output message.
+
+2008-05-21 Jean-Louis Martineau <martineau@zmanda.com>
+ * server-src/driver.c: Fix quoting of diskname.
+
+2008-05-20 Dustin J. Mitchell <dustin@zmanda.com>
+ * configure.in config/amanda/socklen_t_equiv.m4: detect the type (not
+ necessarily socklen_t used by getpeername et al.
+ * amandad-src/amandad.c server-src/amindexd.c restore-src/amidxtaped.c
+ common-src/util.c common-src/bsdtcp-security.c common-src/amanda.h
+ common-src/krb5-security.c common-src/dgram.c common-src/stream.c:
+ use the type instead of socklen_t
+
+2008-05-14 Dustin J. Mitchell <dustin@zmanda.com>
+ * client-src/amhpfixdevs.sh client-src/Makefile.am
+ client-src/amsinixfixdevs.sh config/amanda/devprefix.m4:
+ permanently remove amsinixfixdevs and amhpfixdevs
+
+2008-05-16 Jean-Louis Martineau <martineau@zmanda.com>
+ * common-src/conffile.c: Fix conf_parserror use.
+
2008-05-13 Dan Locks <dwlocks@zmanda.com>
* packaging/deb/buildpkg: modified build script to create unsigned
packages
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
+Changes in release 2.6.0p2
+
+ * Bugs fix only:
+ o Various device-api fix
+ o Compilation on various platform
+ o others small fixes.
+
Changes in release 2.6.0p1
* Bugs fix only:
m4_include([config/amanda/rsh-security.m4])
m4_include([config/amanda/s3-device.m4])
m4_include([config/amanda/shmem.m4])
+m4_include([config/amanda/socklen_t_equiv.m4])
m4_include([config/amanda/ssh-security.m4])
m4_include([config/amanda/summary.m4])
m4_include([config/amanda/swig.m4])
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
config_init(CONFIG_INIT_CLIENT, NULL);
- check_running_as(RUNNING_AS_CLIENT_LOGIN);
+ if (geteuid() == 0) {
+ check_running_as(RUNNING_AS_ROOT);
+ initgroups(CLIENT_LOGIN, get_client_gid());
+ setgid(get_client_gid());
+ setegid(get_client_gid());
+ seteuid(get_client_uid());
+ } else {
+ check_running_as(RUNNING_AS_CLIENT_LOGIN);
+ }
erroutput_type = (ERR_INTERACTIVE|ERR_SYSLOG);
}
#ifdef USE_REUSEADDR
r = setsockopt(in, SOL_SOCKET, SO_REUSEADDR,
- (void *)&on, (socklen_t)sizeof(on));
+ (void *)&on, (socklen_t_equiv)sizeof(on));
if (r < 0) {
dbprintf(_("amandad: setsockopt(SO_REUSEADDR) failed: %s\n"),
strerror(errno));
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = (in_port_t)htons((in_port_t)atoi(argv[i]));
#endif
- if (bind(in, (struct sockaddr *)&sin, (socklen_t)sizeof(sin)) < 0) {
+ if (bind(in, (struct sockaddr *)&sin, (socklen_t_equiv)sizeof(sin)) < 0) {
error(_("can't bind to port %d: %s\n"), atoi(argv[i]),
strerror(errno));
/*NOTREACHED*/
struct sockaddr_in sin;
#endif
int sock;
- socklen_t n;
+ socklen_t_equiv n;
argv[i] += strlen("-tcp=");
#ifdef WORKING_IPV6
}
#ifdef USE_REUSEADDR
r = setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
- (void *)&on, (socklen_t)sizeof(on));
+ (void *)&on, (socklen_t_equiv)sizeof(on));
if (r < 0) {
dbprintf(_("amandad: setsockopt(SO_REUSEADDR) failed: %s\n"),
strerror(errno));
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = (in_port_t)htons((in_port_t)atoi(argv[i]));
#endif
- if (bind(sock, (struct sockaddr *)&sin, (socklen_t)sizeof(sin)) < 0) {
+ if (bind(sock, (struct sockaddr *)&sin, (socklen_t_equiv)sizeof(sin)) < 0) {
error(_("can't bind to port %d: %s\n"), atoi(argv[i]),
strerror(errno));
/*NOTREACHED*/
}
listen(sock, 10);
- n = (socklen_t)sizeof(sin);
+ n = (socklen_t_equiv)sizeof(sin);
in = out = accept(sock, (struct sockaddr *)&sin, &n);
}
/*
exit_on_qlength = 1;
}
+ if (getuid() == 0) {
+ if (strcasecmp(auth, "krb5") != 0) {
+ error(_("Amanda must be run as user '%s' when using '%s' authetication"),
+ CLIENT_LOGIN, auth);
+ }
+ } else {
+ if (strcasecmp(auth, "krb5") == 0) {
+ error(_("Amanda must be run as user 'root' when using 'krb5' authetication"));
+ }
+ }
+
+
/* initialize */
startclock();
dbprintf(_("WARNING: argv[0] not defined: check inetd.conf\n"));
}
+ /* krb5 require the euid to be 0 */
+ if (strcasecmp(auth, "krb5") == 0) {
+ seteuid((uid_t)0);
+ }
+
/*
* Schedule to call protocol_accept() when new security handles
* are created on stdin.
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
MYNAME=$0
TAPE=`amgetconf$SUF tapedev`
-if test X"$TAPE" == X""; then
+if test X"$TAPE" = X""; then
echo `_ '<none> tapedev not specified in amanda.conf.'`
exit 2
fi
# on device status, since some devices can't differentiate between device
# problems and an unlabeled volume.
amdevcheck_status() {
- amdevcheck_config_dir=`pwd`
- amdevcheck_config_name=`basename $amdevcheck_config_dir`
- amdevcheck_output=`amdevcheck $amdevcheck_config_name $@`
-
- if test $? -eq 0 || \
- echo $amdevcheck_output | grep UNLABELED > /dev/null; then
- return 0
+ amdevcheck_message=
+ local amdevcheck_config_dir=`pwd`
+ local amdevcheck_config_name=`basename $amdevcheck_config_dir`
+ local amdevcheck_output=`amdevcheck $amdevcheck_config_name $@`
+ local amdevcheck_status=$?
+
+ test "$amdevcheck_status" -ne 0 && return 0
+
+ # extract any messages
+ amdevcheck_message=`echo "$amdevcheck_output" | sed '/^MESSAGE /{s/^MESSAGE //;p;}; d'`
+
+ # Return 1 if it's possible that the device is offline or busy; if the device cannot
+ # distinguish this state from an error condition, then our caller will just have to
+ # time out
+ if echo "$amdevcheck_output" | $EGREP "VOLUME_MISSING" > /dev/null; then
+ return 1
else
- return 1
+ return 0
fi
}
###
Run() {
- Log `_ 'Running: %s' "$@"`
+ Log `_ 'Running: %s' "$*"`
rm -f $stdout $stderr
"$@" > $stdout 2> $stderr
exitcode=$?
amlibexec_PROGRAMS = noop calcsize killpgrp rundump runtar selfcheck sendbackup sendsize versionsuffix
-sbin_SCRIPTS = @CLIENT_SCRIPTS_OPT@
-EXTRA_SCRIPTS = amhpfixdevs amsinixfixdevs
-
amlibexec_SCRIPTS = patch-system
CHECK_PERL = $(sbin_SCRIPTS)
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(amlibexecdir)" \
- "$(DESTDIR)$(amlibexecdir)" "$(DESTDIR)$(sbindir)"
+ "$(DESTDIR)$(amlibexecdir)"
amlibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(amlib_LTLIBRARIES)
libamclient_la_DEPENDENCIES = ../common-src/libamanda.la
../amandad-src/libamandad.la ../common-src/libamanda.la \
../gnulib/libgnu.la
amlibexecSCRIPT_INSTALL = $(INSTALL_SCRIPT)
-sbinSCRIPT_INSTALL = $(INSTALL_SCRIPT)
-SCRIPTS = $(amlibexec_SCRIPTS) $(sbin_SCRIPTS)
+SCRIPTS = $(amlibexec_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(top_builddir)/config@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
LINT = $(AMLINT)
LINTFLAGS = $(AMLINTFLAGS)
amlib_LTLIBRARIES = libamclient.la
-sbin_SCRIPTS = @CLIENT_SCRIPTS_OPT@
-EXTRA_SCRIPTS = amhpfixdevs amsinixfixdevs
amlibexec_SCRIPTS = patch-system
CHECK_PERL = $(sbin_SCRIPTS)
SCRIPTS_PERL = $(CHECK_PERL)
echo " rm -f '$(DESTDIR)$(amlibexecdir)/$$f'"; \
rm -f "$(DESTDIR)$(amlibexecdir)/$$f"; \
done
-install-sbinSCRIPTS: $(sbin_SCRIPTS)
- @$(NORMAL_INSTALL)
- test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
- @list='$(sbin_SCRIPTS)'; for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- if test -f $$d$$p; then \
- f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
- echo " $(sbinSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
- $(sbinSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(sbindir)/$$f"; \
- else :; fi; \
- done
-
-uninstall-sbinSCRIPTS:
- @$(NORMAL_UNINSTALL)
- @list='$(sbin_SCRIPTS)'; for p in $$list; do \
- f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
- echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
- rm -f "$(DESTDIR)$(sbindir)/$$f"; \
- done
mostlyclean-compile:
-rm -f *.$(OBJEXT)
$(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(HEADERS)
installdirs:
- for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(amlibexecdir)" "$(DESTDIR)$(amlibexecdir)" "$(DESTDIR)$(sbindir)"; do \
+ for dir in "$(DESTDIR)$(amlibdir)" "$(DESTDIR)$(amlibexecdir)" "$(DESTDIR)$(amlibexecdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
install-dvi: install-dvi-am
-install-exec-am: install-amlibexecPROGRAMS install-amlibexecSCRIPTS \
- install-sbinSCRIPTS
+install-exec-am: install-amlibexecPROGRAMS install-amlibexecSCRIPTS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
ps-am:
uninstall-am: uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \
- uninstall-amlibexecSCRIPTS uninstall-sbinSCRIPTS
+ uninstall-amlibexecSCRIPTS
.MAKE: install-am install-data-am install-exec-am install-strip
install-data-hook install-dvi install-dvi-am install-exec \
install-exec-am install-exec-hook install-html install-html-am \
install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-sbinSCRIPTS \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am \
- uninstall-amlibLTLIBRARIES uninstall-amlibexecPROGRAMS \
- uninstall-amlibexecSCRIPTS uninstall-sbinSCRIPTS
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-amlibLTLIBRARIES \
+ uninstall-amlibexecPROGRAMS uninstall-amlibexecSCRIPTS
# Perl
char *disk,
char *amdevice,
int level,
- option_t *options,
+ option_t *options G_GNUC_UNUSED,
char **errmsg)
{
int pipefd[2], nullfd, stdoutfd, killctl[2];
int is_rundump = 1;
#endif
- (void)options; /* Quiet unused parameter warning */
-
- (void)getsize_smbtar; /* Quiet unused parameter warning */
-
g_snprintf(level_str, SIZEOF(level_str), "%d", level);
device = amname_to_devname(amdevice);
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
#include <arpa/inet.h>
#endif
-/* Support for missing IPv6 components */
-#ifndef HAVE_SOCKADDR_STORAGE
-# define sockaddr_storage sockaddr_in
-# define ss_family sin_family
-#endif
-
#ifdef WORKING_IPV6
#define INET6
#endif
#define MAX_TAPE_LABEL_BUF (MAX_TAPE_LABEL_LEN+1)
#define MAX_TAPE_LABEL_FMT "%10240s"
+/* Unfortunately, the system-level sockaddr_storage definition can lead to
+ * C aliasing errors (where the optimizer doesn't notice that two operations
+ * affect the same datum). We define our own similar type as a union.
+ */
+typedef union sockaddr_union {
+ struct sockaddr sa;
+ struct sockaddr_in sin;
+#ifdef WORKING_IPV6
+ struct sockaddr_in6 sin6;
+#endif
+#ifdef HAVE_SOCKADDR_STORAGE
+ struct sockaddr_storage ss; /* not used; just here to make the union full-size */
+#endif
+} sockaddr_union;
+
#include "debug.h"
#include "file.h"
/* from old bsd-security.c */
extern int debug;
-extern int check_security(struct sockaddr_storage *, char *, unsigned long, char **);
+extern int check_security(sockaddr_union *, char *, unsigned long, char **);
/*
* Handle functions which are not always declared on all systems. This
/* AIX #defines accept, and provides a prototype for the alternate name */
#if !defined(HAVE_ACCEPT_DECL) && !defined(accept)
-extern int accept(int s, struct sockaddr *addr, socklen_t *addrlen);
+extern int accept(int s, struct sockaddr *addr, socklen_t_equiv *addrlen);
#endif
#ifndef HAVE_ATOF_DECL
#endif
#ifndef HAVE_BIND_DECL
-extern int bind(int s, const struct sockaddr *name, socklen_t namelen);
+extern int bind(int s, const struct sockaddr *name, socklen_t_equiv namelen);
#endif
#ifndef HAVE_BZERO
#endif
#ifndef HAVE_CONNECT_DECL
-extern int connect(int s, struct sockaddr *name, socklen_t namelen);
+extern int connect(int s, struct sockaddr *name, socklen_t_equiv namelen);
#endif
#ifndef HAVE_FCLOSE_DECL
/* AIX #defines getpeername, and provides a prototype for the alternate name */
#if !defined(HAVE_GETPEERNAME_DECL) && !defined(getpeername)
-extern int getpeername(int s, struct sockaddr *name, socklen_t *namelen);
+extern int getpeername(int s, struct sockaddr *name, socklen_t_equiv *namelen);
#endif
/* AIX #defines getsockname, and provides a prototype for the alternate name */
#if !defined(HAVE_GETSOCKNAME_DECL) && !defined(getsockname)
-extern int getsockname(int s, struct sockaddr *name, socklen_t *namelen);
+extern int getsockname(int s, struct sockaddr *name, socklen_t_equiv *namelen);
#endif
#ifndef HAVE_GETSOCKOPT_DECL
extern int getsockopt(int s, int level, int optname, char *optval,
- socklen_t *optlen);
+ socklen_t_equiv *optlen);
#endif
#ifndef HAVE_INITGROUPS
/* AIX #defines recvfrom, and provides a prototype for the alternate name */
#if !defined(HAVE_RECVFROM_DECL) && !defined(recvfrom)
extern int recvfrom(int s, char *buf, int len, int flags,
- struct sockaddr *from, socklen_t *fromlen);
+ struct sockaddr *from, socklen_t_equiv *fromlen);
#endif
#ifndef HAVE_REMOVE_DECL
#include "packet.h"
#include "security.h"
#include "security-util.h"
+#include "sockaddr-util.h"
#include "stream.h"
#include "version.h"
handle=alloc(15);
g_snprintf(handle, 14, "000-%08x", (unsigned)newhandle++);
if (udp_inithandle(bh->udp, bh, canonname,
- (struct sockaddr_storage *)res_addr->ai_addr, port, handle, sequence) < 0) {
+ (sockaddr_union *)res_addr->ai_addr, port, handle, sequence) < 0) {
(*fn)(arg, &bh->sech, S_ERROR);
amfree(bh->hostname);
amfree(bh);
bs = alloc(SIZEOF(*bs));
security_streaminit(&bs->secstr, &bsd_security_driver);
- bs->socket = stream_server(bh->udp->peer.ss_family, &bs->port,
+ bs->socket = stream_server(SU_GET_FAMILY(&bh->udp->peer), &bs->port,
(size_t)STREAM_BUFSIZE, (size_t)STREAM_BUFSIZE,
0);
if (bs->socket < 0) {
void (*fn)(security_handle_t *, pkt_t *),
void *datap)
{
- struct sockaddr_storage sin;
- socklen_t len;
+ sockaddr_union sin;
+ socklen_t_equiv len;
struct tcp_conn *rc;
char hostname[NI_MAXHOST];
int result;
handle=alloc(15);
g_snprintf(handle,14,"000-%08x", newhandle++);
if (udp_inithandle(bh->udp, bh, canonname,
- (struct sockaddr_storage *)res_addr->ai_addr, port,
+ (sockaddr_union *)res_addr->ai_addr, port,
handle, sequence) < 0) {
(*fn)(arg, &bh->sech, S_ERROR);
amfree(bh->hostname);
{ "INDEX_SERVER", CONF_INDEX_SERVER },
{ "TAPE_SERVER", CONF_TAPE_SERVER },
{ "TAPEDEV", CONF_TAPEDEV },
- { "DEVICE-PROPERTY", CONF_DEVICE_PROPERTY },
{ "AUTH", CONF_AUTH },
{ "SSH_KEYS", CONF_SSH_KEYS },
{ "AMANDAD_PATH", CONF_AMANDAD_PATH },
current_filename = config_dir_relative(filename);
if ((current_file = fopen(current_filename, "r")) == NULL) {
- g_fprintf(stderr, _("could not open conf file \"%s\": %s\n"), current_filename,
+ /* client conf files are optional, and this fprintf ends up sending this message back
+ * to the server without proper auth encapsulation, leading to "invalid size: could not
+ * open .." This is fixed in TRUNK by completely rewriting this module's error-handling
+ * code. */
+ if (!is_client) {
+ g_fprintf(stderr, _("could not open conf file \"%s\": %s\n"), current_filename,
strerror(errno));
+ }
got_parserror = TRUE;
goto finish;
}
if(np->token == tok) break;
if(np->token == CONF_UNKNOWN)
- conf_parserror(errormsg);
+ conf_parserror("%s", errormsg);
else {
np->read_function(np, &valarray[np->parm]);
if(np->validate_function)
if (key_parm->type == CONFTYPE_STR) {
current_line = vstralloc("\"", value, "\"", NULL);
} else {
- current_line = stralloc("");
+ current_line = stralloc(value);
}
current_char = current_line;
#include "timestamp.h"
#include "conffile.h"
+#ifdef HAVE_GLIBC_BACKTRACE
+#include <execinfo.h>
+#endif
+
/* Minimum file descriptor on which to keep the debug file. This is intended
* to keep the descriptor "out of the way" of other processing. It's not clear
* that this is required any longer, but it doesn't hurt anything.
fflush(stderr);
}
+#ifdef HAVE_GLIBC_BACKTRACE
+ /* try logging a traceback to the debug log */
+ if (db_fd != -1) {
+ void *stack[32];
+ int naddrs;
+ naddrs = backtrace(stack, sizeof(stack)/sizeof(*stack));
+ backtrace_symbols_fd(stack, naddrs, db_fd);
+ }
+#endif
+
/* we're done */
if (log_level & G_LOG_LEVEL_CRITICAL)
exit(error_exit_status);
in_port_t * portp)
{
int s, retries;
- socklen_t len;
- struct sockaddr_storage name;
+ socklen_t_equiv len;
+ sockaddr_union name;
int save_errno;
int *portrange;
return -1;
}
- SS_INIT(&name, family);
- SS_SET_INADDR_ANY(&name);
+ SU_INIT(&name, family);
+ SU_SET_INADDR_ANY(&name);
/*
* If a port range was specified, we try to get a port in that
out:
/* find out what name was actually used */
- len = (socklen_t)sizeof(name);
+ len = (socklen_t_equiv)sizeof(name);
if(getsockname(s, (struct sockaddr *)&name, &len) == -1) {
save_errno = errno;
dbprintf(_("dgram_bind: getsockname() failed: %s\n"), strerror(save_errno));
aclose(s);
return -1;
}
- *portp = SS_GET_PORT(&name);
+ *portp = SU_GET_PORT(&name);
dgram->socket = s;
dbprintf(_("dgram_bind: socket %d bound to %s\n"),
int
dgram_send_addr(
- struct sockaddr_storage *addr,
+ sockaddr_union *addr,
dgram_t * dgram)
{
int s, rc;
s = dgram->socket;
socket_opened = 0;
} else {
- if((s = socket(addr->ss_family, SOCK_DGRAM, 0)) == -1) {
+ if((s = socket(SU_GET_FAMILY(addr), SOCK_DGRAM, 0)) == -1) {
save_errno = errno;
dbprintf(_("dgram_send_addr: socket() failed: %s\n"),
strerror(save_errno));
socket_opened = 1;
#ifdef USE_REUSEADDR
r = setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
- (void *)&on, (socklen_t)sizeof(on));
+ (void *)&on, (socklen_t_equiv)sizeof(on));
if (r < 0) {
dbprintf(_("dgram_send_addr: setsockopt(SO_REUSEADDR) failed: %s\n"),
strerror(errno));
dgram_recv(
dgram_t * dgram,
int timeout,
- struct sockaddr_storage *fromaddr)
+ sockaddr_union *fromaddr)
{
SELECT_ARG_TYPE ready;
struct timeval to;
ssize_t size;
int sock;
- socklen_t addrlen;
+ socklen_t_equiv addrlen;
ssize_t nfound;
int save_errno;
return nfound;
}
- addrlen = (socklen_t)sizeof(struct sockaddr_storage);
+ addrlen = (socklen_t_equiv)sizeof(sockaddr_union);
size = recvfrom(sock, dgram->data, (size_t)MAX_DGRAM, 0,
(struct sockaddr *)fromaddr, &addrlen);
if(size == -1) {
int dgram_bind(dgram_t *dgram, sa_family_t family, in_port_t *portp);
void dgram_socket(dgram_t *dgram, int sock);
-int dgram_send_addr(struct sockaddr_storage *addr, dgram_t *dgram);
+int dgram_send_addr(sockaddr_union *addr, dgram_t *dgram);
ssize_t dgram_recv(dgram_t *dgram, int timeout,
- struct sockaddr_storage *fromaddr);
+ sockaddr_union *fromaddr);
void dgram_zero(dgram_t *dgram);
int dgram_cat(dgram_t *dgram, const char *fmt, ...)
G_GNUC_PRINTF(2,3);
#define CC "gcc"
-#define BUILT_DATE "Wed May 14 17:05:51 EDT 2008"
+#define BUILT_DATE "Fri Aug 22 14:21:05 EDT 2008"
#define BUILT_MACH "x86_64-unknown-linux-gnu"
void (*fn)(security_handle_t *, pkt_t *),
void *datap)
{
- struct sockaddr_storage sin;
- socklen_t len;
+ sockaddr_union sin;
+ socklen_t_equiv len;
struct tcp_conn *rc;
char hostname[NI_MAXHOST];
int result;
* Send back the response
*/
if (send_tok.length != 0 && tcpm_send_token(rc, rc->write, rs->handle, &errmsg, send_tok.value, send_tok.length) < 0) {
- security_seterror(&rh->sech, rc->errmsg);
+ security_seterror(&rh->sech, "%s", rc->errmsg);
gss_release_buffer(&min_stat, &send_tok);
goto done;
}
rh->rc = sec_tcp_conn_get(rh->hostname, 1);
rh->rc->driver = rh->sech.driver;
rs->rc = rh->rc;
- rs->socket = stream_server(rh->udp->peer.ss_family, &rs->port,
+ rs->socket = stream_server(SU_GET_FAMILY(&rh->udp->peer), &rs->port,
STREAM_BUFSIZE, STREAM_BUFSIZE, 0);
if (rs->socket < 0) {
security_seterror(&rh->sech,
/*
* Request packets must come from a reserved port
*/
- port = SS_GET_PORT(&rh->peer);
+ port = SU_GET_PORT(&rh->peer);
if (port >= IPPORT_RESERVED) {
security_seterror(&rh->sech,
_("host %s: port %u not secure"), rh->hostname,
udp_handle_t * udp,
struct sec_handle * rh,
char * hostname,
- struct sockaddr_storage *addr,
+ sockaddr_union *addr,
in_port_t port,
char * handle,
int sequence)
rh->hostname = stralloc(hostname);
copy_sockaddr(&rh->peer, addr);
- SS_SET_PORT(&rh->peer, port);
+ SU_SET_PORT(&rh->peer, port);
rh->prev = udp->bh_last;
return;
}
- port = SS_GET_PORT(&udp->peer);
+ port = SU_GET_PORT(&udp->peer);
a = udp_inithandle(udp, rh,
hostname,
&udp->peer,
char *
check_user_amandahosts(
const char * host,
- struct sockaddr_storage *addr,
+ sockaddr_union *addr,
struct passwd * pwd,
const char * remoteuser,
const char * service)
(strcasecmp(filehost, "localhost")== 0 ||
strcasecmp(filehost, "localhost.localdomain")== 0)) {
#ifdef WORKING_IPV6
- if (addr->ss_family == (sa_family_t)AF_INET6)
- inet_ntop(AF_INET6, &((struct sockaddr_in6 *)addr)->sin6_addr,
+ if (SU_GET_FAMILY(addr) == (sa_family_t)AF_INET6)
+ inet_ntop(AF_INET6, &addr->sin6.sin6_addr,
ipstr, sizeof(ipstr));
else
#endif
- inet_ntop(AF_INET, &((struct sockaddr_in *)addr)->sin_addr,
+ inet_ntop(AF_INET, &addr->sin.sin_addr,
ipstr, sizeof(ipstr));
if (strcmp(ipstr, "127.0.0.1") == 0 ||
strcmp(ipstr, "::1") == 0)
/* return 1 on success, 0 on failure */
int
check_security(
- struct sockaddr_storage *addr,
+ sockaddr_union *addr,
char * str,
unsigned long cksum,
char ** errstr)
/* next, make sure the remote port is a "reserved" one */
- port = SS_GET_PORT(addr);
+ port = SU_GET_PORT(addr);
if (port >= IPPORT_RESERVED) {
*errstr = vstrallocf(_("[host %s: port %u not secure]"),
remotehost, (unsigned int)port);
{
char *name = vstralloc(a, b, NULL);
struct stat sbuf;
- struct passwd *pwptr;
- struct passwd pw;
+ struct passwd *pwptr G_GNUC_UNUSED;
+ struct passwd pw G_GNUC_UNUSED;
char *owner;
- struct group *grptr;
- struct group gr;
+ struct group *grptr G_GNUC_UNUSED;
+ struct group gr G_GNUC_UNUSED;
char *group;
- int buflen;
- char *buf;
+ int buflen G_GNUC_UNUSED;
+ char *buf G_GNUC_UNUSED;
if (stat(name, &sbuf) != 0) {
auth_debug(1, _("bsd: cannot stat %s: %s\n"), name, strerror(errno));
#endif
buf = malloc(buflen);
- if (getpwuid_r(sbuf.st_uid, &pw, buf, buflen, &pwptr) != 0 ||
- pwptr == NULL) {
+#ifdef HAVE_GETPWUID_R
+ if (getpwuid_r(sbuf.st_uid, &pw, buf, buflen, &pwptr) == 0 &&
+ pwptr != NULL) {
+ owner = stralloc(pwptr->pw_name);
+ } else
+#endif
+ {
owner = alloc(NUM_STR_SIZE + 1);
g_snprintf(owner, NUM_STR_SIZE, "%ld", (long)sbuf.st_uid);
- } else {
- owner = stralloc(pwptr->pw_name);
}
- if (getgrgid_r(sbuf.st_gid, &gr, buf, buflen, &grptr) != 0 ||
- grptr == NULL) {
+#ifdef HAVE_GETGRGID_R
+ if (getgrgid_r(sbuf.st_gid, &gr, buf, buflen, &grptr) == 0 &&
+ grptr != NULL) {
+ group = stralloc(grptr->gr_name);
+ } else
+#endif
+ {
group = alloc(NUM_STR_SIZE + 1);
g_snprintf(group, NUM_STR_SIZE, "%ld", (long)sbuf.st_gid);
- } else {
- group = stralloc(grptr->gr_name);
}
+
auth_debug(1, _("bsd: processing file: %s\n"), name);
auth_debug(1, _("bsd: owner=%s group=%s mode=%03o\n"),
owner, group,
}
for(res1=res; res1 != NULL; res1 = res1->ai_next) {
- if (cmp_sockaddr((struct sockaddr_storage *)res1->ai_addr, (struct sockaddr_storage *)addr, 1) == 0) {
+ if (cmp_sockaddr((sockaddr_union *)res1->ai_addr, (sockaddr_union *)addr, 1) == 0) {
freeaddrinfo(res);
amfree(canonname);
return 0;
}
dbprintf(_("%s doesn't resolve to %s"),
- hostname, str_sockaddr((struct sockaddr_storage *)addr));
+ hostname, str_sockaddr((sockaddr_union *)addr));
*errstr = newvstrallocf(*errstr,
"%s doesn't resolve to %s",
- hostname, str_sockaddr((struct sockaddr_storage *)addr));
+ hostname, str_sockaddr((sockaddr_union *)addr));
error:
if (res) freeaddrinfo(res);
amfree(canonname);
int refcnt; /* number of handles using */
int handle; /* last proto handle read */
void (*accept_fn)(security_handle_t *, pkt_t *);
- struct sockaddr_storage peer;
+ sockaddr_union peer;
TAILQ_ENTRY(tcp_conn) tq; /* queue handle */
int (*recv_security_ok)(struct sec_handle *, pkt_t *);
char * (*prefix_packet)(void *, pkt_t *);
} fn;
void * arg; /* argument to pass function */
event_handle_t * ev_timeout; /* timeout handle for recv */
- struct sockaddr_storage peer;
+ sockaddr_union peer;
int sequence;
event_id_t event_id;
char * proto_handle;
typedef struct udp_handle {
const struct security_driver *driver; /* MUST be first */
dgram_t dgram; /* datagram to read/write from */
- struct sockaddr_storage peer; /* who sent it to us */
+ sockaddr_union peer; /* who sent it to us */
pkt_t pkt; /* parsed form of dgram */
char *handle; /* handle from recvd packet */
int sequence; /* seq no of packet */
void udp_recvpkt_callback(void *);
void udp_recvpkt_timeout(void *);
int udp_inithandle(udp_handle_t *, struct sec_handle *, char *hostname,
- struct sockaddr_storage *, in_port_t, char *, int);
+ sockaddr_union *, in_port_t, char *, int);
void udp_netfd_read_callback(void *);
struct tcp_conn *sec_tcp_conn_get(const char *, int);
struct passwd *pwd,
const char *user);
char * check_user_amandahosts(const char *host,
- struct sockaddr_storage *addr,
+ sockaddr_union *addr,
struct passwd *pwd,
const char *user,
const char *service);
void
dump_sockaddr(
- struct sockaddr_storage *sa)
+ sockaddr_union *sa)
{
#ifdef WORKING_IPV6
char ipstr[INET6_ADDRSTRLEN];
#endif
int port;
- port = SS_GET_PORT(sa);
+ port = SU_GET_PORT(sa);
#ifdef WORKING_IPV6
- if (sa->ss_family == (sa_family_t)AF_INET6) {
- inet_ntop(AF_INET6, &((struct sockaddr_in6 *)sa)->sin6_addr,
- ipstr, sizeof(ipstr));
+ if (SU_GET_FAMILY(sa) == AF_INET6) {
+ inet_ntop(AF_INET6, &sa->sin6.sin6_addr, ipstr, sizeof(ipstr));
dbprintf("(sockaddr_in6 *)%p = { %d, %d, %s }\n",
sa,
- ((struct sockaddr_in6 *)sa)->sin6_family,
+ SU_GET_FAMILY(sa),
port,
ipstr);
} else
#endif
{
- inet_ntop(AF_INET, &((struct sockaddr_in *)sa)->sin_addr, ipstr,
- sizeof(ipstr));
+ inet_ntop(AF_INET, &sa->sin.sin_addr.s_addr, ipstr, sizeof(ipstr));
dbprintf("(sockaddr_in *)%p = { %d, %d, %s }\n",
sa,
- ((struct sockaddr_in *)sa)->sin_family,
+ SU_GET_FAMILY(sa),
port,
ipstr);
}
char *
str_sockaddr(
- struct sockaddr_storage *sa)
+ sockaddr_union *sa)
{
#ifdef WORKING_IPV6
char ipstr[INET6_ADDRSTRLEN];
#endif
int port;
- port = SS_GET_PORT(sa);
+ port = SU_GET_PORT(sa);
#ifdef WORKING_IPV6
- if ( sa->ss_family == (sa_family_t)AF_INET6) {
- inet_ntop(AF_INET6, &((struct sockaddr_in6 *)sa)->sin6_addr,
- ipstr, sizeof(ipstr));
+ if ( SU_GET_FAMILY(sa) == AF_INET6) {
+ inet_ntop(AF_INET6, &sa->sin6.sin6_addr, ipstr, sizeof(ipstr));
} else
#endif
{
- inet_ntop(AF_INET, &((struct sockaddr_in *)sa)->sin_addr, ipstr,
- sizeof(ipstr));
+ inet_ntop(AF_INET, &sa->sin.sin_addr.s_addr, ipstr, sizeof(ipstr));
}
g_snprintf(mystr_sockaddr,sizeof(mystr_sockaddr),"%s.%d", ipstr, port);
+ mystr_sockaddr[sizeof(mystr_sockaddr)-1] = '\0';
+
return mystr_sockaddr;
}
-int
-cmp_sockaddr(
- struct sockaddr_storage *ss1,
- struct sockaddr_storage *ss2,
- int addr_only)
+/* Unmap a V4MAPPED IPv6 address into its equivalent IPv4 address. The location
+ * TMP is used to store the rewritten address, if necessary. Returns a pointer
+ * to the unmapped address.
+ */
+#if defined(WORKING_IPV6) && defined(IN6_IS_ADDR_V4MAPPED)
+static sockaddr_union *
+unmap_v4mapped(
+ sockaddr_union *sa,
+ sockaddr_union *tmp)
{
- /* if addresses are v4mapped, "unmap" them */
-#ifdef WORKING_IPV6
-#ifdef IN6_IS_ADDR_V4MAPPED
- struct sockaddr_in ss1_v4;
- struct sockaddr_in ss2_v4;
-
- if (ss1->ss_family == AF_INET6 &&
- IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)ss1)->sin6_addr)) {
- memset(&ss1_v4, 0, sizeof(struct sockaddr_in));
- memcpy(&ss1_v4.sin_addr.s_addr,
- &(((struct sockaddr_in6 *)ss1)->sin6_addr.s6_addr[12]),
+ if (SU_GET_FAMILY(sa) == AF_INET6 && IN6_IS_ADDR_V4MAPPED(&sa->sin6.sin6_addr)) {
+ SU_INIT(tmp, AF_INET);
+ SU_SET_PORT(tmp, SU_GET_PORT(sa));
+ /* extract the v4 address from byte 12 of the v6 address */
+ memcpy(&tmp->sin.sin_addr.s_addr,
+ &sa->sin6.sin6_addr.s6_addr[12],
sizeof(struct in_addr));
- ss1_v4.sin_family = AF_INET;
- SS_SET_PORT((struct sockaddr_storage *)&ss1_v4, SS_GET_PORT(ss1));
- ss1 = (struct sockaddr_storage *)&ss1_v4;
+ return tmp;
}
- if (ss2->ss_family == AF_INET6 &&
- IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)ss2)->sin6_addr)) {
- memset(&ss2_v4, 0, sizeof(struct sockaddr_in));
- memcpy(&ss2_v4.sin_addr.s_addr,
- &(((struct sockaddr_in6 *)ss2)->sin6_addr.s6_addr[12]),
- sizeof(struct in_addr));
- ss2_v4.sin_family = AF_INET;
- SS_SET_PORT((struct sockaddr_storage *)&ss2_v4, SS_GET_PORT(ss2));
- ss2 = (struct sockaddr_storage *)&ss2_v4;
- }
-#endif
+ return sa;
+}
+#else
+/* nothing to do if no IPv6 */
+#define unmap_v4mapped(sa, tmp) ((void)tmp, sa)
#endif
- if (ss1->ss_family == ss2->ss_family) {
+int
+cmp_sockaddr(
+ sockaddr_union *ss1,
+ sockaddr_union *ss2,
+ int addr_only)
+{
+ sockaddr_union tmp1, tmp2;
+
+ /* if addresses are v4mapped, "unmap" them */
+ ss1 = unmap_v4mapped(ss1, &tmp1);
+ ss2 = unmap_v4mapped(ss2, &tmp2);
+
+ if (SU_GET_FAMILY(ss1) == SU_GET_FAMILY(ss2)) {
if (addr_only) {
#ifdef WORKING_IPV6
- if(ss1->ss_family == (sa_family_t)AF_INET6)
+ if(SU_GET_FAMILY(ss1) == AF_INET6)
return memcmp(
- &((struct sockaddr_in6 *)ss1)->sin6_addr,
- &((struct sockaddr_in6 *)ss2)->sin6_addr,
- sizeof(((struct sockaddr_in6 *)ss1)->sin6_addr));
+ &ss1->sin6.sin6_addr,
+ &ss2->sin6.sin6_addr,
+ sizeof(ss1->sin6.sin6_addr));
else
#endif
return memcmp(
- &((struct sockaddr_in *)ss1)->sin_addr,
- &((struct sockaddr_in *)ss2)->sin_addr,
- sizeof(((struct sockaddr_in *)ss1)->sin_addr));
+ &ss1->sin.sin_addr,
+ &ss2->sin.sin_addr,
+ sizeof(ss1->sin.sin_addr));
} else {
return memcmp(ss1, ss2, SS_LEN(ss1));
}
} else {
/* compare families to give a total order */
- if (ss1->ss_family < ss2->ss_family)
+ if (SU_GET_FAMILY(ss1) < SU_GET_FAMILY(ss2))
return -1;
else
return 1;
* Utility routines for handling sockaddrs
*/
-#ifndef SOCKADDR_H
-#define SOCKADDR_H
+#ifndef SOCKADDR_UTIL_H
+#define SOCKADDR_UTIL_H
#include "amanda.h"
-/* Dump a sockaddr_storage using dbprintf
+/* Dump a sockaddr_union using dbprintf
*
* @param sa: the sockaddr to dump
*/
-void dump_sockaddr(struct sockaddr_storage * sa);
+void dump_sockaddr(sockaddr_union * sa);
-/* Convert a sockaddr_storage to a string.
+/* Convert a sockaddr_union to a string.
*
* NOTE: this function is not threadsafe!
*
- * @param sa: the sockaddr_storage to dump
+ * @param sa: the sockaddr_union to dump
* @returns: pointer to statically allocated string
*/
-char * str_sockaddr(struct sockaddr_storage *sa);
+char * str_sockaddr(sockaddr_union *sa);
-/* Compare two sockaddr_storage objects, optionally comparing
+/* Compare two sockaddr_union objects, optionally comparing
* only the address (and thus ignoring port, flow info, etc.).
*
- * @param ss1: one sockaddr_storage to compare
- * @param ss2: the other sockaddr_storage to compare
+ * @param su1: one sockaddr_union to compare
+ * @param su2: the other sockaddr_union to compare
* @param addr_only: if true, ignore port, flow info, etc.
* @returns: -1, 0, or 1 for <, ==, >, respectively
*/
-int cmp_sockaddr(struct sockaddr_storage *ss1,
- struct sockaddr_storage *ss2,
+int cmp_sockaddr(sockaddr_union *su1,
+ sockaddr_union *su2,
int addr_only);
/* Copy a sockaddr object.
*/
#define copy_sockaddr(dest, src) memcpy((dest), (src), SS_LEN((src)))
-/* Calculate the length of the data in a struct sockaddr_storage.
- *
- * @param ss: the sockaddr_storage to examine
- * @returns: length of the data in the object
+/* The "best" address family we support.
*/
-/* SS_LEN(ss) */
+/* AF_NATIVE */
#ifdef WORKING_IPV6
-# define SS_LEN(ss) (((struct sockaddr *)(ss))->sa_family==AF_INET6?sizeof(struct sockaddr_in6):sizeof(struct sockaddr_in))
+#define AF_NATIVE AF_INET6
#else
-# define SS_LEN(ss) (sizeof(struct sockaddr_in))
+#define AF_NATIVE AF_INET
#endif
-/* The "best" address family we support.
+/* Get the family for a sockaddr_union.
+ *
+ * @param su: the sockaddr_union to examine
*/
-/* AF_NATIVE */
+#define SU_GET_FAMILY(su) ((su)->sa.sa_family)
+/* Calculate the length of the data in a sockaddr_union.
+ *
+ * @param su: the sockaddr_union to examine
+ * @returns: length of the data in the object
+ */
+/* SS_LEN(su) */
#ifdef WORKING_IPV6
-#define AF_NATIVE AF_INET6
+# define SS_LEN(su) (SU_GET_FAMILY(su)==AF_INET6? sizeof(struct sockaddr_in6):sizeof(struct sockaddr_in))
#else
-#define AF_NATIVE AF_INET
+# define SS_LEN(su) (sizeof(struct sockaddr_in))
#endif
-/* Initialize a sockaddr_storage to all zeroes (as directed by RFC),
- * and set its ss_family as specified
+/* Initialize a sockaddr_union to all zeroes (as directed by RFC),
+ * and set its address family as specified
*
- * @param ss: sockaddr_storage object to initialize
+ * @param su: sockaddr_union object to initialize
* @param family: an AF_* constant
*/
-/* SS_INIT(ss, family) */
-#define SS_INIT(ss, family) do { \
- memset((ss), 0, sizeof(*(ss))); \
- (ss)->ss_family = (family); \
+/* SU_INIT(su, family) */
+#define SU_INIT(su, family) do { \
+ memset((su), 0, sizeof(*(su))); \
+ (su)->sa.sa_family = (family); \
} while (0);
-/* set a sockaddr_storage to the family-appropriate equivalent of
- * INADDR_ANY -- a wildcard address and port. Call SS_INIT(ss)
+/* set a sockaddr_union to the family-appropriate equivalent of
+ * INADDR_ANY -- a wildcard address and port. Call SU_INIT(su)
* first to initialize the object and set the family.
*
- * @param ss: the sockaddr_storage to set
+ * @param su: the sockaddr_union to set
*/
-/* SS_SET_INADDR_ANY(ss) */
+/* SU_SET_INADDR_ANY(su) */
#ifdef WORKING_IPV6
-#define SS_SET_INADDR_ANY(ss) do { \
- switch ((ss)->ss_family) { \
+#define SU_SET_INADDR_ANY(su) do { \
+ switch (SU_GET_FAMILY(su)) { \
case AF_INET6: \
- ((struct sockaddr_in6 *)(ss))->sin6_flowinfo = 0; \
- ((struct sockaddr_in6 *)(ss))->sin6_addr = in6addr_any; \
+ (su)->sin6.sin6_flowinfo = 0; \
+ (su)->sin6.sin6_addr = in6addr_any; \
break; \
case AF_INET: \
- ((struct sockaddr_in *)(ss))->sin_addr.s_addr = INADDR_ANY; \
+ (su)->sin.sin_addr.s_addr = INADDR_ANY; \
break; \
} \
} while (0);
#else
-#define SS_SET_INADDR_ANY(ss) do { \
- ((struct sockaddr_in *)(ss))->sin_addr.s_addr = INADDR_ANY; \
+#define SU_SET_INADDR_ANY(su) do { \
+ (su)->sin.sin_addr.s_addr = INADDR_ANY; \
} while (0);
#endif
-/* Set the port in a sockaddr_storage that already has an family
+/* Set the port in a sockaddr_union that already has an family
*
- * @param ss: the sockaddr_storage to manipulate
- * @param port: the port to insert
+ * @param su: the sockaddr_union to manipulate
+ * @param port: the port to insert (in host byte order)
*/
-/* SS_SET_PORT(ss, port) */
+/* SU_SET_PORT(su, port) */
#ifdef WORKING_IPV6
-#define SS_SET_PORT(ss, port) \
-switch ((ss)->ss_family) { \
+#define SU_SET_PORT(su, port) \
+switch (SU_GET_FAMILY(su)) { \
case AF_INET: \
- ((struct sockaddr_in *)(ss))->sin_port = (in_port_t)htons((port)); \
+ (su)->sin.sin_port = (in_port_t)htons((port)); \
break; \
case AF_INET6: \
- ((struct sockaddr_in6 *)(ss))->sin6_port = (in_port_t)htons((port)); \
+ (su)->sin6.sin6_port = (in_port_t)htons((port)); \
break; \
default: assert(0); \
}
#else
-#define SS_SET_PORT(ss, port) \
- ((struct sockaddr_in *)(ss))->sin_port = (in_port_t)htons((port));
+#define SU_SET_PORT(su, port) \
+ (su)->sin.sin_port = (in_port_t)htons((port));
#endif
-/* Get the port in a sockaddr_storage object
+/* Get the port in a sockaddr_union object
*
- * @param ss: the sockaddr_storage to manipulate
+ * @param su: the sockaddr_union to manipulate
+ * @return: the port, in host byte horder
*/
-/* SS_GET_PORT(ss) */
+/* SU_GET_PORT(su) */
#ifdef WORKING_IPV6
-#define SS_GET_PORT(ss) (ntohs( \
- (ss)->ss_family == AF_INET6? \
- ((struct sockaddr_in6 *)(ss))->sin6_port \
- :((struct sockaddr_in *)(ss))->sin_port))
+#define SU_GET_PORT(su) (ntohs(SU_GET_FAMILY(su) == AF_INET6? (su)->sin6.sin6_port:(su)->sin.sin_port))
#else
-#define SS_GET_PORT(ss) (ntohs( \
- ((struct sockaddr_in *)(ss))->sin_port))
+#define SU_GET_PORT(su) (ntohs((su)->sin.sin_port))
#endif
-#endif /* SOCKADDR_H */
-
+#endif /* SOCKADDR_UTIL_H */
int priv)
{
int server_socket, retries;
- socklen_t len;
+ socklen_t_equiv len;
#if defined(SO_KEEPALIVE) || defined(USE_REUSEADDR)
const int on = 1;
int r;
#endif
- struct sockaddr_storage server;
+ sockaddr_union server;
int save_errno;
int *portrange;
- socklen_t socklen;
+ socklen_t_equiv socklen;
int socket_family;
*portp = USHRT_MAX; /* in case we error exit */
return -1;
}
- SS_INIT(&server, socket_family);
- SS_SET_INADDR_ANY(&server);
+ SU_INIT(&server, socket_family);
+ SU_SET_INADDR_ANY(&server);
#ifdef USE_REUSEADDR
r = setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR,
- (void *)&on, (socklen_t)sizeof(on));
+ (void *)&on, (socklen_t_equiv)sizeof(on));
if (r < 0) {
dbprintf(_("stream_server: setsockopt(SO_REUSEADDR) failed: %s\n"),
strerror(errno));
#ifdef SO_KEEPALIVE
r = setsockopt(server_socket, SOL_SOCKET, SO_KEEPALIVE,
- (void *)&on, (socklen_t)sizeof(on));
+ (void *)&on, (socklen_t_equiv)sizeof(on));
if(r == -1) {
save_errno = errno;
dbprintf(_("stream_server: setsockopt(SO_KEEPALIVE) failed: %s\n"),
}
#endif
- *portp = SS_GET_PORT(&server);
+ *portp = SU_GET_PORT(&server);
dbprintf(_("stream_server: waiting for connection: %s\n"),
str_sockaddr(&server));
return server_socket;
int nonblock,
int priv)
{
- struct sockaddr_storage svaddr, claddr;
+ sockaddr_union svaddr, claddr;
int save_errno;
char *f;
int client_socket;
for (res_addr = res; res_addr != NULL; res_addr = res_addr->ai_next) {
/* copy the first (preferred) address we found */
- copy_sockaddr(&svaddr, res_addr->ai_addr);
- SS_SET_PORT(&svaddr, port);
+ copy_sockaddr(&svaddr, (sockaddr_union *)res_addr->ai_addr);
+ SU_SET_PORT(&svaddr, port);
- SS_INIT(&claddr, svaddr.ss_family);
- SS_SET_INADDR_ANY(&claddr);
+ SU_INIT(&claddr, SU_GET_FAMILY(&svaddr));
+ SU_SET_INADDR_ANY(&claddr);
/*
* If a privileged port range was requested, we try to get a port in
try_socksize(client_socket, SO_SNDBUF, sendsize);
try_socksize(client_socket, SO_RCVBUF, recvsize);
if (localport != NULL)
- *localport = SS_GET_PORT(&claddr);
+ *localport = SU_GET_PORT(&claddr);
return client_socket;
}
}
/* don't care about these values */
-static struct sockaddr_storage addr;
-static socklen_t addrlen;
+static sockaddr_union addr;
+static socklen_t_equiv addrlen;
int
stream_accept(
} while (nfound <= 0);
while(1) {
- addrlen = (socklen_t)sizeof(struct sockaddr_storage);
+ addrlen = (socklen_t_equiv)sizeof(sockaddr_union);
connected_socket = accept(server_socket,
(struct sockaddr *)&addr,
&addrlen);
* Make certain we got an inet connection and that it is not
* from port 20 (a favorite unauthorized entry tool).
*/
- if (addr.ss_family == (sa_family_t)AF_INET
+ if (SU_GET_FAMILY(&addr) == AF_INET
#ifdef WORKING_IPV6
- || addr.ss_family == (sa_family_t)AF_INET6
+ || SU_GET_FAMILY(&addr) == AF_INET6
#endif
){
- port = SS_GET_PORT(&addr);
+ port = SU_GET_PORT(&addr);
if (port != (in_port_t)20) {
try_socksize(connected_socket, SO_SNDBUF, sendsize);
try_socksize(connected_socket, SO_RCVBUF, recvsize);
#ifdef WORKING_IPV6
dbprintf(_("family is %d instead of %d(AF_INET)"
" or %d(AF_INET6): ignored\n"),
- addr.ss_family,
+ SU_GET_FAMILY(&addr),
AF_INET, AF_INET6);
#else
dbprintf(_("family is %d instead of %d(AF_INET)"
": ignored\n"),
- addr.ss_family,
+ SU_GET_FAMILY(&addr),
AF_INET);
#endif
}
/* keep trying, get as big a buffer as possible */
while((isize > 1024) &&
(setsockopt(sock, SOL_SOCKET,
- which, (void *) &isize, (socklen_t)sizeof(isize)) < 0)) {
+ which, (void *) &isize, (socklen_t_equiv)sizeof(isize)) < 0)) {
isize -= 1024;
}
if(isize > 1024) {
-#define BUILT_REV "1023"
+#define BUILT_REV "1266"
#define BUILT_BRANCH "amanda-260"
#endif
static int make_socket(sa_family_t family);
-static int connect_port(struct sockaddr_storage *addrp, in_port_t port, char *proto,
- struct sockaddr_storage *svaddr, int nonblock);
+static int connect_port(sockaddr_union *addrp, in_port_t port, char *proto,
+ sockaddr_union *svaddr, int nonblock);
/*
* Keep calling read() until we've read buflen's worth of data, or EOF,
/* return -1 on failure */
int
connect_portrange(
- struct sockaddr_storage *addrp,
+ sockaddr_union *addrp,
in_port_t first_port,
in_port_t last_port,
char * proto,
- struct sockaddr_storage *svaddr,
+ sockaddr_union *svaddr,
int nonblock)
{
int s;
/* return >0: this is the connected socket */
int
connect_port(
- struct sockaddr_storage *addrp,
+ sockaddr_union *addrp,
in_port_t port,
char * proto,
- struct sockaddr_storage *svaddr,
+ sockaddr_union *svaddr,
int nonblock)
{
int save_errno;
struct servent * servPort;
- socklen_t len;
- socklen_t socklen;
+ socklen_t_equiv len;
+ socklen_t_equiv socklen;
int s;
servPort = getservbyport((int)htons(port), proto);
return -1;
}
- if ((s = make_socket(addrp->ss_family)) == -1) return -2;
+ if ((s = make_socket(SU_GET_FAMILY(addrp))) == -1) return -2;
- SS_SET_PORT(addrp, port);
+ SU_SET_PORT(addrp, port);
socklen = SS_LEN(addrp);
if (bind(s, (struct sockaddr *)addrp, socklen) != 0) {
save_errno = errno;
int
bind_portrange(
int s,
- struct sockaddr_storage *addrp,
+ sockaddr_union *addrp,
in_port_t first_port,
in_port_t last_port,
char * proto)
{
in_port_t port;
in_port_t cnt;
- socklen_t socklen;
+ socklen_t_equiv socklen;
struct servent *servPort;
const in_port_t num_ports = (in_port_t)(last_port - first_port + 1);
int save_errno = EAGAIN;
for (cnt = 0; cnt < num_ports; cnt++) {
servPort = getservbyport((int)htons(port), proto);
if ((servPort == NULL) || strstr(servPort->s_name, "amanda")) {
- SS_SET_PORT(addrp, port);
+ SU_SET_PORT(addrp, port);
socklen = SS_LEN(addrp);
if (bind(s, (struct sockaddr *)addrp, socklen) >= 0) {
if (servPort == NULL) {
ssize_t fullread(int, void *, size_t);
ssize_t fullwrite(int, const void *, size_t);
-int connect_portrange(struct sockaddr_storage *, in_port_t, in_port_t, char *,
- struct sockaddr_storage *, int);
-int bind_portrange(int, struct sockaddr_storage *, in_port_t, in_port_t,
+int connect_portrange(sockaddr_union *, in_port_t, in_port_t, char *,
+ sockaddr_union *, int);
+int bind_portrange(int, sockaddr_union *, in_port_t, in_port_t,
char *);
char * construct_datestamp(time_t *t);
#ifndef VERSION_H
#define VERSION_H
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
extern const int VERSION_MAJOR;
extern const int VERSION_MINOR;
extern const int VERSION_PATCH;
const int VERSION_MAJOR = 2;
const int VERSION_MINOR = 6;
const int VERSION_PATCH = 0;
-const char *const VERSION_COMMENT = "p1";
+const char *const VERSION_COMMENT = "p2";
const char *
versionsuffix(void)
{
#ifdef USE_VERSION_SUFFIXES
- return "-2.6.0p1";
+ return "-2.6.0p2";
#else
return "";
#endif
const char *
version(void)
{
- return "2.6.0p1";
+ return "2.6.0p2";
}
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
amanda/ipv6.m4 amanda/krb4-security.m4 amanda/krb5-security.m4 \
amanda/lfs.m4 amanda/libs.m4 amanda/net.m4 amanda/progs.m4 \
amanda/readdir.m4 amanda/readline.m4 amanda/rsh-security.m4 \
- amanda/s3-device.m4 amanda/shmem.m4 amanda/ssh-security.m4 \
- amanda/summary.m4 amanda/swig.m4 amanda/syshacks.m4 \
- amanda/tape.m4 amanda/types.m4 amanda/userid.m4 \
- amanda/version.m4 gettext-macros/codeset.m4 \
+ amanda/s3-device.m4 amanda/shmem.m4 amanda/socklen_t_equiv.m4 \
+ amanda/ssh-security.m4 amanda/summary.m4 amanda/swig.m4 \
+ amanda/syshacks.m4 amanda/tape.m4 amanda/types.m4 \
+ amanda/userid.m4 amanda/version.m4 gettext-macros/codeset.m4 \
gettext-macros/gettext.m4 gettext-macros/glibc21.m4 \
gettext-macros/glibc2.m4 gettext-macros/iconv.m4 \
gettext-macros/intdiv0.m4 gettext-macros/intmax.m4 \
[Location of Amanda directories and files. ])
])
+# SYNOPSIS
+#
+# AMANDA_GLIBC_BACKTRACE
+#
+# OVERVIEW
+#
+# Check for glibc's backtrace support, and define HAVE_GLIBC_BACKTRACE if it is present.
+AC_DEFUN([AMANDA_GLIBC_BACKTRACE],
+[
+ AC_CHECK_HEADER([execinfo.h], [
+ AC_CHECK_FUNC([backtrace_symbols_fd], [
+ AC_DEFINE(HAVE_GLIBC_BACKTRACE, 1,
+ [Define this if glibc's backtrace functionality (execinfo.h) is present])
+ ])
+ ])
+])
+
# SYNOPSIS
#
# AMANDA_WITH_DEBUG_DAYS
#
# DESCRIPTION
#
-# Check for the prefixes used for particular devices. If the prefixes
-# are broken on this system (Sinix and HPUX), suggest how to fix them.
-#
-# Substitutes CLIENT_SCRIPTS_OPT with the name of the script used to fix
-# broken systems.
+# Check for the prefixes used for particular devices.
#
# Defines DEV_PREFIX and RDEV_PREFIX to the appropriate prefixes.
#
EXTRA_DIST += amanda/rsh-security.m4
EXTRA_DIST += amanda/s3-device.m4
EXTRA_DIST += amanda/shmem.m4
+EXTRA_DIST += amanda/socklen_t_equiv.m4
EXTRA_DIST += amanda/ssh-security.m4
EXTRA_DIST += amanda/summary.m4
EXTRA_DIST += amanda/swig.m4
AC_REQUIRE([AMANDA_CHECK_LIBCURL])
AC_REQUIRE([AMANDA_CHECK_HMAC])
- if test "$libcurl_feature_SSL" != "yes" ||
- test "$libcurl_protocol_HTTPS" != "yes"; then
- s3_ssl=no
- else
- s3_ssl=yes
- fi
-
AC_ARG_ENABLE([s3-device],
AS_HELP_STRING([--disable-s3-device],
[disable the S3 device]),
# Now handle any setup for S3, if we want it.
if test x"$WANT_S3_DEVICE" = x"yes"; then
AC_DEFINE(WANT_S3_DEVICE, [], [Compile Amazon S3 driver])
- if test x"$s3_ssl" = x"no"; then
- AMANDA_MSG_WARN([Encryption support is not available for S3; requests will be sent in plaintext.])
- fi
fi
AC_MSG_ERROR([DevPay support requires the S3 device (--enable-s3-device)])
fi
- if test "$s3_ssl" != "yes"; then
- AC_MSG_RESULT(no)
- AC_MSG_ERROR([Cannot use devpay without HTTPS/SSL support in libcurl.])
- fi
-
AC_DEFINE([WANT_DEVPAY], [], [Compile Amazon DevPay support])
fi
AC_MSG_RESULT($WANT_DEVPAY)
--- /dev/null
+# SYNOPSIS
+#
+# AMANDA_SOCKLEN_T_EQUIV
+#
+# OVERVIEW
+#
+# Find a type which will work like socklen_t should. Unfortunately,
+# HP/UX systems define socklen_t, but use int * as the result parameter
+# for socket functions returning a socket length.
+#
+# This check defines a type socklen_t_equiv which is of the appropriate
+# size to be used with socket functions.
+#
+AC_DEFUN([AMANDA_SOCKLEN_T_EQUIV],
+[
+ ## lifted from config/gnulib/socklen.m4
+ AC_REQUIRE([gl_HEADER_SYS_SOCKET])dnl
+ AC_MSG_CHECKING([for socklen_t equivalent])
+ AC_CACHE_VAL([gl_cv_socklen_t_equiv],
+ [# Systems have either "struct sockaddr *" or
+ # "void *" as the second argument to getpeername
+ gl_cv_socklen_t_equiv=
+ for arg2 in "struct sockaddr" void; do
+ for t in socklen_t int size_t "unsigned int" "long int" "unsigned long int"; do
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>
+ #include <sys/socket.h>
+
+ int getpeername (int, $arg2 *, $t *);],
+ [$t len;
+ getpeername (0, 0, &len);],
+ [gl_cv_socklen_t_equiv="$t"])
+ test "$gl_cv_socklen_t_equiv" != "" && break
+ done
+ test "$gl_cv_socklen_t_equiv" != "" && break
+ done
+ ])
+ ## end lifting from config/gnulib/socklen.m4
+ # fallback if the check fails
+ if test "$gl_cv_socklen_t_equiv" = ""; then
+ gl_cv_socklen_t_equiv=socklen_t
+ fi
+ AC_MSG_RESULT([$gl_cv_socklen_t_equiv])
+
+ AC_DEFINE_UNQUOTED([socklen_t_equiv], [$gl_cv_socklen_t_equiv],
+ [type to use for socket length parameters; use instead of socklen_t])
+])
+
/* Define to 1 if you have the `getaddrinfo' function. */
#undef HAVE_GETADDRINFO
+/* Define to 1 if you have the `getgrgid_r' function. */
+#undef HAVE_GETGRGID_R
+
/* Define to 1 if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME
/* Define if getpeername is declared. */
#undef HAVE_GETPEERNAME_DECL
+/* Define to 1 if you have the `getpwuid_r' function. */
+#undef HAVE_GETPWUID_R
+
/* Define to 1 if you have the `getsockname' function. */
#undef HAVE_GETSOCKNAME
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
+/* Define this if glibc's backtrace functionality (execinfo.h) is present */
+#undef HAVE_GLIBC_BACKTRACE
+
/* Define to 1 if you have the <grp.h> header file. */
#undef HAVE_GRP_H
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
-/* Type for socklen_t, if it is not defined by the system */
+/* type to use in place of socklen_t if not defined */
#undef socklen_t
+/* type to use for socket length parameters; use instead of socklen_t */
+#undef socklen_t_equiv
+
/* Define as a signed type of the same size as size_t. */
#undef ssize_t
# Define the identity of the package.
PACKAGE=amanda
- VERSION="2.6.0p1"
+ VERSION="2.6.0p2"
cat >>confdefs.h <<_ACEOF
- if test "$libcurl_feature_SSL" != "yes" ||
- test "$libcurl_protocol_HTTPS" != "yes"; then
- s3_ssl=no
- else
- s3_ssl=yes
- fi
-
# Check whether --enable-s3-device was given.
if test "${enable_s3_device+set}" = set; then
enableval=$enable_s3_device; WANT_S3_DEVICE=$enableval
#define WANT_S3_DEVICE
_ACEOF
- if test x"$s3_ssl" = x"no"; then
-
- { echo "$as_me:$LINENO: WARNING: Encryption support is not available for S3; requests will be sent in plaintext." >&5
-echo "$as_me: WARNING: Encryption support is not available for S3; requests will be sent in plaintext." >&2;}
-
-
- cat <<AAW_EOF >>config.warnings
-Encryption support is not available for S3; requests will be sent in plaintext.
-AAW_EOF
-
-
- fi
fi
echo "${ECHO_T}no" >&6; }
{ { echo "$as_me:$LINENO: error: DevPay support requires the S3 device (--enable-s3-device)" >&5
echo "$as_me: error: DevPay support requires the S3 device (--enable-s3-device)" >&2;}
- { (exit 1); exit 1; }; }
- fi
-
- if test "$s3_ssl" != "yes"; then
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
- { { echo "$as_me:$LINENO: error: Cannot use devpay without HTTPS/SSL support in libcurl." >&5
-echo "$as_me: error: Cannot use devpay without HTTPS/SSL support in libcurl." >&2;}
{ (exit 1); exit 1; }; }
fi
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 32931 "configure"' > conftest.$ac_ext
+ echo '#line 32904 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:35218: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:35191: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:35222: \$? = $ac_status" >&5
+ echo "$as_me:35195: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:35480: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:35453: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:35484: \$? = $ac_status" >&5
+ echo "$as_me:35457: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:35542: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:35515: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:35546: \$? = $ac_status" >&5
+ echo "$as_me:35519: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 37771 "configure"
+#line 37744 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 37869 "configure"
+#line 37842 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:40168: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:40141: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:40172: \$? = $ac_status" >&5
+ echo "$as_me:40145: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:40230: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:40203: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:40234: \$? = $ac_status" >&5
+ echo "$as_me:40207: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 41582 "configure"
+#line 41555 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 41680 "configure"
+#line 41653 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:42565: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:42538: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:42569: \$? = $ac_status" >&5
+ echo "$as_me:42542: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:42627: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:42600: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:42631: \$? = $ac_status" >&5
+ echo "$as_me:42604: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:44774: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:44747: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:44778: \$? = $ac_status" >&5
+ echo "$as_me:44751: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:45036: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:45009: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:45040: \$? = $ac_status" >&5
+ echo "$as_me:45013: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:45098: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:45071: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:45102: \$? = $ac_status" >&5
+ echo "$as_me:45075: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 47327 "configure"
+#line 47300 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 47425 "configure"
+#line 47398 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
fi
-
- { echo "$as_me:$LINENO: checking for socklen_t" >&5
-echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; }
-if test "${ac_cv_type_socklen_t+set}" = set; then
+ ## lifted from config/gnulib/socklen.m4
+ { echo "$as_me:$LINENO: checking for socklen_t equivalent" >&5
+echo $ECHO_N "checking for socklen_t equivalent... $ECHO_C" >&6; }
+ if test "${gl_cv_socklen_t_equiv+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
+ # Systems have either "struct sockaddr *" or
+ # "void *" as the second argument to getpeername
+ gl_cv_socklen_t_equiv=
+ for arg2 in "struct sockaddr" void; do
+ for t in socklen_t int size_t "unsigned int" "long int" "unsigned long int"; do
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/socket.h>
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-#include <sys/socket.h>
-
-
-
-typedef socklen_t ac__type_new_;
+ int getpeername (int, $arg2 *, $t *);
int
main ()
{
-if ((ac__type_new_ *) 0)
- return 0;
-if (sizeof (ac__type_new_))
- return 0;
+$t len;
+ getpeername (0, 0, &len);
;
return 0;
}
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest.$ac_objext; then
- ac_cv_type_socklen_t=yes
+ gl_cv_socklen_t_equiv="$t"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_type_socklen_t=no
+
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5
-echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; }
-if test $ac_cv_type_socklen_t = yes; then
- :
-else
+ test "$gl_cv_socklen_t_equiv" != "" && break
+ done
+ test "$gl_cv_socklen_t_equiv" != "" && break
+ done
+fi
-cat >>confdefs.h <<\_ACEOF
-#define socklen_t int
-_ACEOF
+ ## end lifting from config/gnulib/socklen.m4
+ # fallback if the check fails
+ if test "$gl_cv_socklen_t_equiv" = ""; then
+ gl_cv_socklen_t_equiv=socklen_t
+ fi
+ { echo "$as_me:$LINENO: result: $gl_cv_socklen_t_equiv" >&5
+echo "${ECHO_T}$gl_cv_socklen_t_equiv" >&6; }
-fi
+cat >>confdefs.h <<_ACEOF
+#define socklen_t_equiv $gl_cv_socklen_t_equiv
+_ACEOF
fi
+ if test "${ac_cv_header_execinfo_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for execinfo.h" >&5
+echo $ECHO_N "checking for execinfo.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_execinfo_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5
+echo "${ECHO_T}$ac_cv_header_execinfo_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking execinfo.h usability" >&5
+echo $ECHO_N "checking execinfo.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <execinfo.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking execinfo.h presence" >&5
+echo $ECHO_N "checking execinfo.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <execinfo.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: execinfo.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: execinfo.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: execinfo.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: execinfo.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: execinfo.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: execinfo.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: execinfo.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: execinfo.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: execinfo.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: execinfo.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: execinfo.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: execinfo.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: execinfo.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: execinfo.h: in the future, the compiler will take precedence" >&2;}
+
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for execinfo.h" >&5
+echo $ECHO_N "checking for execinfo.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_execinfo_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_execinfo_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_execinfo_h" >&5
+echo "${ECHO_T}$ac_cv_header_execinfo_h" >&6; }
+
+fi
+if test $ac_cv_header_execinfo_h = yes; then
+
+ { echo "$as_me:$LINENO: checking for backtrace_symbols_fd" >&5
+echo $ECHO_N "checking for backtrace_symbols_fd... $ECHO_C" >&6; }
+if test "${ac_cv_func_backtrace_symbols_fd+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define backtrace_symbols_fd to an innocuous variant, in case <limits.h> declares backtrace_symbols_fd.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define backtrace_symbols_fd innocuous_backtrace_symbols_fd
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char backtrace_symbols_fd (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef backtrace_symbols_fd
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char backtrace_symbols_fd ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_backtrace_symbols_fd || defined __stub___backtrace_symbols_fd
+choke me
+#endif
+
+int
+main ()
+{
+return backtrace_symbols_fd ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_func_backtrace_symbols_fd=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_backtrace_symbols_fd=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_backtrace_symbols_fd" >&5
+echo "${ECHO_T}$ac_cv_func_backtrace_symbols_fd" >&6; }
+if test $ac_cv_func_backtrace_symbols_fd = yes; then
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_GLIBC_BACKTRACE 1
+_ACEOF
+
+
+fi
+
+
+fi
+
+
+
+
#
# Declarations
#
fi
+for ac_func in getgrgid_r
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+for ac_func in getpwuid_r
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
ice_have_gethostname=no
for ac_func in gethostname
PACKAGE=amanda
AC_SUBST(PACKAGE)
-AM_INIT_AUTOMAKE(amanda, "2.6.0p1")
+AM_INIT_AUTOMAKE(amanda, "2.6.0p2")
AC_CONFIG_HEADERS([config/config.h])
dnl Minimum Autoconf version required.
AC_TYPE_UID_T
AC_TYPE_SIGNAL
AC_STRUCT_TM
-AMANDA_CHECK_TYPE(socklen_t, int, sys/socket.h)
+AMANDA_SOCKLEN_T_EQUIV
AMANDA_CHECK_TYPE(sa_family_t, unsigned short, sys/socket.h)
AMANDA_CHECK_TYPE(in_port_t, unsigned short, netinet/in.h)
CF_WAIT
AMANDA_CHECK_GLIB
AMANDA_CHECK_READLINE
AC_CHECK_LIB(m,modf)
+AMANDA_GLIBC_BACKTRACE
#
# Declarations
ICE_CHECK_DECL(fread,stdio.h stdlib.h)
ICE_CHECK_DECL(fseek,stdio.h)
ICE_CHECK_DECL(fwrite,stdio.h stdlib.h)
+AC_CHECK_FUNCS(getgrgid_r)
+AC_CHECK_FUNCS(getpwuid_r)
ICE_CHECK_DECL(gethostname,unistd.h)
ICE_CHECK_DECL(getopt,stdlib.h unistd.h libc.h)
ICE_CHECK_DECL(getpeername,sys/types.h sys/socket.h)
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
default_device_start (Device * self, DeviceAccessMode mode, char * label,
char * timestamp) {
if (mode != ACCESS_WRITE && self->volume_label == NULL) {
+ g_debug("default_device_start calling device_read_label with mode %d", mode);
if (device_read_label(self) != READ_LABEL_STATUS_SUCCESS)
return FALSE;
} else if (mode == ACCESS_WRITE) {
static gboolean
default_device_read_to_fd(Device *self, int fd) {
- return do_consumer_producer_queue(device_read_producer,
- self,
- fd_write_consumer,
- GINT_TO_POINTER(fd));
+ GValue val;
+ StreamingRequirement streaming_mode;
+
+ /* Get the device's parameters */
+ bzero(&val, sizeof(val));
+ if (!device_property_get(self, PROPERTY_STREAMING, &val)
+ || !G_VALUE_HOLDS(&val, STREAMING_REQUIREMENT_TYPE)) {
+ streaming_mode = STREAMING_REQUIREMENT_REQUIRED;
+ } else {
+ streaming_mode = g_value_get_enum(&val);
+ }
+
+ return QUEUE_SUCCESS ==
+ do_consumer_producer_queue_full(
+ device_read_producer,
+ self,
+ fd_write_consumer,
+ GINT_TO_POINTER(fd),
+ device_read_max_size(self),
+ DEFAULT_MAX_BUFFER_MEMORY,
+ streaming_mode);
}
static gboolean
default_device_write_from_fd(Device *self, int fd) {
- return do_consumer_producer_queue(fd_read_producer,
- GINT_TO_POINTER(fd),
- device_write_consumer,
- self);
+ GValue val;
+ StreamingRequirement streaming_mode;
+
+ /* Get the device's parameters */
+ bzero(&val, sizeof(val));
+ if (!device_property_get(self, PROPERTY_STREAMING, &val)
+ || !G_VALUE_HOLDS(&val, STREAMING_REQUIREMENT_TYPE)) {
+ streaming_mode = STREAMING_REQUIREMENT_REQUIRED;
+ } else {
+ streaming_mode = g_value_get_enum(&val);
+ }
+
+ return QUEUE_SUCCESS ==
+ do_consumer_producer_queue_full(
+ fd_read_producer,
+ GINT_TO_POINTER(fd),
+ device_write_consumer,
+ self,
+ device_write_max_size(self),
+ DEFAULT_MAX_BUFFER_MEMORY,
+ streaming_mode);
}
/* XXX WARNING XXX
ReadLabelStatusFlags device_read_label(Device * self) {
DeviceClass * klass;
+ g_debug("device_read_label; mode = %d", self->access_mode);
g_return_val_if_fail(self != NULL, FALSE);
g_return_val_if_fail(IS_DEVICE(self), FALSE);
g_return_val_if_fail(self->access_mode == ACCESS_NULL, FALSE);
{
DeviceClass *klass;
+ g_debug("device_start mode = %d", mode);
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (IS_DEVICE (self), FALSE);
g_return_val_if_fail (mode != ACCESS_NULL, FALSE);
rv = (*klass->start)(self, mode, label, timestamp);
amfree(local_timestamp);
+ g_debug("device_start done; dev->access_mode = %d, result %d", self->access_mode, rv);
return rv;
} else {
return FALSE;
gboolean (* finish_file) (Device * self);
dumpfile_t* (* seek_file) (Device * self, guint file);
gboolean (* seek_block) (Device * self, guint64 block);
- gboolean (* read_block) (Device * self, gpointer buf, int * size);
+ int (* read_block) (Device * self, gpointer buf, int * size);
gboolean (* read_to_fd) (Device * self, int fd);
gboolean (* property_get) (Device * self, DevicePropertyId id,
GValue * val);
int device_write_consumer(gpointer devicep, queue_buffer_t *buffer) {
Device* device;
unsigned int write_size;
+ static gboolean wrote_blocksize = FALSE;
device = (Device*) devicep;
g_assert(IS_DEVICE(device));
write_size = MIN(buffer->data_size,
device_write_max_size(device));
+ if (!wrote_blocksize) {
+ wrote_blocksize = TRUE;
+ dbprintf("USING BLOCKSIZE %d bytes\n", write_size);
+ }
+
if (device_write_block(device, write_size,
buffer->data + buffer->offset,
buffer->data_size <
#include "rait-device.h"
#include <amanda.h>
#include "property.h"
-#include <util.h>
+#include "util.h"
typedef enum {
RAIT_STATUS_COMPLETE, /* All subdevices OK. */
g_object_class->finalize = rait_device_finalize;
+ /* Versions of glib before 2.10.2 crash if
+ * g_thread_pool_set_max_unused_threads is called before the first
+ * invocation of g_thread_pool_new. So we make up a thread pool, but don't
+ * start any threads in it, and free it */
+
+#if !GLIB_CHECK_VERSION(2,10,2)
+ {
+ GThreadPool *pool = g_thread_pool_new((GFunc)-1, NULL, -1, FALSE, NULL);
+ g_thread_pool_free(pool, TRUE, FALSE);
+ }
+#endif
+
g_thread_pool_set_max_unused_threads(-1);
}
}
static void property_hash_union(GHashTable * properties,
- DeviceProperty * prop) {
+ const DeviceProperty * prop) {
PropertyAccessFlags before, after;
gpointer tmp;
gboolean found;
device_property_list = device_property_get_list(child);
for (i = 0; device_property_list[i].base != NULL; i ++) {
- property_hash_union(properties, (gpointer)&(device_property_list[i]));
+ property_hash_union(properties, &(device_property_list[i]));
}
}
return TRUE;
}
+/* Calls extractor on each element of the array, and returns
+ TRUE if at least one of the calls to extractor return TRUE.
+*/
+static gboolean g_ptr_array_or(GPtrArray * array,
+ BooleanExtractor extractor) {
+ guint i;
+ if (array == NULL || array->len <= 0)
+ return FALSE;
+
+ for (i = 0; i < array->len; i ++) {
+ if (extractor(g_ptr_array_index(array, i)))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
/* Takes a RaitDevice, and makes a GPtrArray of GenericOp. */
static GPtrArray * make_generic_boolean_op_array(RaitDevice* self) {
GPtrArray * rval;
occured. */
static gboolean g_ptr_array_union_robust(RaitDevice * self, GPtrArray * ops,
BooleanExtractor extractor) {
- gboolean success;
- gpointer isolated_op = NULL;
+ int nfailed;
+ guint i;
- for (;;) {
- success = g_ptr_array_and(ops, extractor);
-
- if (success || self->private->status != RAIT_STATUS_COMPLETE) {
- break;
- } else {
- guint i;
- /* First device failure, note the device and march on. */
- self->private->status = RAIT_STATUS_DEGRADED;
- for (i = 0; i < ops->len; i ++) {
- GenericOp * op = g_ptr_array_index(ops, i);
- if (!(op->result)) {
- isolated_op = g_ptr_array_remove_index_fast(ops, i);
- self->private->failed = op->child_index;
- g_fprintf(stderr, "RAIT array %s Isolated device %s.\n",
- DEVICE(self)->device_name,
- op->child->device_name);
- break;
- }
- }
- }
+ /* We found one or more failed elements. See which elements failed, and
+ * isolate them*/
+ nfailed = 0;
+ for (i = 0; i < ops->len; i ++) {
+ GenericOp * op = g_ptr_array_index(ops, i);
+ if (!extractor(op)) {
+ self->private->failed = op->child_index;
+ g_fprintf(stderr, "RAIT array %s isolated device %s\n",
+ DEVICE(self)->device_name,
+ op->child->device_name);
+ nfailed++;
+ }
}
- /* Return isolated op so any data members can be freed. */
- if (isolated_op != NULL) {
- g_ptr_array_add(ops, isolated_op);
+ /* no failures? great! */
+ if (nfailed == 0)
+ return TRUE;
+
+ /* a single failure in COMPLETE just puts us in DEGRADED mode */
+ if (self->private->status == RAIT_STATUS_COMPLETE && nfailed == 1) {
+ self->private->status = RAIT_STATUS_DEGRADED;
+ g_fprintf(stderr, "RAIT array %s DEGRADED\n", DEVICE(self)->device_name);
+ return TRUE;
+ } else {
+ self->private->status = RAIT_STATUS_FAILED;
+ g_fprintf(stderr, "RAIT array %s FAILED\n", DEVICE(self)->device_name);
+ return FALSE;
}
- return success;
}
typedef struct {
/* Returns TRUE if and only if the volume label and time are equal. */
static gboolean compare_volume_results(Device * a, Device * b) {
- if (a->volume_time != b->volume_time)
- return FALSE;
- if (a->volume_label == NULL && b->volume_label == NULL)
- return TRUE;
- if (a->volume_label == NULL || b->volume_label == NULL)
- return FALSE;
- return 0 == strcmp(a->volume_label, b->volume_label);
+ return (0 == compare_possibly_null_strings(a->volume_time, b->volume_time)
+ && 0 == compare_possibly_null_strings(a->volume_label, b->volume_label));
}
static gboolean
guint i;
gboolean success;
RaitDevice * self;
+ char * label_from_device = NULL;
self = RAIT_DEVICE(dself);
g_return_val_if_fail(self != NULL, FALSE);
+ amfree(dself->volume_label);
+ amfree(dself->volume_time);
+
ops = g_ptr_array_sized_new(self->private->children->len);
for (i = 0; i < self->private->children->len; i ++) {
StartOp * op;
success = g_ptr_array_and(ops, extract_boolean_generic_op);
+ /* check that all of the volume labels agree */
+ if (success) {
+ for (i = 0; i < self->private->children->len; i ++) {
+ Device *child = g_ptr_array_index(self->private->children, i);
+
+ if (child->volume_label != NULL && child->volume_time != NULL) {
+ if (dself->volume_label != NULL && dself->volume_time != NULL) {
+ if (strcmp(child->volume_label, dself->volume_label) != 0 ||
+ strcmp(child->volume_time, dself->volume_time) != 0) {
+ /* Mismatch! (Two devices provided different labels) */
+ g_fprintf(stderr, "%s: Label (%s/%s) is different "
+ "from label (%s/%s) found at "
+ "device %s",
+ child->device_name,
+ child->volume_label,
+ child->volume_time,
+ dself->volume_label,
+ dself->volume_time,
+ label_from_device);
+ success = FALSE;
+ }
+ } else {
+ /* First device with a volume. */
+ dself->volume_label = g_strdup(child->volume_label);
+ dself->volume_time = g_strdup(child->volume_time);
+ label_from_device = g_strdup(child->device_name);
+ }
+ } else {
+ /* Device problem, it says it succeeded but sets no label? */
+ g_fprintf(stderr, "%s: %s",
+ child->device_name,
+ "Says label read, but device->volume_label "
+ " is NULL.");
+ success = FALSE;
+ }
+ }
+ }
+
+ amfree(label_from_device);
g_ptr_array_free_full(ops);
if (!success) {
typedef struct {
GenericOp base;
const dumpfile_t * info; /* IN */
+ int fileno;
} StartFileOp;
/* a GFunc */
StartFileOp * op = data;
op->base.result = GINT_TO_POINTER(device_start_file(op->base.child,
op->info));
+ op->fileno = op->base.child->file;
+ if (op->fileno < 1) {
+ op->base.result = FALSE;
+ }
}
static gboolean
guint i;
gboolean success;
RaitDevice * self;
+ int actual_file = -1;
self = RAIT_DEVICE(dself);
g_return_val_if_fail(self != NULL, FALSE);
do_rait_child_ops(start_file_do_op, ops, NULL);
success = g_ptr_array_and(ops, extract_boolean_generic_op);
+
+ for (i = 0; i < self->private->children->len && success; i ++) {
+ StartFileOp * op = g_ptr_array_index(ops, i);
+ if (!op->base.result)
+ continue;
+ g_assert(op->fileno >= 1);
+ if (actual_file < 1) {
+ actual_file = op->fileno;
+ }
+ if (actual_file != op->fileno) {
+ /* File number mismatch! Aah, my hair is on fire! */
+ g_fprintf(stderr, "File number mismatch in "
+ "rait_device_start_file(): "
+ "Child %s reported file number "
+ "%d, another child reported "
+ "file number %d.",
+ op->base.child->device_name,
+ op->fileno, actual_file);
+ success = FALSE;
+ op->base.result = FALSE;
+ }
+ }
g_ptr_array_free_full(ops);
+ g_assert(actual_file >= 1);
+ dself->file = actual_file - 1; /* chain-up, below, will re-increment this */
+ dself->in_file = TRUE;
+
if (!success) {
+ g_fprintf(stderr, _("One or more devices failed to start_file"));
return FALSE;
} else if (parent_class->start_file) {
return parent_class->start_file(dself, info);
g_ptr_array_add(ops, op);
}
- if (last_block) {
- amfree(data);
- }
-
do_rait_child_ops(write_block_do_op, ops, NULL);
success = g_ptr_array_and(ops, extract_boolean_generic_op);
free(op->data);
}
+ if (last_block) {
+ amfree(data);
+ }
+
g_ptr_array_free_full(ops);
if (!success) {
+ /* TODO be more specific here */
+ /* TODO: handle EOF here -- if one or more (or two or more??)
+ * children have is_eof* set, then reflect that in our error
+ * status, and finish_file all of the non-EOF children. What's
+ * more fun is when one device fails and must be isolated at
+ * the same time another hits EOF. */
+ g_fprintf(stderr, "One or more devices failed to write_block");
return FALSE;
} else {
/* We don't chain up here because we must handle finish_file
return op->base.child->is_eof;
}
+/* Counts the number of elements in an array matching a given proposition. */
static int g_ptr_array_count(GPtrArray * array, BooleanExtractor filter) {
int rval;
unsigned int i;
}
static gboolean raid_block_reconstruction(RaitDevice * self, GPtrArray * ops,
- gpointer buf) {
+ gpointer buf, size_t bufsize) {
guint num_children, data_children;
int blocksize, child_blocksize;
guint i;
if ((int)(op->base.child_index) == parity_child) {
parity_block = op->buffer;
} else {
+ g_assert(child_blocksize * (op->base.child_index+1) <= bufsize);
memcpy((char *)buf + child_blocksize * op->base.child_index, op->buffer,
child_blocksize);
}
amfree(constructed_parity);
} else { /* do nothing. */ }
} else if (self->private->status == RAIT_STATUS_DEGRADED) {
+ g_assert(self->private->failed >= 0 && self->private->failed < (int)num_children);
/* We are in degraded mode. What's missing? */
if (self->private->failed == parity_child) {
/* do nothing. */
gboolean success;
guint num_children, data_children;
int blocksize;
+ gsize child_blocksize;
RaitDevice * self = RAIT_DEVICE(dself);
g_return_val_if_fail(self != NULL, -1);
find_simple_params(self, &num_children, &data_children,
&blocksize);
+ /* tell caller they haven't given us a big enough buffer */
+ if (blocksize < *size) {
+ *size = blocksize;
+ return 0;
+ }
+
g_return_val_if_fail(*size >= (int)device_write_min_size(dself), -1);
- g_assert(blocksize % data_children == 0); /* If not we are screwed */
+ g_assert(blocksize % data_children == 0); /* If not we are screwed */
+ child_blocksize = blocksize / data_children;
ops = g_ptr_array_sized_new(num_children);
for (i = 0; i < num_children; i ++) {
op = malloc(sizeof(*op));
op->base.child = g_ptr_array_index(self->private->children, i);
op->base.child_index = i;
- op->buffer = malloc(blocksize / data_children);
+ op->buffer = malloc(child_blocksize);
op->desired_read_size = op->read_size = blocksize / data_children;
g_ptr_array_add(ops, op);
}
do_rait_child_ops(read_block_do_op, ops, NULL);
if (g_ptr_array_count(ops, extract_boolean_read_block_op_data)) {
- success =
- g_ptr_array_union_robust(RAIT_DEVICE(self),
+ if (!g_ptr_array_union_robust(RAIT_DEVICE(self),
ops,
- extract_boolean_read_block_op_data) &&
- raid_block_reconstruction(RAIT_DEVICE(self),
- ops, buf);
+ extract_boolean_read_block_op_data)) {
+ success = FALSE;
+ } else {
+ success = raid_block_reconstruction(RAIT_DEVICE(self),
+ ops, buf, (size_t)*size);
+ }
} else {
success = FALSE;
if (g_ptr_array_union_robust(RAIT_DEVICE(self),
extract_boolean_read_block_op_eof)) {
/* We hit EOF. */
dself->is_eof = TRUE;
- }
+ dself->in_file = FALSE;
+ } else {
+ g_fprintf(stderr, _("All child devices failed to read, but not all are at eof"));
+ }
}
for (i = 0; i < ops->len; i ++) {
if (success) {
if (parent_class->read_block)
parent_class->read_block(dself, buf, size);
+ *size = blocksize;
return blocksize;
} else {
return -1;
!g_value_compare(&result, &(op->value))) {
success = FALSE;
}
- g_value_unset(&(op->value));
+ /* free the GValue if the child call succeeded */
+ if (GPOINTER_TO_INT(op->base.result))
+ g_value_unset(&(op->value));
}
if (success) {
self = RAIT_DEVICE(d_self);
g_return_val_if_fail(self != NULL, FALSE);
+ /* it doesn't make sense to hand these properties down to our child devices,
+ * so we'll just pretend we set them. This is a 2.6.0 hack -- the device gets
+ * this right in 2.6.1. */
+ if (id == PROPERTY_BLOCK_SIZE
+ || id == PROPERTY_MIN_BLOCK_SIZE
+ || id == PROPERTY_MAX_BLOCK_SIZE) {
+ return TRUE; /* lies! */
+ }
+
ops = make_property_op_array(self, id, val);
do_rait_child_ops(property_set_do_op, ops, NULL);
success = g_ptr_array_union_robust(self, ops, extract_boolean_generic_op);
- label_changed =
- g_ptr_array_union_robust(self, ops,
- extract_label_changed_property_op);
+ label_changed = g_ptr_array_or(ops, extract_label_changed_property_op);
g_ptr_array_free_full(ops);
if (label_changed) {
s3_device_seek_block(Device *pself,
guint64 block);
-static gboolean
+static int
s3_device_read_block(Device * pself,
gpointer data,
int *size_req);
/* if it's an expected error (not found), just return -1 */
if (response_code == 404 && s3_error_code == S3_ERROR_NoSuchKey) {
pself->is_eof = TRUE;
+ pself->in_file = FALSE;
return -1;
}
* (*excluding* null terminator) */
#define S3_MAX_KEY_LENGTH 1024
-#if defined(LIBCURL_FEATURE_SSL) && defined(LIBCURL_PROTOCOL_HTTPS)
-# define S3_URL "https://s3.amazonaws.com"
-#else
-# define S3_URL "http://s3.amazonaws.com"
-#endif
-
#define AMAZON_SECURITY_HEADER "x-amz-security-token"
/* parameters for exponential backoff in the face of retriable errors */
static const char *
s3_error_name_from_code(s3_error_code_t s3_error_code);
+/* Does this install of curl support SSL?
+ *
+ * @returns: boolean
+ */
+static gboolean
+s3_curl_supports_ssl(void);
+
/*
* result handling */
}
/* }}} */
+/* {{{ s3_curl_supports_ssl */
+static gboolean
+s3_curl_supports_ssl(void)
+{
+ static int supported = -1;
+
+ if (supported == -1) {
+#if defined(CURL_VERSION_SSL)
+ curl_version_info_data *info = curl_version_info(CURLVERSION_NOW);
+ if (info->features & CURL_VERSION_SSL)
+ supported = 1;
+ else
+ supported = 0;
+#else
+ supported = 0;
+#endif
+ }
+
+ return supported;
+}
+/* }}} */
+
/* {{{ lookup_result */
static s3_result_t
lookup_result(const result_handling_t *result_handling,
guint preallocate_response_size,
const result_handling_t *result_handling)
{
+ const char *baseurl;
char *url = NULL;
s3_result_t result = S3_RESULT_FAIL; /* assume the worst.. */
CURLcode curl_code = CURLE_OK;
s3_reset(hdl);
- url = g_strconcat(S3_URL, uri, NULL);
+ baseurl = s3_curl_supports_ssl()? "https://s3.amazonaws.com":"http://s3.amazonaws.com";
+ url = g_strconcat(baseurl, uri, NULL);
if (!url) goto cleanup;
if (preallocate_response_size) {
return FALSE;
}
-TapeCheckResult tape_is_tape_device(int fd) {
+ReadLabelStatusFlags tape_is_tape_device(int fd) {
/* AIX doesn't have a no-op. */
- return TAPE_CHECK_UNKNOWN;
+ return READ_LABEL_STATUS_SUCCESS;
}
TapeCheckResult tape_is_ready(int fd) {
static ReadLabelStatusFlags tape_device_read_label(Device * self);
static gboolean tape_device_write_block(Device * self, guint size,
gpointer data, gboolean short_block);
-static gboolean tape_device_read_block(Device * self, gpointer buf,
+static int tape_device_read_block(Device * self, gpointer buf,
int * size_req);
static gboolean tape_device_start (Device * self, DeviceAccessMode mode,
char * label, char * timestamp);
register_device(tape_device_factory, device_prefix_list);
}
-#ifdef O_NONBLOCK
/* Open the tape device, trying various combinations of O_RDWR and
- O_NONBLOCK. */
-static int try_open_tape_device(TapeDevice * self, char * device_name) {
- int rval;
- rval = robust_open(device_name, O_RDWR | O_NONBLOCK, 0);
- if (rval < 0 && (errno == EWOULDBLOCK || errno == EINVAL)) {
+ O_NONBLOCK. Returns -1 and sets status_result for errors */
+static int try_open_tape_device(TapeDevice * self, char * device_filename,
+ ReadLabelStatusFlags *status_result) {
+ int fd;
+ int save_errno;
+ ReadLabelStatusFlags new_status;
+ TapeCheckResult tcr;
+ *status_result = READ_LABEL_STATUS_SUCCESS;
+
+#ifdef O_NONBLOCK
+ fd = robust_open(device_filename, O_RDWR | O_NONBLOCK, 0);
+ save_errno = errno;
+ if (fd < 0 && (save_errno == EWOULDBLOCK || save_errno == EINVAL)) {
/* Maybe we don't support O_NONBLOCK for tape devices. */
- rval = robust_open(device_name, O_RDWR, 0);
+ fd = robust_open(device_filename, O_RDWR, 0);
+ save_errno = errno;
}
- if (rval >= 0) {
+#else
+ fd = robust_open(device_filename, O_RDWR);
+ save_errno = errno;
+#endif
+ if (fd >= 0) {
self->write_open_errno = 0;
} else {
if (errno == EACCES || errno == EPERM) {
/* Device is write-protected. */
self->write_open_errno = errno;
- rval = robust_open(device_name, O_RDONLY | O_NONBLOCK, 0);
- if (rval < 0 && (errno == EWOULDBLOCK || errno == EINVAL)) {
- rval = robust_open(device_name, O_RDONLY, 0);
+#ifdef O_NONBLOCK
+ fd = robust_open(device_filename, O_RDONLY | O_NONBLOCK, 0);
+ save_errno = errno;
+ if (fd < 0 && (save_errno == EWOULDBLOCK || save_errno == EINVAL)) {
+ fd = robust_open(device_filename, O_RDONLY, 0);
+ save_errno = errno;
}
+#else
+ fd = robust_open(device_filename, O_RDONLY);
+ save_errno = errno;
+#endif
}
}
+#ifdef O_NONBLOCK
/* Clear O_NONBLOCK for operations from now on. */
- fcntl(rval, F_SETFL, fcntl(rval, F_GETFL, 0) & ~O_NONBLOCK);
- return rval;
-}
-#else /* !defined(O_NONBLOCK) */
-static int try_open_tape_device(TapeDevice * self, char * device_name) {
- int rval;
- rval = robust_open(device_name, O_RDWR);
- if (rval >= 0) {
- self->write_open_errno = 0;
- } else {
- if (errno == EACCES || errno == EPERM) {
- /* Device is write-protected. */
- self->write_open_errno = errno;
- rval = robust_open(device_name, O_RDONLY);
- }
+ if (fd >= 0)
+ fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) & ~O_NONBLOCK);
+ errno = save_errno;
+ /* function continues after #endif */
+
+#endif /* O_NONBLOCK */
+
+ if (fd < 0) {
+ g_fprintf(stderr, _("Can't open tape device %s: %s\n"),
+ DEVICE(self)->device_name, strerror(errno));
+ *status_result = READ_LABEL_STATUS_DEVICE_ERROR;
+ return -1;
+ }
+
+ /* Check that this is actually a tape device. */
+ new_status = tape_is_tape_device(fd);
+ if (new_status & (READ_LABEL_STATUS_DEVICE_ERROR | READ_LABEL_STATUS_VOLUME_MISSING)) {
+ g_fprintf(stderr, _("File %s is not a tape device\n"),
+ DEVICE(self)->device_name);
+ robust_close(fd);
+ *status_result = new_status;
+ return -1;
}
- return rval;
+
+ tcr = tape_is_ready(fd);
+ if (new_status == TAPE_CHECK_FAILURE) {
+ g_fprintf(stderr, _("Tape device %s is not ready or is empty\n"),
+ DEVICE(self)->device_name);
+ robust_close(fd);
+ *status_result = READ_LABEL_STATUS_DEVICE_ERROR;
+ return -1;
+ }
+
+ return fd;
}
-#endif /* O_NONBLOCK */
static gboolean
tape_device_open_device (Device * d_self, char * device_name) {
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (device_name != NULL, FALSE);
- self->fd = try_open_tape_device(self, device_name);
-
- if (self->fd < 0) {
- g_fprintf(stderr, "Can't open tape device %s: %s\n",
- device_name, strerror(errno));
- return FALSE;
- }
-
- /* Check that this is actually a tape device. */
- if (tape_is_tape_device(self->fd) == TAPE_CHECK_FAILURE) {
- g_fprintf(stderr, "File %s is not a tape device.\n",
- device_name);
- robust_close(self->fd);
- return FALSE;
- }
-
- if (tape_is_ready(self->fd) == TAPE_CHECK_FAILURE) {
- g_fprintf(stderr,
- "Tape device %s is not ready or is empty.\n",
- device_name);
- robust_close(self->fd);
- return FALSE;
- }
-
- /* Rewind it. */
- if (!tape_rewind(self->fd)) {
- g_fprintf(stderr, "Error rewinding device %s\n",
- device_name);
- robust_close(self->fd);
- return FALSE;
- }
-
/* Get tape drive/OS info */
tape_device_discover_capabilities(self);
self = TAPE_DEVICE(dself);
g_return_val_if_fail(self != NULL, FALSE);
+ amfree(dself->volume_label);
+ amfree(dself->volume_time);
+
+ if (self->fd == -1) {
+ ReadLabelStatusFlags status;
+ self->fd = try_open_tape_device(self, dself->device_name, &status);
+ if (self->fd == -1)
+ return status;
+ }
+
+ /* Rewind it. */
if (!tape_rewind(self->fd)) {
g_fprintf(stderr, "Error rewinding device %s\n",
dself->device_name);
}
case RESULT_NO_DATA:
pself->is_eof = TRUE;
- /* FALLTHROUGH */
+ pself->in_file = FALSE;
+ return -1;
+
default:
return -1;
}
self = TAPE_DEVICE(d_self);
g_return_val_if_fail(self != NULL, FALSE);
-
+
+ if (self->fd == -1) {
+ ReadLabelStatusFlags status;
+ self->fd = try_open_tape_device(self, d_self->device_name, &status);
+ if (self->fd == -1)
+ return FALSE; /* can't do anything with status here */
+ }
+
+ if (mode != ACCESS_WRITE && d_self->volume_label == NULL) {
+ /* we need a labeled volume for APPEND and READ */
+ if (tape_device_read_label(d_self) != READ_LABEL_STATUS_SUCCESS)
+ return FALSE;
+ }
+
+ d_self->access_mode = mode;
+ d_self->in_file = FALSE;
+
if (IS_WRITABLE_ACCESS_MODE(mode)) {
if (self->write_open_errno != 0) {
/* We tried and failed to open the device in write mode. */
TAPE_CHECK_UNKNOWN,
TAPE_CHECK_FAILURE
} TapeCheckResult;
-TapeCheckResult tape_is_tape_device(int fd);
+ReadLabelStatusFlags tape_is_tape_device(int fd);
TapeCheckResult tape_is_ready(int fd);
/* Also implemented in above files. Sets properties on the device. */
#endif
}
-TapeCheckResult tape_is_tape_device(int fd) {
+ReadLabelStatusFlags tape_is_tape_device(int fd) {
struct mtop mt;
mt.mt_op = MTNOP;
mt.mt_count = 1;
if (0 == ioctl(fd, MTIOCTOP, &mt)) {
- return TAPE_CHECK_SUCCESS;
+ return READ_LABEL_STATUS_SUCCESS;
} else {
dbprintf("tape_is_tape_device: ioctl(MTIOCTOP/MTNOP) failed: %s",
strerror(errno));
- return TAPE_CHECK_FAILURE;
+ if (errno == EIO) {
+ /* some devices return EIO while the drive is busy loading */
+ return READ_LABEL_STATUS_DEVICE_ERROR|READ_LABEL_STATUS_VOLUME_MISSING;
+ } else {
+ return READ_LABEL_STATUS_DEVICE_ERROR;
+ }
}
}
return 0 == ioctl(fd, T_SETCOMP, cmd);
}
-TapeCheckResult tape_is_tape_device(int fd) {
+ReadLabelStatusFlags tape_is_tape_device(int fd) {
/* If we can read block information, it's probably a tape device. */
struct blklen result;
if (0 == ioctl(fd, T_RDBLKLEN, &result)) {
- return TAPE_CHECK_SUCCESS;
+ return READ_LABEL_STATUS_SUCCESS;
} else {
- return TAPE_CHECK_FAILURE;
+ dbprintf("tape_is_tape_device: ioctl(MTIOCTOP/MTNOP) failed: %s",
+ strerror(errno));
+ return READ_LABEL_STATUS_DEVICE_ERROR;
}
}
return FALSE;
}
-TapeCheckResult tape_is_tape_device(int fd) {
+ReadLabelStatusFlags tape_is_tape_device(int fd) {
struct tape_info result;
if (0 == ioctl(fd, MT_STATUS, &result)) {
- return TAPE_CHECK_SUCCESS;
+ return READ_LABEL_STATUS_SUCCESS;
} else {
- return TAPE_CHECK_FAILURE;
+ dbprintf("tape_is_tape_device: ioctl(MTIOCTOP/MTNOP) failed: %s",
+ strerror(errno));
+ return READ_LABEL_STATUS_DEVICE_ERROR;
}
}
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
#include "semaphore.h"
#include "amanda.h"
+#include "util.h"
/*
* test that decrement waits properly
test_decr_wait(void)
{
GThread *th;
- struct test_decr_wait_data data = {
- semaphore_new_with_value(10),
- FALSE
- };
+ struct test_decr_wait_data data = { NULL, FALSE };
int rv;
+ data.sem = semaphore_new_with_value(10),
+
/* die after 10 seconds (default signal disposition is to fail) */
alarm(10);
gboolean pass = TRUE;
#if defined(G_THREADS_ENABLED) && !defined(G_THREADS_IMPL_NONE)
- amanda_thread_init(NULL);
+ amanda_thread_init();
pass = test_decr_wait() && pass;
pass = test_wait_empty() && pass;
#include <device.h>
#include <amanda.h>
+#include "util.h"
/* global so the 'atexit' handler can access it */
pid_t pid;
amwait_t status;
- amanda_thread_init(NULL);
+ amanda_thread_init();
device_path = setup_vtape_dir();
#include <string.h> /* memset() */
+#include "amanda.h"
#include "vfs-device.h"
#include "fsusage.h"
-#include "amanda.h"
#include "util.h"
#include <regex.h>
return size;
case RESULT_NO_DATA:
pself->is_eof = TRUE;
- /* FALLTHROUGH */
+ pself->in_file = FALSE;
+ return -1;
default:
return -1;
}
}
}
+ /* record that we're at this filenum now */
+ DEVICE(self)->file = fileno;
+
base = g_strdup_printf("%05d.%s.%s.%d", fileno, ji->name, ji->disk,
ji->dumplevel);
sanitary_base = sanitise_filename(base);
}
self->volume_bytes += VFS_DEVICE_LABEL_SIZE;
+ /* make_new_file_name set pself->file for us, but the parent class will increment it, so decrement it now */
+ pself->file--;
if (parent_class->start_file) {
parent_class->start_file(pself, ji);
self->volume_limit = g_value_get_uint64(val);
return TRUE;
} else {
- if (parent_class->property_get) {
- return parent_class->property_get(pself, ID, val);
+ if (parent_class->property_set) {
+ return parent_class->property_set(pself, ID, val);
} else {
return FALSE;
}
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
ok(!tapetype_seen($ttyp, $TAPETYPE_LBL_TEMPL),
"tapetype lbl_templ was not seen");
- is_deeply([ sort(getconf_list("tapetype")) ],
+ is_deeply([ sort(+getconf_list("tapetype")) ],
[ sort("mytapetype", "TEST-TAPE") ],
"getconf_list lists all tapetypes");
}
ok(!dumptype_seen($dtyp, $DUMPTYPE_RECORD),
"'record' parm was not seen");
- is_deeply([ sort(getconf_list("dumptype")) ],
+ is_deeply([ sort(+getconf_list("dumptype")) ],
[ sort(qw(
mydumptype
NO-COMPRESS COMPRESS-FAST COMPRESS-BEST COMPRESS-CUST
ok(!interface_seen($iface, $INTER_MAXUSAGE),
"seen not set for parameters that did not appear");
- is_deeply([ sort(getconf_list("interface")) ],
+ is_deeply([ sort(+getconf_list("interface")) ],
[ sort('inyoface', 'inherface', 'default') ],
"getconf_list lists all interfaces (in any order)");
}
ok(!holdingdisk_next($hdisk),
"no third holding disk");
- is_deeply([ sort(getconf_list("holdingdisk")) ],
+ is_deeply([ sort(+getconf_list("holdingdisk")) ],
[ sort('hd1', 'hd2') ],
"getconf_list lists all holdingdisks (in any order)");
}
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
$testconf->add_param("device_property", '"turbo" "engaged"');
$testconf->write();
-is_deeply([sort(split(qr/\n/, amgetconf('TESTCONF', 'device_property')))],
+is_deeply([sort(+split(qr/\n/, amgetconf('TESTCONF', 'device_property')))],
[sort('"power" "on"', '"turbo" "engaged"')],
"device_property can have multiple values");
$testconf->add_holdingdisk("hd17", [ chunksize => '128' ]);
$testconf->write();
-is_deeply([sort(split(/\n/, amgetconf('TESTCONF', '--list', 'tapetype')))],
+is_deeply([sort(+split(/\n/, amgetconf('TESTCONF', '--list', 'tapetype')))],
[sort("cassette", "reel2reel", "scotch", "TEST-TAPE")],
"--list returns correct set of tapetypes");
is(amgetconf('TESTCONF', 'tapetype:scotch:length'), '500',
is(amgetconf('TESTCONF', 'dumptype:testdump:comment'), 'testdump-dumptype',
"returns dumptype parameter correctly");
-is_deeply([sort(split(/\n/, amgetconf('TESTCONF', '--list', 'interface')))],
+is_deeply([sort(+split(/\n/, amgetconf('TESTCONF', '--list', 'interface')))],
[sort("testiface", "default")],
"--list returns correct set of interfaces");
is(amgetconf('TESTCONF', 'interface:testiface:use'), '10',
"returns interface parameter correctly");
-is_deeply([sort(split(/\n/, amgetconf('TESTCONF', '--list', 'holdingdisk')))],
- [sort("hd17")],
+is_deeply([sort(+split(/\n/, amgetconf('TESTCONF', '--list', 'holdingdisk')))],
+ [sort("hd17")],
"--list returns correct set of holdingdisks");
is(amgetconf('TESTCONF', 'holdingdisk:hd17:chunksize'), '128',
"returns holdingdisk parameter correctly");
]);
$testconf->write();
-is_deeply([sort(split(qr/\n/, amgetconf('TESTCONF', 'dumptype:testdump:exclude')))],
+is_deeply([sort(+split(qr/\n/, amgetconf('TESTCONF', 'dumptype:testdump:exclude')))],
[sort('FILE "f1" "f2"',
'LIST "l1" "l2"')],
"exclude files and lists displayed correctly; a non-final optional is ignored");
-is_deeply([sort(split(qr/\n/, amgetconf('TESTCONF', 'dumptype:testdump:include')))],
+is_deeply([sort(+split(qr/\n/, amgetconf('TESTCONF', 'dumptype:testdump:include')))],
[sort('FILE OPTIONAL "ifo"',
'LIST OPTIONAL "ilo"')],
"a final 'OPTIONAL' makes the whole include/exclude optional")
MAN_XML = $(ALL_MAN_PAGES:%=xml-source/%.xml)
EXTRA_XML = xslt/expand-sambadoc.xsl \
- xslt/man.xsl \
+ xslt/man.xsl.in \
+ xslt/html.xsl.in \
xslt/settings.xsl \
entities/global.entities \
entities/xinclude.dtd
-EXTRA_DIST = $(ALL_MAN_PAGES) $(MAN_XML) $(EXTRA_XML)
+EXTRA_DIST = $(ALL_MAN_PAGES) $(MAN_XML) $(EXTRA_HTML) $(EXTRA_XML)
GEN_XML = $(ALL_MAN_PAGES:%=xml-source/%.proc.xml)
MOSTLYCLEANFILES = $(GEN_XML)
MAINTAINERCLEANFILES = $(ALL_MAN_PAGES)
+# some of the XSL needs to know what docbook-xsl version we've selected
+%.xsl: %.xsl.in $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
if ENABLE_MANPAGE_BUILD
+# phase one of the documentation build expands some macros.
xml-source/%.proc.xml: $(SRCMANPAGEDIR)/%.xml $(srcdir)/xslt/expand-sambadoc.xsl
$(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --xinclude --stringparam latex.imagebasedir "$*/" --stringparam noreference 1 --output $@ $(srcdir)/xslt/expand-sambadoc.xsl $<
+# phase two generates a manpage from the resulting "expanded" docbook XML
%: xml-source/%.proc.xml $(srcdir)/xslt/man.xsl
- $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ http://docbook.sourceforge.net/release/xsl/$(XSLREL)/manpages/docbook.xsl $<
+ $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/man.xsl $<
+
+%.html: xml-source/%.proc.xml $(srcdir)/xslt/html.xsl
+ $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/html.xsl $<
else !ENABLE_MANPAGE_BUILD
@echo WARNING: Not building needed $@ because building manpages is disabled.
@echo 'DUMMY' > $@
+# (no rule to build HTML without ENABLE_MANPAGE_BUILD)
+
endif
+##
+## HTML Generation
+##
+
+EXTRA_DIST += \
+ index.php \
+ amanda.css
+
+ALL_MAN_HTMLS = $(ALL_MAN_PAGES:%=%.html)
+
+# toplevel rule to build HTML manpages and tar them up
+html: amanda.css index.php $(ALL_MAN_HTMLS)
+ tar -zcf html.tar.gz $(ALL_MAN_HTMLS) amanda.css index.php
+
# double-check that we don't ship dummy manpages
dist-hook:
for f in $(WANTED_MAN_PAGES); do \
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
SRCMANPAGEDIR = $(srcdir)/xml-source
MAN_XML = $(ALL_MAN_PAGES:%=xml-source/%.xml)
EXTRA_XML = xslt/expand-sambadoc.xsl \
- xslt/man.xsl \
+ xslt/man.xsl.in \
+ xslt/html.xsl.in \
xslt/settings.xsl \
entities/global.entities \
entities/xinclude.dtd
-EXTRA_DIST = $(ALL_MAN_PAGES) $(MAN_XML) $(EXTRA_XML)
+
+# (no rule to build HTML without ENABLE_MANPAGE_BUILD)
+EXTRA_DIST = $(ALL_MAN_PAGES) $(MAN_XML) $(EXTRA_HTML) $(EXTRA_XML) \
+ index.php amanda.css
GEN_XML = $(ALL_MAN_PAGES:%=xml-source/%.proc.xml)
MOSTLYCLEANFILES = $(GEN_XML)
MAINTAINERCLEANFILES = $(ALL_MAN_PAGES)
+ALL_MAN_HTMLS = $(ALL_MAN_PAGES:%=%.html)
man_MANS = $(WANTED_MAN_PAGES)
all: all-am
dvi-am:
-html: html-am
-
info: info-am
info-am:
uninstall-man uninstall-man5 uninstall-man8
+# some of the XSL needs to know what docbook-xsl version we've selected
+%.xsl: %.xsl.in $(top_builddir)/config.status
+ $(top_builddir)/config.status --file=$@:$<
+
+# phase one of the documentation build expands some macros.
@ENABLE_MANPAGE_BUILD_TRUE@xml-source/%.proc.xml: $(SRCMANPAGEDIR)/%.xml $(srcdir)/xslt/expand-sambadoc.xsl
@ENABLE_MANPAGE_BUILD_TRUE@ $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --xinclude --stringparam latex.imagebasedir "$*/" --stringparam noreference 1 --output $@ $(srcdir)/xslt/expand-sambadoc.xsl $<
+# phase two generates a manpage from the resulting "expanded" docbook XML
@ENABLE_MANPAGE_BUILD_TRUE@%: xml-source/%.proc.xml $(srcdir)/xslt/man.xsl
-@ENABLE_MANPAGE_BUILD_TRUE@ $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ http://docbook.sourceforge.net/release/xsl/$(XSLREL)/manpages/docbook.xsl $<
+@ENABLE_MANPAGE_BUILD_TRUE@ $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/man.xsl $<
+
+@ENABLE_MANPAGE_BUILD_TRUE@%.html: xml-source/%.proc.xml $(srcdir)/xslt/html.xsl
+@ENABLE_MANPAGE_BUILD_TRUE@ $(XSLTPROC) $(XSLTPROC_FLAGS) --path $(srcdir)/xslt/ --output $@ xslt/html.xsl $<
@ENABLE_MANPAGE_BUILD_FALSE@%: $(SRCMANPAGEDIR)/%.xml
@ENABLE_MANPAGE_BUILD_FALSE@ @echo WARNING: Not building needed $@ because building manpages is disabled.
@ENABLE_MANPAGE_BUILD_FALSE@ @echo 'DUMMY' > $@
+# toplevel rule to build HTML manpages and tar them up
+html: amanda.css index.php $(ALL_MAN_HTMLS)
+ tar -zcf html.tar.gz $(ALL_MAN_HTMLS) amanda.css index.php
+
# double-check that we don't ship dummy manpages
dist-hook:
for f in $(WANTED_MAN_PAGES); do \
.\" Title: amaddclient
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMADDCLIENT" "8" "05/14/2008" "" ""
+.TH "AMADDCLIENT" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fBssh-keygen\fR(1)
\fBssh-add\fR(1)
\fBscp\fR(1)
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amadmin
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMADMIN" "8" "05/14/2008" "" ""
+.TH "AMADMIN" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fB\-\-sort\fR
option changes the sort order using the following flags:
.sp
-.RS 4
.nf
\fIh\fR: host name
\fIk\fR: disk name
\fIp\fR: dump part
\fIb\fR: tape label
.fi
-.RE
.sp
An uppercase letter reverses the sort order for that key\. The default sort order is
\fBhkdlpb\fR\.
get a full level 0 backup during the next
\fIAmanda\fR
run\.
-.sp
-.RS 4
.nf
$ amadmin daily force machine\-a / /var /usr
amadmin: machine\-a:/ is set to a forced level 0 tonight\.
amadmin: machine\-a:/var is set to a forced level 0 tonight\.
amadmin: machine\-a:/usr is set to a forced level 0 tonight\.
.fi
-.RE
.PP
Request all file systems on
\fImachine\-b\fR
get a full level 0 backup during the next
\fIAmanda\fR
run\.
-.sp
-.RS 4
.nf
$ amadmin daily force machine\-b
amadmin: machine\-b:/ is set to a forced level 0 tonight\.
amadmin: machine\-b:/usr is set to a forced level 0 tonight\.
amadmin: machine\-b:/home is set to a forced level 0 tonight\.
.fi
-.RE
.PP
Undo the previous
\fBforce\fR
\fI/home\fR
on
\fImachine\-b\fR\. The other file systems will still get a full level 0 backup\.
-.sp
-.RS 4
.nf
$ amadmin daily unforce machine\-b /home
amadmin: force command for machine\-b:/home cleared\.
.fi
-.RE
.PP
Locate backup images of
\fI/var\fR
column tells you which file on the tape has the image (file number zero is a tape label)\. This column shows zero and is not meaningful if the image is still in the holding disk\. The
\fIstatus\fR
column tells you whether the backup was successful or had some type of error\.
-.sp
-.RS 4
.nf
$ amadmin daily find machine\-c /var
date host disk lv tape or file file part status
2000\-11\-01 machine\-c /var 1 000102 5 \-\- OK
2000\-10\-31 machine\-c /var 1 000101 3 \-\- OK
.fi
-.RE
.PP
Forget about the
\fI/workspace\fR
file,
\fIAmanda\fR
will treat it as a new disk during the next run\.
-.sp
-.RS 4
.nf
$ amadmin daily delete machine\-d /workspace
amadmin: machine\-d:/workspace deleted from database\.
amadmin: NOTE: you\'ll have to remove these from the disklist yourself\.
.fi
-.RE
.PP
Find the next tape
\fIAmanda\fR
will use (in this case,
123456)\.
-.sp
-.RS 4
.nf
$ amadmin daily tape
The next \fIAmanda\fR run should go onto tape 123456 or a new tape\.
.fi
-.RE
.PP
Show how well full backups are balanced across the dump cycle\. The
\fIdue\-date\fR
runs will be made between full backups for a file system\. In the example, a file system will probably have a full backup done every eight times
\fIAmanda\fR
is run (e\.g\. every eight days)\.
-.sp
-.RS 4
.nf
$ amadmin daily balance
due\-date #fs orig KB out KB balance
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
TOTAL 241 12412187 7316312 731631 (estimated 8 runs per dumpcycle)
.fi
-.RE
.SH "FILES"
.PP
/usr/local/etc/amanda/\fIconfig\fR/amanda\.conf
\fBamdump\fR(8),
\fBamrestore\fR(8),
\fBamfetchdump\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amaespipe
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMAESPIPE" "8" "05/14/2008" "" ""
+.TH "AMAESPIPE" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
and
\fBgpg\fR
to work\. Aespipe is available from
-\fI\%http://loop-aes.sourceforge.net\fR
+: http://loop-aes.sourceforge.net
.PP
\fBamaespipe\fR
\fBaespipe\fR(1),
\fBamcrypt\fR(8),
\fBgpg\fR(1),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amanda-client.conf
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMANDA\-CLIENT\.CONF" "5" "05/14/2008" "" ""
+.TH "AMANDA\-CLIENT\.CONF" "5" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fBamanda.conf\fR(5),
\fBamcrypt\fR(8),
\fBaespipe\fR(1),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amanda
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMANDA" "8" "05/14/2008" "" ""
+.TH "AMANDA" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fIdisklist\fR
file determines which disks will be backed up by
\fIAmanda\fR\. The file usually contains one line per disk:
-.sp
-.RS 4
.nf
\fIhostname diskname\fR [\fIdiskdevice\fR] \fIdumptype\fR [\fIspindle\fR [\fIinterface\fR] ]
.fi
-.RE
.PP
All pairs [
\fIhostname diskname\fR
named
\fInormal\fR
is used for most disks, but use of the holding disk needs to be disabled for the file system that holds it, this would work instead of defining a new dumptype:
-.sp
-.RS 4
.nf
\fIhostname diskname\fR [ \fIdiskdevice\fR ] {
normal
holdingdisk never
} [ \fIspindle\fR [ \fIinterface\fR ] ]
.fi
-.RE
.SH "TAPE MANAGEMENT"
.PP
The
\fIAmanda\fR
and should not be created or edited during normal operation\. It contains lines of the form:
.PP
-.RS 4
.nf
YYYYMMDD label flags
.fi
-.RE
.PP
Where
\fIYYYYMMDD\fR
\fIdriver\-info\fR
is the tape device name\. Entering
.sp
-.RS 4
.nf
tapedev /dev/rmt/0mn
.fi
-.RE
-.sp
is really a short hand for
.sp
-.RS 4
.nf
tapedev tape:/dev/rmt/0mn
.fi
.RE
-.RE
.PP
\fInull\fR
.RS 4
field is not used and may be left blank:
.sp
.sp
-.RS 4
.nf
tapedev null:
.fi
-.RE
.sp
The
\fIlength\fR
field describes the devices to use\. Curly braces indicate multiple replacements in the string\. For instance:
.sp
.sp
-.RS 4
.nf
tapedev rait:/dev/rmt/tps0d{4,5,6}n
.fi
-.RE
.sp
would use the following devices:
.sp
\fI/etc/amandapass\fR
with share names, (clear text) passwords and (optional) domain names, in that order, one per line, whitespace separated\. By default, the user used to connect to the PC is the same for all PC\'s and is compiled into
\fIAmanda\fR\. It may be changed on a host by host basis by listing it first in the password field followed by a percent sign and then the password\. For instance:
-.sp
-.RS 4
.nf
//some\-pc/home normalpw
//another\-pc/disk otheruser%otherpw
.fi
-.RE
With clear text passwords, this file should obviously be tightly protected\. It only needs to be readable by the
\fIAmanda\fR\-user on the Samba server\.
.sp
\fIname\fR
is simply the name of the option, e\.g\.,
.sp
-.RS 4
.nf
amdump \-oruntapes=2
.fi
-.RE
-.sp
For options in a named section of the configuration,
\fIname\fR
has the form
\fIsection_name\fR
is the name of the tapetype, dumptype, holdingdisk, or interface\. Examples:
.sp
-.RS 4
.nf
amdump \-o TAPETYPE:HP\-DAT:length=2000m
amdump \-o DUMPTYPE:no\-compress:compress="server fast"
amdump \-o HOLDINGDISK:hd1:use="\-100 mb"
amdump \-o INTERFACE:local:use="2000 kbps"
.fi
-.RE
.PP
Note that configuration overrides are not effective for tape changers, which supply a tapedev based on their own configuration\. In order to override
\fItapedev\fR, you must also disable any changer:
.sp
-.RS 4
.nf
amdump \-otapedev=/dev/nst1 \-otpchanger=\'\'
.fi
-.RE
-.sp
.SH "AUTHOR"
.PP
James da Silva,
\fBamcheckdump\fR(8),
\fBamserverconfig\fR(8),
\fBamaddclient\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amanda.conf
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMANDA\.CONF" "5" "05/14/2008" "" ""
+.TH "AMANDA\.CONF" "5" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
These options can set various device properties, including block size, maximum volume usage, authentication information, hardware feature support, and more\.Specifics of how properties are used are device\-dependent, though some common properties are supported across multiple device drivers\.
.sp
Both strings are quoted; the first string contains the name of the property to set, and the second contains its value\. For example, to set a fixed block size of 128k, do:
-.sp
-.RS 4
.nf
-device_property "BLOCK_SIZE" "131072"
-.fi
-.RE
+device_property "BLOCK_SIZE" "131072".fi
.sp
The order in which device properties are set is as follows:
.sp
Default:
\fItttTTTTTTT\fR\. The priority order of each dumper:
.sp
-.RS 4
.nf
s: smallest size
S: largest size
B: largest bandwidth
.fi
.RE
-.RE
.PP
\fBmaxdumps\fR int
.RS 4
.sp
.RS 4
\h'-04' 1.\h'+02'the name of the column, which may be:
-.sp
-.RS 4
.nf
Compress (compression ratio)
Disk (client disk name)
OutKB (output image size in KBytes)
TapeRate (tape writing rate in KBytes/sec)
TapeTime (total tape time in hours:minutes)
-
-.fi
-.RE
+ .fi
.RE
.sp
.RS 4
.IP "" 4
Here is an example:
.sp
-.RS 4
.nf
columnspec "Disk=1:18,HostName=0:10,OutKB=1:7"
.fi
-.RE
.sp
The above will display the disk information in 18 characters and put one space before it\. The hostname column will be 10 characters wide with no space to the left\. The output KBytes column is seven characters wide with one space before it\.
.RE
The
\fBamanda\.conf\fR
file may define one or more holding disks used as buffers to hold backup images before they are written to tape\. The syntax is:
-.sp
-.RS 4
.nf
holdingdisk \fIname\fR {
\fIholdingdisk\-option\fR \fIholdingdisk\-value\fR
\.\.\.
}
.fi
-.RE
.PP
\fIName\fR
is a logical name for this holding disk\.
A set of backup options are entered in a
\fBdumptype\fR
section, which looks like this:
-.sp
-.RS 4
.nf
define dumptype \fIname\fR {
\fIdumptype\-option\fR \fIdumptype\-value\fR
\.\.\.
}
.fi
-.RE
.PP
\fIName\fR
is the name of this set of backup options\. It is referenced from the
.sp
For
\fBexclude list\fR, if the file name is relative, the disk name being backed up is prepended\. So if this is entered:
-.sp
-.RS 4
.nf
exclude list "\.amanda\.excludes"
.fi
-.RE
the actual file used would be
\fI/var/\.amanda\.excludes\fR
for a backup of
\fBdumptype\fR
entries are predefined by
\fIAmanda\fR:
-.sp
-.RS 4
.nf
define dumptype no\-compress {
compress none
skip\-full yes
}
.fi
-.RE
.PP
In addition to options in a
\fBdumptype\fR
\fBdumptype\fRs\. For instance, two sections might be the same except for the
\fBrecord\fR
option:
-.sp
-.RS 4
.nf
define dumptype normal {
comment "Normal backup, no compression, do indexing"
record no
}
.fi
-.RE
.PP
\fIAmanda\fR
provides a
file may define multiple types of tape media and devices\. The information is entered in a
\fBtapetype\fR
section, which looks like this in the config file:
-.sp
-.RS 4
.nf
define tapetype \fIname\fR {
\fItapetype\-option\fR \fItapetype\-value\fR
\.\.\.
}
.fi
-.RE
.PP
\fIName\fR
is the name of this type of tape medium/device\. It is referenced from the
\fBtapetype\fR
inherit options from another
\fBtapetype\fR\. For instance, the only difference between a DLT4000 tape drive using Compact\-III tapes and one using Compact\-IV tapes is the length of the tape\. So they could be entered as:
-.sp
-.RS 4
.nf
define tapetype DLT4000\-III {
comment "DLT4000 tape drives with Compact\-III tapes"
length 25000 mbytes # 20 Gig tapes with some compression
}
.fi
-.RE
-.sp
.SH "INTERFACE SECTION"
.PP
The
file may define multiple types of network interfaces\. The information is entered in an
\fBinterface\fR
section, which looks like this:
-.sp
-.RS 4
.nf
define interface \fIname\fR {
\fIinterface\-option\fR \fIinterface\-value\fR
\.\.\.
}
.fi
-.RE
.PP
\fIname\fR
is the name of this type of network interface\. It is referenced from the
\fBamanda-client.conf\fR(5),
\fBamcrypt\fR(8),
\fBaespipe\fR(1),
-\fI\%http://wiki.zmanda.com\fR
-.PP
-An updated version of this man page may be available at http://wiki\.zmanda\.com/index\.php/Amanda\.conf\.
+: http://wiki.zmanda.com
--- /dev/null
+/* Taken from the Zmanda wiki, for at least a little bit of visual continuity */
+body {
+ font: small sans-serif;
+ background: #82B1C8 0 0 no-repeat;
+ color: black;
+}
+
+div.refentry {
+ background: white;
+ margin-left: 11em;
+ margin-top: 2em;
+ padding: .6em;
+ padding-top: 0;
+ border: thin gray ridge;
+}
+
+pre {
+ padding: 1em;
+ border: 1px dashed #2f6fab;
+ color: black;
+ background-color: #f9f9f9;
+ line-height: 1.1em;
+}
+
+/* browsers override this for some reason */
+table {
+ font-size: small;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ color: black;
+ background: none;
+ font-weight: normal;
+ margin: 0;
+ padding-top: .5em;
+ padding-bottom: .17em;
+ border-bottom: 1px solid #5C706D;
+}
+h1 { font-size: 188%; }
+h2 { font-size: 150%; }
+h3, h4, h5, h6 {
+ border-bottom: none;
+ font-weight: bold;
+}
+h3 { font-size: 132%; }
+h4 { font-size: 116%; }
+h5 { font-size: 100%; }
+h6 { font-size: 80%; }
.\" Title: amcheck
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMCHECK" "8" "05/14/2008" "" ""
+.TH "AMCHECK" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.SH "EXAMPLES"
.PP
In this example, both the tape server and client tests are run\. The results are displayed on standard output\.
-.sp
-.RS 4
.nf
% amcheck daily
\fIAmanda\fR Tape Server Host Check
(brought to you by \fIAmanda\fR 2\.5\.0)
.fi
-.RE
.PP
In this example, if the line
\fBmailto csd\-amanda\fR
\fIamanda\.conf\fR, mail will be sent to
\fBcsd\-amanda\fR
if the server check returns an error\.
-.sp
-.RS 4
.nf
% amcheck \-s \-m daily
.fi
-.RE
.SH "MESSAGES"
.PP
fatal slot \fIslot\fR: \fIerror message\fR
was reported by the status check on
\fIhost\fR\.
.RE
+.SH "EXIT CODE"
+
+The exit code of \fBamcheck\fR is one of:
+.nf
+ 0 = success
+ 1 = error
+.fi
.SH "AUTHOR"
.PP
James da Silva,
.PP
\fBamanda\fR(8),
\fBamdump\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amcheckdb
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMCHECKDB" "8" "05/14/2008" "" ""
+.TH "AMCHECKDB" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.SH "EXAMPLE"
.PP
This shows a normal response:
-.sp
-.RS 4
.nf
# amcheckdb daily
Ready\.
.fi
-.RE
.PP
This shows tape
\fIDMP014\fR
is still listed in the database but is no longer listed in the
\fItapelist\fR
file:
-.sp
-.RS 4
.nf
# amcheckdb daily
Tape DMP014 missing in /usr/local/etc/amanda//daily/tapelist
Ready\.
.fi
-.RE
.SH "AUTHOR"
.PP
Adrian T\. Filipi\-Martin <atf3r@cs\.virginia\.edu>: Original text
\fBamadmin\fR(8),
\fBamrmtape\fR(8),
\fBamanda\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amcheckdump
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMCHECKDUMP" "8" "05/14/2008" "" ""
+.TH "AMCHECKDUMP" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.SH "SEE ALSO"
.PP
\fBamanda\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.SH "EXAMPLE"
.PP
-.RS 4
.nf
# check the most recent dump
amcheckdump MYCONFIG
# check a specific dump from back in \'78
amcheckdump MYCONFIG \-\-timestamp 19780615
.fi
-.RE
.SH "SEE ALSO"
.PP
\fBamanda\fR(8),
.\" Title: amcleanup
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMCLEANUP" "8" "05/14/2008" "" ""
+.TH "AMCLEANUP" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
This example runs the
\fIAmanda\fR
cleanup process by hand after a failure\.
-.sp
-.RS 4
.nf
% amcleanup daily
.fi
-.RE
.PP
Putting the following line in a system boot script (e\.g\.
\fI/etc/rc\.local\fR) runs the
\fIAmanda\fR
cleanup process as part of the reboot, eliminating the need to run it by hand\.
-.sp
-.RS 4
.nf
/usr/local/sbin/amcleanup daily
.fi
-.RE
.PP
If nothing needs to be done,
\fBamcleanup\fR
exits normally with the message:
-.sp
-.RS 4
.nf
amcleanup: no unprocessed logfile to clean up\.
.fi
-.RE
.SH "AUTHOR"
.PP
James da Silva,
.PP
\fBamanda\fR(8),
\fBamdump\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amcrypt-ossl-asym
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMCRYPT\-OSSL\-ASYM" "8" "05/14/2008" "" ""
+.TH "AMCRYPT\-OSSL\-ASYM" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
uses
\fBOpenSSL\fR
to encrypt and decrypt data\. OpenSSL is available from
-\fIwww\.openssl\.org\fR\&[1]\. OpenSSL offers a wide variety of cipher choices (
+www\.openssl\.org\. OpenSSL offers a wide variety of cipher choices (
\fBamcrypt\-ossl\-asym\fR
defaults to 256\-bit AES) and can use hardware cryptographic accelerators on several platforms\.
.PP
.SH "GENERATING PUBLIC AND PRIVATE KEYS"
.PP
RSA keys can be generated with the standard OpenSSL commands, e\.g\.:
-.sp
-.RS 4
.nf
$ cd /var/lib/amanda
$ openssl genrsa \-aes128 \-out backup\-privkey\.pem 1024
$ openssl rsa \-in backup\-privkey\.pem \-pubout \-out backup\-pubkey\.pem
Enter pass phrase for backup\-privkey\.pem: \fIENTER YOUR PASS PHRASE\fR
Writing RSA key
-
.fi
-.RE
.PP
To generate a private key without a passphrase, omit the
\fB\-aes128\fR
While the public key must be online at all times to perorm backups, the private key and optional passphrase are only needed to restore data\. It is recommended that the latter be stored offline all other times\. For example, you could keep the private key on removable media, and copy it into place for a restore; or you could keep the private key online, encrypted with a passphrase that is present only for a restore\.
.PP
OpenSSL\'s key derivation routines use a salt to guard against dictionary attacks on the pass phrase; still it is important to pick a pass phrase that is hard to guess\. The Diceware method (see
-\fIwww\.diceware\.com\fR\&[2]) can be used to create passphrases that are difficult to guess and easy to remember\.
+www\.diceware\.com) can be used to create passphrases that are difficult to guess and easy to remember\.
.SH "FILES"
.PP
/var/lib/amanda/backup\-privkey\.pem
\fBamanda.conf\fR(5),
\fBopenssl\fR(1),
\fBamcrypt-ossl\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.SH "NOTES"
.IP " 1." 4
www.openssl.org
.\" Title: amcrypt-ossl
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMCRYPT\-OSSL" "8" "05/14/2008" "" ""
+.TH "AMCRYPT\-OSSL" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
uses
\fBOpenSSL\fR
to encrypt and decrypt data\. OpenSSL is available from
-\fIwww\.openssl\.org\fR\&[1]\. OpenSSL offers a wide variety of cipher choices (
+www\.openssl\.org\. OpenSSL offers a wide variety of cipher choices (
\fBamcrypt\-ossl\fR
defaults to 256\-bit AES) and can use hardware cryptographic accelerators on several platforms\.
.PP
be recovered with the correct passphrase\.
.PP
OpenSSL\'s key derivation routines use a salt to guard against dictionary attacks on the pass phrase; still it is important to pick a pass phrase that is hard to guess\. The Diceware method (see
-\fIwww\.diceware\.com\fR\&[2]) can be used to create passphrases that are difficult to guess and easy to remember\.
+www\.diceware\.com) can be used to create passphrases that are difficult to guess and easy to remember\.
.SH "FILES"
.PP
/var/lib/amanda/\.am_passphrase
\fBamanda.conf\fR(5),
\fBopenssl\fR(1),
\fBamcrypt-ossl-asym\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.SH "NOTES"
.IP " 1." 4
www.openssl.org
.\" Title: amcrypt
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMCRYPT" "8" "05/14/2008" "" ""
+.TH "AMCRYPT" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
and
\fBgpg\fR
to work\. Aespipe is available from
-\fI\%http://loop-aes.sourceforge.net\fR
+: http://loop-aes.sourceforge.net
.PP
\fBamcrypt\fR
This will ask for a passphrase\. Remember this passphrase as you will need it in the next step\.
.PP
2\. Store the passphrase inside the home\-directory of the AMANDA\-user and protect it with proper permissions:
-.sp
-.RS 4
.nf
echo my_secret_passphrase > ~amanda/\.am_passphrase
chown amanda:disk ~amanda/\.am_passphrase
chmod 700 ~amanda/\.am_passphrase
.fi
-.RE
.SH "KEY AND PASSPHRASE"
.PP
\fBaespipe\fR(1),
\fBamaespipe\fR(8),
\fBgpg\fR(1),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amcryptsimple
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMCRYPTSIMPLE" "8" "05/14/2008" "" ""
+.TH "AMCRYPTSIMPLE" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fBamgpgcrypt\fR(8),
\fBamrestore\fR(8),
\fBgpg\fR(1),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amdd
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMDD" "8" "05/14/2008" "" ""
+.TH "AMDD" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.PP
\fBamanda\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amdevcheck
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMDEVCHECK" "8" "05/14/2008" "" ""
+.TH "AMDEVCHECK" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fBamanda\fR(8),
\fBammt\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amdump
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMDUMP" "8" "05/14/2008" "" ""
+.TH "AMDUMP" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fBamdump\fR
every weeknight at 1 a\.m\. as user
\fBbin\fR:
-.sp
-.RS 4
.nf
0 1 * * 1\-5 bin /usr/local/sbin/amdump daily
.fi
-.RE
.PP
Please see the
\fBcrontab\fR(5)
and then rerun
\fBamdump\fR\.
.RE
+.SH "EXIT CODE"
+
+The exit code of \fBamdump\fR is the ORed value of:
+.nf
+ 0 = success
+ 1 = error
+ 2 = a dle give strange message
+ 4 = a dle failed
+ 8 = Don\'t know the status of a dle (RESULT_MISSING in the report)
+ 16 = tape error or no more tape
+.fi
.SH "AUTHOR"
.PP
James da Silva,
\fBamrestore\fR(8),
\fBamflush\fR(8),
\fBcron\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amfetchdump
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMFETCHDUMP" "8" "05/14/2008" "" ""
+.TH "AMFETCHDUMP" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fBamrestore\fR(8),
\fBtar\fR(1),
\fBrestore\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amflush
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMFLUSH" "8" "05/14/2008" "" ""
+.TH "AMFLUSH" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fBamflush\fR
writes the data to tape, updates the databases and sends a mail report similar to
\fBamdump\fR(8)\.
-.sp
-.RS 4
.nf
% amflush daily
Scanning /amanda\-hold\.\.\.
Running in background, you can log off now\.
You\'ll get mail when amflush is finished\.
.fi
-.RE
+.SH "EXIT CODE"
+
+The exit code of \fBamflush\fR is the ORed value of:
+.nf
+ 0 = success
+ 1 = error
+ 4 = a dle failed
+ 8 = Don\'t know the status of a dle (RESULT_MISSING in the report)
+ 16 = tape error or no more tape
+.fi
.SH "AUTHOR"
.PP
James da Silva,
\fBamanda\fR(8),
\fBamdump\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amgetconf
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMGETCONF" "8" "05/14/2008" "" ""
+.TH "AMGETCONF" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.PP
\fBamanda\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amgpgcrypt
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMGPGCRYPT" "8" "05/14/2008" "" ""
+.TH "AMGPGCRYPT" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
chmod 700 ~$amanda_user/\.am_passphrase
.PP
Run "gpg \-\-gen\-key"\. Below is an example:
-.sp
-.RS 4
.nf
$ gpg \-\-gen\-key
gpg (GnuPG) 1\.2\.6; Copyright (C) 2004 Free Software Foundation, Inc\.
pub 1024D/4417A8CB 2006\-02\-07 amandabackup (gpg keys for amandabackup)
Key fingerprint = 139C 6369 44FC 7F1A 655C E5E9 7EAA 515A 4417 A8CB
sub 1024g/8C3A6A78 2006\-02\-07 [expires: 2006\-08\-06]
-
.fi
-.RE
.SH "FILES"
.PP
\fB$AMANDA_HOME/\.gnupg/pubring\.gpg\fR
\fBamcrypt\fR(8),
\fBamrestore\fR(8),
\fBgpg\fR(1),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amlabel
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMLABEL" "8" "05/14/2008" "" ""
+.TH "AMLABEL" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
label with the string "DMP000" on the tape loaded in the device named in the
\fBtapedev\fR
option in /usr/local/etc/amanda/daily/amanda\.conf:
-.sp
-.RS 4
.nf
% amlabel daily DMP000
.fi
-.RE
.PP
Label the tape in slot 3 of the currently configured tape changer with the string "DMP003":
-.sp
-.RS 4
.nf
% amlabel daily DMP003 slot 3
.fi
-.RE
.SH "MESSAGES"
.PP
label \fIlabel\fR doesn\'t match labelstr \fIstr\fR
\fBamanda\fR(8),
\fBamdump\fR(8),
\fBamflush\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: ammt
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMMT" "8" "05/14/2008" "" ""
+.TH "AMMT" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.SH "SEE ALSO"
.PP
\fBamanda\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amoverview
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMOVERVIEW" "8" "05/14/2008" "" ""
+.TH "AMOVERVIEW" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
file system on
\fIhost2\fR
was backed up at level 3 on the 8th, 9th and 10th of December, had a full backup on the 11th, a level 1 on the 12th and a level 2 on the 13th\.
-.sp
-.RS 4
.nf
# amoverview
date 12 12 12 12 12 12
host2 /opt 1 1 1 1 1 1
host2 /var 1 1 0 1 1 1
.fi
-.RE
.SH "SEE ALSO"
.PP
\fBamadmin\fR(8),
\fBamanda\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amplot
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMPLOT" "8" "05/14/2008" "" ""
+.TH "AMPLOT" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fBsh\fR(1),
\fBcompress\fR(1),
\fBgzip\fR(1),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amrecover
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMRECOVER" "8" "05/14/2008" "" ""
+.TH "AMRECOVER" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
must be equal to the amrecover_changer setting on the server\.
.sp
If you need to change the protocol (tape:, rait:, file:, null:) then you must specify the hostname\.
-.sp
-.RS 4
.nf
settape 192\.168\.0\.10:file:/file1
.fi
-.RE
You can change the tape device when amrecover ask you to load the tape:
-.sp
-.RS 4
.nf
Load tape DMP014 now
Continue? [Y/n/t]: t
Using tape /dev/nst2 from server server2\.
.fi
.RE
-.RE
.PP
\fBsetmode\fR \fImode\fR
.RS 4
The following shows the recovery of an old
\fIsyslog\fR
file\.
-.sp
-.RS 4
.nf
# cd /var/log
# ls \-l syslog\.7
total 26
\-rw\-r\-\-r\-\- 1 root other 12678 Oct 14 16:36 syslog\.7
.fi
-.RE
.PP
If you do not want to overwrite existing files, create a subdirectory to run
\fBamrecover\fR
from and then move the restored files afterward\.
-.sp
-.RS 4
.nf
# cd /var
# (umask 077 ; mkdir \.restore)
# cd \.\.
# rm \-fr \.restore
.fi
-.RE
.PP
If you need to run
\fBamrestore\fR
control it, use the
\fBlist\fR
command after browsing to display the needed tapes\.
-.sp
-.RS 4
.nf
# cd /var/log
# amrecover
/log/syslog
amrecover> quit
.fi
-.RE
.PP
The
\fBhistory\fR
command shows each tape that has a backup of the current disk along with the date of the backup, the level, the tape label and the file position on the tape\. All active tapes are listed, not just back to the most recent full dump\.
.PP
Tape file position zero is a label\. The first backup image is in file position one\.
-.sp
-.RS 4
.nf
# cd /var/log
# amrecover
\.\.\.
amrecover> quit
.fi
-.RE
.SH "ENVIRONMENT"
.PP
\fBPAGER\fR
\fBamrestore\fR(8),
\fBamfetchdump\fR(8),
\fBreadline\fR(3),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amreport
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMREPORT" "8" "05/14/2008" "" ""
+.TH "AMREPORT" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.RE
.PP
The 3\-ring binder type is the most generic\. It may be used to make a hardcopy log of the tapes\.
+.SH "EXIT CODE"
+
+The exit code of \fBamreport\fR is the ORed value of:
+.nf
+ 0 = success
+ 1 = error
+ 2 = a dle give strange message
+ 4 = a dle failed
+ 8 = Don\'t know the status of a dle (RESULT_MISSING in the report)
+ 16 = tape error or no more tape
+.fi
.SH "SEE ALSO"
.PP
\fBamanda\fR(8),
\fBamflush\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amrestore
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMRESTORE" "8" "05/14/2008" "" ""
+.TH "AMRESTORE" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fBamflush\fR(8),
\fBtar\fR(1),
\fBrestore\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amrmtape
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMRMTAPE" "8" "05/14/2008" "" ""
+.TH "AMRMTAPE" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
from the
\fIDailySet1\fR
configuration\.
-.sp
-.RS 4
.nf
# amrmtape DailySet1 DAILY034
.fi
-.RE
.SH "AUTHOR"
.PP
Adrian T\. Filipi\-Martin
.PP
\fBamadmin\fR(8),
\fBamanda\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amserverconfig
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMSERVERCONFIG" "8" "05/14/2008" "" ""
+.TH "AMSERVERCONFIG" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fBamanda\fR(8),
\fBamanda.conf\fR(5),
\fBamaddclient\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amstatus
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMSTATUS" "8" "05/14/2008" "" ""
+.TH "AMSTATUS" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.RS 4
Output the date in a locale independent format\. The format is the same executing: date +\'%Y\-%m\-%d %H:%M:%S %Z\'
.RE
+.SH "EXIT CODE"
+
+The exit code of \fBamstatus\fR is the ORed value of:
+.nf
+ 0 = success
+ 1 = error
+ 4 = a dle failed
+ 8 = Don\'t know the status of a dle (RESULT_MISSING in the report)
+ 16 = tape error or no more tape
+.fi
.SH "SEE ALSO"
.PP
\fBamanda\fR(8),
\fBamdump\fR(8),
\fBamrestore\fR(8),
\fBamadmin\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amtape
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMTAPE" "8" "05/14/2008" "" ""
+.TH "AMTAPE" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.SH "SEE ALSO"
.PP
\fBamanda\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amtapetype
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMTAPETYPE" "8" "05/14/2008" "" ""
+.TH "AMTAPETYPE" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.SH "SEE ALSO"
.PP
\fBamanda\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amtoc
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMTOC" "8" "05/14/2008" "" ""
+.TH "AMTOC" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.SH "OUTPUT FORMAT"
.PP
The standard output has five fields separated by two spaces:
-.sp
-.RS 4
.nf
# Server:/partition date level size[Kb]
0 daily\-05: 19991005 \- \-
\.\.\.
103 cuisg11:/ 19991005 0 4139136
103 total: \- \- 16716288
-
-
.fi
-.RE
.PP
In tabular format (\-t), this would look like:
-.sp
-.RS 4
.nf
# Server:/partition date lev size[Kb]
0 daily\-05: 19991005 \- \-
\.\.\.
103 cuisg11:/ 19991005 0 4139136
103 total: \- \- 16716288
-
.fi
-.RE
.SH "USAGE"
.PP
The easiest way to use it is to run
\fIamdump\fR
in the
\fIcron job:\fR
-.sp
-.RS 4
.nf
amdump daily ; logdir=`amgetconf daily logdir` ; log=`ls \-1t $logdir/log\.*\.[0\-9] | head \-1` ; amtoc \-a $log
.fi
-.RE
.PP
which will generate /usr/local/etc/amanda//daily/\fItape_label\fR\.toc\. You may also want to call
\fBamtoc\fR
\fBamdump\fR(8),
\fBamflush\fR(8),
\fBamgetconf\fR(8), cron, perl,
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.SH "AUTHOR"
.PP
Nicolas Mayencourt
.\" Title: amverify
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMVERIFY" "8" "05/14/2008" "" ""
+.TH "AMVERIFY" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
\fBamrestore\fR(8),
\fBamanda\fR(8),
\fBamverifyrun\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
.\" Title: amverifyrun
.\" Author:
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
-.\" Date: 05/14/2008
+.\" Date: 08/22/2008
.\" Manual:
.\" Source:
.\"
-.TH "AMVERIFYRUN" "8" "05/14/2008" "" ""
+.TH "AMVERIFYRUN" "8" "08/22/2008" "" ""
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.PP
\fBamanda\fR(8),
\fBamverify\fR(8),
-\fI\%http://wiki.zmanda.com\fR
+: http://wiki.zmanda.com
--- /dev/null
+<?php
+/* send the user straight to the amanda(8) manpage */
+header("Location: amanda.8.html");
+exit;
<ulink url="http://wiki.zmanda.com"/>
</para>
-<para>
-An updated version of this man page may be available at http://wiki.zmanda.com/index.php/Amanda.conf.
-</para>
</refsect1>
</refentry>
</variablelist>
</refsect1>
+<refsect1><title>EXIT CODE</title>
+The exit code of <command>amcheck</command> is one of:
+<programlisting>
+ 0 = success
+ 1 = error
+</programlisting>
+</refsect1>
+
<refsect1><title>AUTHOR</title>
<para>James da Silva, &email.jds; : Original text</para>
<para>&maintainer.sgw;: XML-conversion</para>
</variablelist>
</refsect1>
+<refsect1><title>EXIT CODE</title>
+The exit code of <command>amdump</command> is the ORed value of:
+<programlisting>
+ 0 = success
+ 1 = error
+ 2 = a dle give strange message
+ 4 = a dle failed
+ 8 = Don't know the status of a dle (RESULT_MISSING in the report)
+ 16 = tape error or no more tape
+</programlisting>
+</refsect1>
+
<refsect1><title>AUTHOR</title>
<para>James da Silva, &email.jds; : Original text</para>
<para>&maintainer.sgw;: XML-conversion</para>
</programlisting>
</refsect1>
+<refsect1><title>EXIT CODE</title>
+The exit code of <command>amflush</command> is the ORed value of:
+<programlisting>
+ 0 = success
+ 1 = error
+ 4 = a dle failed
+ 8 = Don't know the status of a dle (RESULT_MISSING in the report)
+ 16 = tape error or no more tape
+</programlisting>
+</refsect1>
+
<refsect1><title>AUTHOR</title>
<para>James da Silva, &email.jds; : Original text</para>
<para>&maintainer.sgw;: XML-conversion</para>
It may be used to make a hardcopy log of the tapes.</para>
</refsect1>
+<refsect1><title>EXIT CODE</title>
+The exit code of <command>amreport</command> is the ORed value of:
+<programlisting>
+ 0 = success
+ 1 = error
+ 2 = a dle give strange message
+ 4 = a dle failed
+ 8 = Don't know the status of a dle (RESULT_MISSING in the report)
+ 16 = tape error or no more tape
+</programlisting>
+</refsect1>
+
<refsect1><title>SEE ALSO</title>
<para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>amflush</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
</variablelist>
</refsect1>
+<refsect1><title>EXIT CODE</title>
+The exit code of <command>amstatus</command> is the ORed value of:
+<programlisting>
+ 0 = success
+ 1 = error
+ 4 = a dle failed
+ 8 = Don't know the status of a dle (RESULT_MISSING in the report)
+ 16 = tape error or no more tape
+</programlisting>
+</refsect1>
+
<refsect1><title>SEE ALSO</title>
<para><citerefentry><refentrytitle>amanda</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>amcheck</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<refsect1><title>OUTPUT FORMAT</title>
<para>The standard output has five fields separated by two spaces:</para>
-<!-- .RS -->
-<literallayout remap='.nf'>
+<programlisting>
# Server:/partition date level size[Kb]
0 daily-05: 19991005 - -
1 cuisun15:/cuisun15/home 19991005 1 96
...
103 cuisg11:/ 19991005 0 4139136
103 total: - - 16716288
-<!-- .RE -->
-
-</literallayout><para>In tabular format (-t), this would look like:</para>
+</programlisting>
+<para>In tabular format (-t), this would look like:</para>
-<!-- .RS -->
-<literallayout remap='.nf'>
+<programlisting>
# Server:/partition date lev size[Kb]
0 daily-05: 19991005 - -
1 cuisun15:/cuisun15/home 19991005 1 96
...
103 cuisg11:/ 19991005 0 4139136
103 total: - - 16716288
-<!-- .RE -->
-</literallayout></refsect1>
+</programlisting></refsect1>
<refsect1><title>USAGE</title>
<para>The easiest way to use it is to run
<emphasis remap='I'>cron job:</emphasis></para>
<!-- .RS -->
-<literallayout remap='.nf'>
+<programlisting>
amdump daily ; logdir=`amgetconf daily logdir` ; log=`ls -1t $logdir/log.*.[0-9] | head -1` ; amtoc -a $log
-</literallayout> <!-- .fi -->
+</programlisting>
<para>which will generate /usr/local/etc/amanda//daily/<emphasis remap='I'>tape_label</emphasis>.toc.
You may also want to call
--- /dev/null
+<?xml version='1.0'?>
+<!-- vim:set sts=2 shiftwidth=2 syntax=xml: -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+
+
+<!-- the @..@ is substituted by config.status to contain the XSL release selected
+ at configure time -->
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/@XSLREL@/html/docbook.xsl"/>
+
+<xsl:import href="settings.xsl"/>
+
+<xsl:param name="citerefentry.link" select="'1'"/>
+<xsl:param name="css.decoration" select="1"/>
+<xsl:param name="html.stylesheet" select="'amanda.css'"/>
+<xsl:param name="html.stylesheet.type">text/css</xsl:param>
+<xsl:param name="html.cleanup" select="1"/>
+<xsl:param name="use.extensions" select="'0'"/>
+<xsl:param name="use.id.as.filename" select="'0'"/>
+<xsl:param name="use.local.olink.style" select="1"/>
+<xsl:param name="use.role.as.xrefstyle" select="1"/>
+
+<!-- generate correct links to other manpages -->
+<xsl:template name="generate.citerefentry.link">
+ <xsl:value-of select="refentrytitle"/><xsl:text>.</xsl:text><xsl:value-of select="manvolnum"/><xsl:text>.html</xsl:text>
+</xsl:template>
+
+<xsl:template match="author">
+</xsl:template>
+
+</xsl:stylesheet>
+++ /dev/null
-<?xml version='1.0'?>
-<!-- vim:set sts=2 shiftwidth=2 syntax=xml: -->
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version='1.0'>
-
-
-<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"/>
-
-<xsl:import href="settings.xsl"/>
-
-<xsl:param name="chunk.section.depth" select="0"/>
-<xsl:param name="chunk.first.sections" select="1"/>
-<xsl:param name="use.id.as.filename" select="1"/>
-
-<!--
- Our ulink stylesheet omits @url part if content was specified
--->
-<xsl:template match="ulink">
- <xsl:variable name="content">
- <xsl:apply-templates/>
- </xsl:variable>
- <xsl:if test="$content = ''">
- <xsl:text>: </xsl:text>
- </xsl:if>
- <xsl:if test="$content != ''">
- <xsl:value-of select="$content" />
- </xsl:if>
- <xsl:if test="$content = ''">
- <xsl:apply-templates mode="italic" select="@url" />
- </xsl:if>
-</xsl:template>
-
-<xsl:template match="informalexample|screen|programlisting">
- <xsl:text>.nf </xsl:text>
- <xsl:apply-templates/>
- <xsl:text>.fi </xsl:text>
-</xsl:template>
-
-<xsl:template match="para|simpara|remark" mode="list">
- <xsl:variable name="foo">
- <xsl:apply-templates/>
- </xsl:variable>
- <xsl:choose match="node()">
- <!-- Don't normalize-space() for verbatim paragraphs -->
- <xsl:when test="informalexample|screen|programlisting">
- <xsl:value-of select="$foo"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="normalize-space($foo)"/>
- <xsl:text> </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text> </xsl:text>
- <xsl:if test="following-sibling::para or following-sibling::simpara or
- following-sibling::remark">
- <!-- Make sure multiple paragraphs within a list item don't -->
- <!-- merge together. -->
- <xsl:text> </xsl:text>
- </xsl:if>
-</xsl:template>
-
-<xsl:template match="refsect3">
- <xsl:text> .SS "</xsl:text>
- <xsl:value-of select="title[1]"/>
- <xsl:text>" </xsl:text>
- <xsl:apply-templates/>
-</xsl:template>
-
-
-</xsl:stylesheet>
--- /dev/null
+<?xml version='1.0'?>
+<!-- vim:set sts=2 shiftwidth=2 syntax=xml: -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version='1.0'>
+
+
+<!-- the @..@ is substituted by config.status to contain the XSL release selected
+ at configure time -->
+<xsl:import href="http://docbook.sourceforge.net/release/xsl/@XSLREL@/manpages/docbook.xsl"/>
+
+<xsl:import href="settings.xsl"/>
+
+<xsl:param name="chunk.section.depth" select="0"/>
+<xsl:param name="chunk.first.sections" select="1"/>
+<xsl:param name="use.id.as.filename" select="0"/>
+
+<!--
+ Our ulink stylesheet omits @url part if content was specified
+-->
+<xsl:template match="ulink">
+ <xsl:variable name="content">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:if test="$content = ''">
+ <xsl:text>: </xsl:text>
+ </xsl:if>
+ <xsl:if test="$content != ''">
+ <xsl:value-of select="$content" />
+ </xsl:if>
+ <xsl:if test="$content = ''">
+ <xsl:apply-templates mode="italic" select="@url" />
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="informalexample|screen|programlisting">
+ <xsl:text>.nf </xsl:text>
+ <xsl:apply-templates/>
+ <xsl:text>.fi </xsl:text>
+</xsl:template>
+
+<xsl:template match="para|simpara|remark" mode="list">
+ <xsl:variable name="foo">
+ <xsl:apply-templates/>
+ </xsl:variable>
+ <xsl:choose match="node()">
+ <!-- Don't normalize-space() for verbatim paragraphs -->
+ <xsl:when test="informalexample|screen|programlisting">
+ <xsl:value-of select="$foo"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="normalize-space($foo)"/>
+ <xsl:text> </xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> </xsl:text>
+ <xsl:if test="following-sibling::para or following-sibling::simpara or
+ following-sibling::remark">
+ <!-- Make sure multiple paragraphs within a list item don't -->
+ <!-- merge together. -->
+ <xsl:text> </xsl:text>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template match="refsect3">
+ <xsl:text> .SS "</xsl:text>
+ <xsl:value-of select="title[1]"/>
+ <xsl:text>" </xsl:text>
+ <xsl:apply-templates/>
+</xsl:template>
+
+
+</xsl:stylesheet>
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
-#!/bin/sh
-# Automatically added by dh_makeshlibs
-# End automatically added section
-#!/bin/sh
-# Automatically added by dh_makeshlibs
-# End automatically added section
if [ -z $AMVER ]
then
- AMVER=amanda-2.6.0p1
+ AMVER=amanda-2.6.0p2
fi
if [ -z $AMTARBALL ]
Section: utils
Priority: optional
Maintainer: Zmanda Inc <support@zmanda.com>
-Build-Depends: dump, gnuplot, libncurses5-dev, libreadline5-dev | libreadline-dev, libtool, flex, perl (>=5.6.0), smbclient, mailx, mtx
+Build-Depends: debhelper, dump, fakeroot, flex, gnuplot, libtool, mailx, mtx, perl (>=5.6.0), smbclient,
+ libcurl-dev, libncurses5-dev, libreadline5-dev | libreadline-dev, libssl-dev
Standards-Version: 3.6.1
Package: amanda-backup-server
Architecture: any
-Depends: xinetd, perl (>=5.6.0), mailx, gnuplot, tar (>=1.15), curl (>=7.10.0), libglib2.0-0 (>=2.2.0)
+Depends: xinetd, perl (>=5.6.0), mailx, gnuplot, tar (>=1.15), libcurl3 (>=7.10.0), libglib2.0-0 (>=2.2.0), libssl | libssl0.9.8
Suggests: amanda-backup-client (= ${Source-Version})
Description: Amanda Network Backup and Archiving software
.
Package: amanda-backup-client
Architecture: any
-Depends: xinetd, perl (>=5.6.0), libglib2.0-0 (>=2.2.0)
+Depends: xinetd, perl (>=5.6.0), grep, libcurl3 (>=7.10.0), libglib2.0-0 (>=2.2.0), libssl | libssl0.9.8
Conflicts: amanda-backup-server (>=${Source-Version})
Description: Amanda Network Backup and Archiving software
.
awk -F: '{ print $4 }' |
awk -F, '{ for (i=1; i <= NF; i++ ) print $i }' |
grep '^amandabackup$' > /dev/null; then
- deluser "amandabackup$group" || true
+ deluser "amandabackup $group" || true
fi
done
fi
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
-AMVER=2.6.0p1
+AMVER=2.6.0p2
# These are variables that the user can override. They get used in various
# places during configure, build, and install.
--enable-s3-device \
--disable-installperms
touch missing
+ # There's probably a better way to do this. Preinst and postrm are the
+ # same for client and server, but we leave room for differences by just
+ # appending here.
+ cat $(shell pwd)/debian/preinst >> $(shell pwd)/debian/amanda-backup-client.preinst
+ cat $(shell pwd)/debian/preinst >> $(shell pwd)/debian/amanda-backup-server.preinst
+ cat $(shell pwd)/debian/postrm >> $(shell pwd)/debian/amanda-backup-client.postrm
+ cat $(shell pwd)/debian/postrm >> $(shell pwd)/debian/amanda-backup-server.postrm
make
touch build-stamp
# Try to detect the distribution we are building:
%if %{_vendor} == redhat
# Fedora symlinks /etc/fedora-release to /etc/redhat-release for at least
- # fc3-7. So RHEL and Fedora look at the same file. The awk trickery here
- # forces the field to be numeric so that the spec comparison works
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 3
+ # fc3-8. So RHEL and Fedora look at the same file. Different versions have
+ # different numbers of spaces; hence the use if $3 vs. $4..
+ %if %(awk '$1 == "Fedora" && $4 ~ /3.*/ { exit 1; }' /etc/redhat-release; echo $?)
%define dist fedora
%define disttag fc
%define distver 3
%endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print$4+0}' /etc/redhat-release) == 4
+ %if %(awk '$1 == "Fedora" && $4 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?)
%define dist fedora
%define disttag fc
%define distver 4
%endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 5
+ %if %(awk '$1 == "Fedora" && $4 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?)
%define dist fedora
%define disttag fc
%define distver 5
%endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 6
+ %if %(awk '$1 == "Fedora" && $4 ~ /6.*/ { exit 1; }' /etc/redhat-release; echo $?)
%define dist fedora
%define disttag fc
%define distver 6
%endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $3+0}' /etc/redhat-release) == 7
+ %if %(awk '$1 == "Fedora" && $3 ~ /7.*/ { exit 1; }' /etc/redhat-release; echo $?)
%define dist fedora
%define disttag fc
%define distver 7
%endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $3+0}' /etc/redhat-release) == 8
+ %if %(awk '$1 == "Fedora" && $3 ~ /8.*/ { exit 1; }' /etc/redhat-release; echo $?)
%define dist fedora
%define disttag fc
%define distver 8
%{!?PKG_CONFIG_PATH: %define PKG_CONFIG_PATH /usr/lib/pkgconfig}
%endif
%endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 3
+ %if %(awk '$1 == "Red" && $7 ~ /3.*/ { exit 1; }' /etc/redhat-release; echo $?)
%define dist redhat
%define disttag rhel
%define distver 3
+ %define tarver 1.14
%endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 4
+ %if %(awk '$1 == "Red" && $7 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?)
%define dist redhat
%define disttag rhel
%define distver 4
+ %define tarver 1.14
%endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 5
+ %if %(awk '$1 == "Red" && $7 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?)
%define dist redhat
%define disttag rhel
%define distver 5
%define xinetd_reload restart
%endif
+# Set minimum tar version if it wasn't set in the per-distro section
+%{!?tarver: %define tarver 1.15}
+
%define packer %(%{__id_u} -n)
# --- Definitions ---
# Define amanda_version if it is not already defined.
-%{!?amanda_version: %define amanda_version 2.6.0p1}
+%{!?amanda_version: %define amanda_version 2.6.0p2}
%{!?amanda_release: %define amanda_release 1}
%define amanda_version_info "Amanda Community Edition - version %{amanda_version}"
%define amanda_user amandabackup
Requires: curl >= 7.10.0
Requires: xinetd
Requires: perl >= 5.6.0
-Requires: tar >= 1.15
+Requires: tar >= %{tarver}
%if %{dist} == redhat || %{dist}== fedora
Requires: libtermcap.so.2
Requires: initscripts
fi
fi
if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE}
+ echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDAHOMEDIR}/.gnupg'." >>${TMPFILE}
chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
ret_val=$?
if [ ${ret_val} -eq 0 ]; then
fi
fi
if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE}
+ echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDAHOMEDIR}/.gnupg'." >>${TMPFILE}
chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
ret_val=$?
if [ ${ret_val} -eq 0 ]; then
fi
fi
if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE}
+ echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{AMANDAHOMEDIR}/.gnupg'." >>${TMPFILE}
chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
ret_val=$?
if [ ${ret_val} -eq 0 ]; then
/sbin/ldconfig
# --- Files to install ---
-
+# Notes: Do not use wildcards on directories not wholly owned by amanda. An
+# uninstall of the software will attempt to delete whatever matches here.
%files backup_client
%defattr(0755,%{amanda_user},%{amanda_group})
%{SYSCONFDIR}/amanda
+++ /dev/null
-#
-# Copyright (C) 2005 Zmanda Incorporated.
-# All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 as published
-# by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Contact information: Zmanda Inc, 505 N Mathlida Ave, Suite 120
-# Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
-#
-
-
-%define build_srpm 0
-%{?srpm_only: %define build_srpm 1}
-
-# Pkg-config sometimes needs its own path set, and we need to allow users to
-# override our guess during detection. This macro takes care of that.
-# If no --define PKG_CONFIG_PATH was passed and env var $PKG_CONFIG_PATH is
-# set then use the env var.
-%{!?PKG_CONFIG_PATH: %{expand:%(echo ${PKG_CONFIG_PATH:+"%%define PKG_CONFIG_PATH $PKG_CONFIG_PATH"})}}
-
-%{?PKG_CONFIG_PATH:%{echo:PKG_CONFIG_PATH = %{PKG_CONFIG_PATH}}}
-
-# Define which Distribution we are building:
-# Try to detect the distribution we are building:
-%if %{_vendor} == redhat
- # Fedora symlinks /etc/fedora-release to /etc/redhat-release for at least
- # fc3-7. So RHEL and Fedora look at the same file. The awk trickery here
- # forces the field to be numeric so that the spec comparison works
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 3
- %define dist fedora
- %define disttag fc
- %define distver 3
- %endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print$4+0}' /etc/redhat-release) == 4
- %define dist fedora
- %define disttag fc
- %define distver 4
- %endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 5
- %define dist fedora
- %define disttag fc
- %define distver 5
- %endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $4+0}' /etc/redhat-release) == 6
- %define dist fedora
- %define disttag fc
- %define distver 6
- %endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $3+0}' /etc/redhat-release) == 7
- %define dist fedora
- %define disttag fc
- %define distver 7
- %endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Fedora" && %(awk '{print $3+0}' /etc/redhat-release) == 8
- %define dist fedora
- %define disttag fc
- %define distver 8
- # TODO: generalize this so that any platform can cross compile
- %if %{_host_cpu} == x86_64 && %{_target_cpu} == i686
- # Do nothing if PKG_CONFIG_PATH was set by the user above.
- %{!?PKG_CONFIG_PATH: %define PKG_CONFIG_PATH /usr/lib/pkgconfig}
- %endif
- %endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 3
- %define dist redhat
- %define disttag rhel
- %define distver 3
- %endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 4
- %define dist redhat
- %define disttag rhel
- %define distver 4
- %endif
- %if %(awk '{print $1}' /etc/redhat-release) == "Red" && %(awk '{print $7+0}' /etc/redhat-release) == 5
- %define dist redhat
- %define disttag rhel
- %define distver 5
- %endif
-%endif
-# Detect Suse variants. Suse gives us some nice macros in their rpms
-%if %{_vendor} == "suse"
- %if %{suse_version} == 910
- %define dist SuSE
- %define disttag sles
- %define distver 9
- %endif
- %if %{suse_version} == 1010
- %define dist SuSE
- %define disttag sles
- %define distver 10
- %endif
- %if %{suse_version} == 1000
- %define dist SuSE
- %define disttag suse
- %define distver 10
- %endif
-%endif
-
-# Set options per distribution
-%if %{dist} == redhat || %{dist} == fedora
- %define rpm_group Applications/Archiving
- %define xinetd_reload restart
-%endif
-%if %{dist} == SuSE
- %define rpm_group Productivity/Archiving/Backup
- %define xinetd_reload restart
-%endif
-
-%define packer %(%{__id_u} -n)
-
-# --- Definitions ---
-
-# Define amanda_version if it is not already defined.
-%{!?amanda_version: %define amanda_version 2.6.0p1}
-%{!?amanda_release: %define amanda_release 1}
-%define amanda_version_info "Amanda Community Edition - version %{amanda_version}"
-%define amanda_user amandabackup
-%define amanda_group disk
-%define udpportrange "700,740"
-%define tcpportrange "11000,11040"
-%define low_tcpportrange "700,710"
-
-Summary: The Amanda Backup and Archiving System
-Name: amanda
-Version: %{amanda_version}
-%define rpm_release %{amanda_release}.%{disttag}%{distver}
-%if %{build_srpm}
-%define rpm_release %{amanda_release}
-%endif
-Release: %{rpm_release}
-Source: %{name}-%{version}.tar.gz
-License: http://wiki.zmanda.com/index.php/Amanda_Copyright
-Vendor: Zmanda, Inc.
-Packager: www.zmanda.com
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%{packer}-buildroot
-Group: %{rpm_group}
-# TODO - Need required versions for these:
-BuildRequires: autoconf
-BuildRequires: automake
-BuildRequires: binutils
-BuildRequires: bison
-BuildRequires: flex
-BuildRequires: gcc
-BuildRequires: glibc >= 2.2.0
-BuildRequires: readline
-BuildRequires: curl >= 7.10.0
-Requires: /bin/awk
-Requires: /bin/date
-Requires: /usr/bin/id
-Requires: /sbin/ldconfig
-Requires: /bin/sh
-Requires: /usr/sbin/useradd
-Requires: /usr/sbin/usermod
-Requires: fileutils
-Requires: grep
-Requires: gnuplot
-Requires: libc.so.6
-Requires: libm.so.6
-Requires: libnsl.so.1
-Requires: curl >= 7.10.0
-Requires: xinetd
-Requires: perl >= 5.6.0
-Requires: tar >= 1.15
-%if %{dist} == redhat || %{dist}== fedora
-Requires: libtermcap.so.2
-Requires: initscripts
-%endif
-Provides: amanda-backup_client = %{amanda_version}, amanda-backup_server = %{amanda_version}
-
-%package backup_client
-Summary: The Amanda Backup and Archiving Client
-Group: %{rpm_group}
-Requires: /bin/awk
-Requires: fileutils
-Requires: grep
-%if %{dist} == redhat || %{dist}== fedora
-Requires: libtermcap.so.2
-Requires: initscripts
-%endif
-Requires: xinetd
-Requires: libc.so.6
-Requires: libm.so.6
-Requires: libnsl.so.1
-Requires: perl >= 5.6.0
-Requires: tar >= 1.15
-Provides: amanda-backup_client = %{amanda_version}
-Provides: libamclient-%{version}.so = %{amanda_version}
-Provides: libamanda-%{version}.so = %{amanda_version}
-Conflicts: amanda-backup_server
-
-%package backup_server
-Summary: The Amanda Backup and Archiving Server
-Group: %{rpm_group}
-Requires: /bin/awk
-Requires: fileutils
-Requires: grep
-Requires: libc.so.6
-Requires: libm.so.6
-Requires: libnsl.so.1
-%if %{dist} == redhat || %{dist}== fedora
-Requires: libtermcap.so.2
-Requires: initscripts
-%endif
-Requires: xinetd
-Requires: perl >= 5.6.0
-Requires: tar >= 1.15
-Provides: amanda-backup_server = %{amanda_version}
-Provides: libamclient-%{version}.so = %{amanda_version}
-Provides: libamanda-%{version}.so = %{amanda_version}
-Provides: libamserver-%{version}.so = %{amanda_version}
-Provides: librestore-%{version}.so = %{amanda_version}
-Provides: libamtape-%{version}.so = %{amanda_version}
-Provides: libamdevice-%{version}.so = %{amanda_version}
-
-# --- Package descriptions ---
-
-%description
-Amanda is the leading Open-Source Backup and Archiving software.
-
-The amanda-backup_server package should be installed on the Amanda server, i.e.
-the machine attached to backup media (such as a tape drive or disk
-drives) where backups will be written. The amanda-backup_server package
-includes Amanda client. The amanda-backup_client package needs
-to be installed on every system that is being backed up.
-
-Amanda Forums is located at: http://forums.zmanda.com/
-Amanda Documentation is available at: http://wiki.zmanda.com/
-
-
-
-%description backup_server
-Amanda is the leading Open-Source Backup and Archiving software.
-
-This package contains the Amanda server. The amanda-backup_server package
-should be installed on the Amanda server, i.e. the machine attached
-to backup media (such as a tape drive or disk drives) where backups
-will be written. The amanda-backup_server package includes Amanda client.
-
-Amanda Forums is located at: http://forums.zmanda.com/
-Amanda Documentation is available at: http://wiki.zmanda.com/
-
-
-
-%description backup_client
-Amanda is the leading Open-Source Backup and Archiving software.
-
-This package contains the Amanda client. The amanda-backup_client package
-needs to be installed on every system that is being backed up.
-
-Amanda Forums is located at: http://forums.zmanda.com/
-Amanda Documentation is available at: http://wiki.zmanda.com/
-
-# --- Directory setup ---
-
-# Configure directories:
-%define PREFIX /usr
-%define EPREFIX %{PREFIX}
-%define BINDIR %{EPREFIX}/bin
-%define SBINDIR %{EPREFIX}/sbin
-%define LIBEXECDIR %{EPREFIX}/libexec
-%define AMLIBEXECDIR %{LIBEXECDIR}/amanda
-%define DATADIR %{PREFIX}/share
-%define SYSCONFDIR /etc
-%define LOCALSTATEDIR /var
-%define AMANDAHOMEDIR %{LOCALSTATEDIR}/lib/amanda
-%ifarch x86_64
-%define LIBDIR %{EPREFIX}/lib64
-%else
-%define LIBDIR %{EPREFIX}/lib
-%endif
-%define AMLIBDIR %{LIBDIR}/amanda
-%define INCLUDEDIR %{PREFIX}/include
-%define MANDIR %{DATADIR}/man
-%define LOGDIR /var/log/amanda
-%define PERLSITELIB %(eval "`perl -V:installsitelib`"; echo $installsitelib)
-
-# Installation directories:
-%define ROOT_SBINDIR %{buildroot}/%{SBINDIR}
-%define ROOT_LIBEXECDIR %{buildroot}/%{LIBEXECDIR}
-%define ROOT_DATADIR %{buildroot}/%{DATADIR}
-%define ROOT_LOCALSTATEDIR %{buildroot}/%{LOCALSTATEDIR}
-%define ROOT_SYSCONFDIR %{buildroot}/%{SYSCONFDIR}
-%define ROOT_AMANDAHOMEDIR %{buildroot}/%{AMANDAHOMEDIR}
-%define ROOT_LIBDIR %{buildroot}/%{LIBDIR}
-%define ROOT_MANDIR %{buildroot}/%{MANDIR}
-%define ROOT_LOGDIR %{buildroot}/%{LOGDIR}
-
-# --- Unpack ---
-
-%prep
-%setup -q
-# --- Configure and compile ---
-
-%build
-%define config_user %{amanda_user}
-%define config_group %{amanda_group}
-
-%if %{disttag} == rhel && %{distver} == 3
-./configure \
- CFLAGS="%{optflags} -g" CXXFLAGS="%{optflags}" \
- --quiet \
- --prefix=%{PREFIX} \
- --sysconfdir=%{SYSCONFDIR} \
- --sharedstatedir=%{LOCALSTATEDIR} \
- --localstatedir=%{LOCALSTATEDIR} \
- --libdir=%{LIBDIR} \
- --includedir=%{INCLUDEDIR} \
- --with-gnuplot=/usr/bin/gnuplot \
- --with-gnutar=/bin/tar \
- --with-gnutar-listdir=%{AMANDAHOMEDIR}/gnutar-lists \
- --with-index-server=localhost \
- --with-tape-server=localhost \
- --with-user=%{config_user} \
- --with-group=%{config_group} \
- --with-owner=%{packer} \
- --with-fqdn \
- --with-bsd-security \
- --with-bsdtcp-security \
- --with-bsdudp-security \
- --with-ssh-security \
- --with-udpportrange=%{udpportrange} \
- --with-tcpportrange=%{tcpportrange} \
- --with-low-tcpportrange=%{low_tcpportrange} \
- --with-debugging=%{LOGDIR} \
- --with-assertions \
- --disable-installperms \
- --without-ipv6
-%else
-# This confusing macro results in PKG_CONFIG_PATH=some/path if some/path
-# was set on the command line, or by the platform detection bits.
-./configure \
- %{?PKG_CONFIG_PATH: PKG_CONFIG_PATH=%PKG_CONFIG_PATH} \
- CFLAGS="%{optflags} -g" CXXFLAGS="%{optflags}" \
- --quiet \
- --prefix=%{PREFIX} \
- --sysconfdir=%{SYSCONFDIR} \
- --sharedstatedir=%{LOCALSTATEDIR} \
- --localstatedir=%{LOCALSTATEDIR} \
- --libdir=%{LIBDIR} \
- --includedir=%{INCLUDEDIR} \
- --with-star=/usr/bin/star \
- --with-gnuplot=/usr/bin/gnuplot \
- --with-gnutar=/bin/tar \
- --with-gnutar-listdir=%{AMANDAHOMEDIR}/gnutar-lists \
- --with-index-server=localhost \
- --with-tape-server=localhost \
- --with-user=%{config_user} \
- --with-group=%{config_group} \
- --with-owner=%{packer} \
- --with-fqdn \
- --with-bsd-security \
- --with-bsdtcp-security \
- --with-bsdudp-security \
- --with-ssh-security \
- --with-udpportrange=%{udpportrange} \
- --with-tcpportrange=%{tcpportrange} \
- --with-low-tcpportrange=%{low_tcpportrange} \
- --with-debugging=%{LOGDIR} \
- --with-assertions \
- --disable-installperms
-%endif
-
-make
-
-# --- Install to buildroot ---
-
-%install
-if [ "%{buildroot}" != "/" ]; then
- if [ -d "%{buildroot}" ] ; then
- rm -rf %{buildroot}
- fi
-else
- echo "BuildRoot was somehow set to / !"
- exit -1
-fi
-
-make -j1 DESTDIR=%{buildroot} install
-
-rm -rf %{ROOT_DATADIR}/amanda
-rm -f %{ROOT_AMANDAHOMEDIR}/example/inetd.conf.amandaclient
-mkdir %{buildroot}/{etc,var/log}
-mkdir %{ROOT_LOCALSTATEDIR}/amanda
-mkdir %{ROOT_SYSCONFDIR}/amanda
-mkdir %{ROOT_AMANDAHOMEDIR}/gnutar-lists
-mkdir %{ROOT_LOGDIR}
-
-echo "%{amanda_version_info}" >%{ROOT_AMANDAHOMEDIR}/amanda-release
-
-# --- Clean up buildroot ---
-
-%clean
-if [ "%{buildroot}" != "/" ]; then
- if [ -d "%{buildroot}" ] ; then
- rm -rf %{buildroot}
- fi
-else
- echo "BuildRoot was somehow set to / !"
- exit -1
-fi
-
-# --- Pre/post (un)installation scripts ---
-
-%pre
-TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX`
-if [ $? -ne 0 ]; then
- echo "Unable to mktemp!" 1>&2
- exit 1
-fi
-LOGDIR="%{LOGDIR}"
-INSTALL_LOG="${LOGDIR}/install.log"
-INSTALL_ERR="${LOGDIR}/install.err"
-
-echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TMPFILE}
-
-# Check for the 'amanda' user
-echo "`date +'%b %e %Y %T'`: Checking for '%{amanda_user}' user..." >>${TMPFILE}
-if [ "`id -u %{amanda_user} > /dev/null 2>&1 && echo 0 || echo 1`" != "0" ] ; then
- useradd -c "Amanda" -M -g %{amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user}
- if [ %{dist} = "SuSE" ]; then
- PASSWD_EXIT=$?
- else
- # Lock the amanda account until admin sets password
- passwd -l %{amanda_user} >>/dev/null
- PASSWD_EXIT=$?
- fi
- if [ ${PASSWD_EXIT} -eq 0 ] ; then
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: The '%{amanda_user}; user account has been successfully created." >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Furthermore, the account has been automatically locked for you" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: for security purposes. Once a password for the '%{amanda_user}'" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: account has been set, the user can be unlocked by issuing" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: the following command as root.:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: # passwd -u %{amanda_user}" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: If this is not a new installation of Amanda and you have" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: pre-existing Amanda configurations in %{SYSCONFDIR}/amanda" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: you should ensure that 'dumpuser' is set to '%{amanda_user}'" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: in those configurations. Additionally, you should ensure" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: that %{AMANDAHOMEDIR}/.amandahosts on your client systems" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: is properly configured to allow connections for the user" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: '%{amanda_user}'." >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- PASSWD_OK=0
- else
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! The '%{amanda_user}' user account for this system has been !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! created, however the user has no password set. For !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! security purposes this account is normally locked !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! after creation. Unfortunately, when locking this !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! account an error occurred. To ensure the security !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! of your system you should set a password for the !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user account '%{amanda_user}' immediately! To set such a !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! password, please issue the following command.: !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! # passwd %{amanda_user} !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- PASSWD_OK=1
- fi
-else
- # log information about 'amanda' user parameters
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: The Amanda backup software is configured to operate as the" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: user '%{amanda_user}'. This user exists on your system and has not" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: been modified. To ensure that Amanda functions properly," >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: please see that the following parameters are set for that" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: user.:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: SHELL: /bin/sh" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: HOME: %{AMANDAHOMEDIR}" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Default group: %{amanda_group}" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Verifying %{amanda_user} parameters :" >>${TMPFILE}
-
- if [ "`id -gn %{amanda_user}`" != "disk" ] ; then
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' is not part of the disk group,Pl !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! make sure it is corrected before start using amanda !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: Verified group name of user 'amandabackup'" >>${TMPFILE}
- fi
-
- if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; then
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' default shell should be set to !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! /bin/sh, pl correct before start using Amanda !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: Verified Default shell for user 'amandabackup'" >>${TMPFILE}
- fi
-
- if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f6`" != "%{AMANDAHOMEDIR}" ] ; then
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' home directory should be set to !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! %{AMANDAHOMEDIR} Pl correct before using Amanda !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: Verified Default home directory for user amandabackup" >>${TMPFILE}
- fi
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- PASSWD_OK=0
-fi
-if [ -d %{AMANDAHOMEDIR} ] ; then
- echo -n "`date +'%b %e %Y %T'`: Checking ownership of '%{AMANDAHOMEDIR}'... " >>${TMPFILE}
- if [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[3]}'`" = "%{amanda_user}" ] && \
- [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[4]}'`" = "%{amanda_group}" ] ; then
- echo "correct." >>${TMPFILE}
- VARLIB_OK=0
- else
- echo "incorrect!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Please ensure that the directory '%{AMANDAHOMEDIR}' is owned by" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: the user '%{amanda_user}' and group '%{amanda_group}'." >>${TMPFILE}
- VARLIB_OK=1
- fi
-else
- VARLIB_OK=0
-fi
-echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
-if [ ! -e ${LOGDIR} ] ; then
- # create log directory
- mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1
- chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1
-elif [ ! -d ${LOGDIR} ] ; then
- mv ${LOGDIR} ${LOGDIR}.rpmsave >>${TMPFILE} 2>&1
- mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1
- chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1
- mv ${LOGDIR}.rpmsave ${LOGDIR}/ >>${TMPFILE} 2>&1
-fi
-
-if [ ${PASSWD_OK} -eq 1 ] || [ ${VARLIB_OK} -eq 1 ] ; then
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_ERR}
- echo "Please review '${INSTALL_ERR}' to correct errors which have prevented the Amanda installaton." >&2
- echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'."
- exit 1
-else
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-
-echo "`date +'%b %e %Y %T'`: === Amanda installation started. ===" >${TMPFILE}
-
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-if [ -f "${TMPFILE}" ]; then
- rm -f "${TMPFILE}"
-fi
-
-%post
-TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX
-if [ $? -ne 0 ]; then
- echo "Unable to mktemp!" 1>&2
- exit 1
-fi
-LOGDIR="%{LOGDIR}"
-INSTALL_LOG="${LOGDIR}/install.log"
-INSTALL_ERR="${LOGDIR}/install.err"
-
-echo -n "`date +'%b %e %Y %T'`: Updating library cache..." >${TMPFILE}
-/sbin/ldconfig >>${TMPFILE} 2>&1
-echo "done." >>${TMPFILE}
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then
- if [ ! -f /etc/xinetd.d/amandaserver ] ; then
- cp %{AMANDAHOMEDIR}/example/xinetd.amandaserver /etc/xinetd.d/amandaserver
- chmod 0644 /etc/xinetd.d/amandaserver >>${TMPFILE} 2>&1
- if [ -f /etc/xinetd.d/amandaclient ] ; then
- rm /etc/xinetd.d/amandaclient
- fi
- echo -n "`date +'%b %e %Y %T'`: Reloading xinetd configuration..." >${TMPFILE}
- if [ "%{xinetd_reload}" == "reload" ] ; then
- /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -ne 0 ] ; then
- echo -n "reload failed. Attempting restart..." >>${TMPFILE}
- /etc/init.d/xinetd restart >>${TMPFILE} 2>&1
- ret_val=$?
- fi
- else
- /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1
- ret_val=$?
- fi
- if [ ${ret_val} -eq 0 ] ; then
- echo "success." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
- else
- echo "failed. Please check your system logs." >>${TMPFILE}
- cat ${TMPFILE} 1>&2
- cat ${TMPFILE} >>${INSTALL_ERR}
- fi
- fi
-fi
-
-echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE}
-ret_val=0
-if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then
- touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE}
- fi
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE}
- chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
- chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
- if [ -x /sbin/restorecon ] ; then
- /sbin/restorecon %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
- fi
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-else
- echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_ERR}
-fi
-
-
-# Install .gnupg directory
-echo "`date +'%b %e %Y %T'`: Installing '%{AMANDAHOMEDIR}/.gnupg'." >${TMPFILE}
-ret_val=0
-if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then
- echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' will be created." >>${TMPFILE}
- mkdir %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' created successfully." >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' creation failed." >>${TMPFILE}
- fi
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE}
- chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -eq 0 ]; then
- chmod 700 %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
- ret_val=$?
- fi
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation successful." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-else
- echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation failed." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_ERR}
-fi
-
-# Install .amandahosts
-echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.amandahosts' file." >${TMPFILE}
-if [ ! -f %{AMANDAHOMEDIR}/.amandahosts ] ; then
- touch %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1
-fi
-for host in localhost localhost.localdomain ; do
- if [ -z "`grep \"^${host}[[:blank:]]\+root[[:blank:]]\+amindexd[[:blank:]]\+amidxtaped\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then
- echo "${host} root amindexd amidxtaped" >>%{AMANDAHOMEDIR}/.amandahosts
- fi
- if [ -z "`grep \"^${host}[[:blank:]]\+%{amanda_user}[[:blank:]]\+amdump\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then
- echo "${host} %{amanda_user} amdump" >>%{AMANDAHOMEDIR}/.amandahosts
- fi
-done
-chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1
-chmod 0600 %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-# SSH RSA key generation for amdump
-KEYDIR="%{AMANDAHOMEDIR}/.ssh"
-KEYFILE="id_rsa_amdump"
-COMMENT="%{amanda_user}@server"
-if [ ! -d ${KEYDIR} ] ; then
- if [ -f ${KEYDIR} ] ; then
- echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE}
- mv ${KEYDIR} ${KEYDIR}.rpmsave
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
- fi
- echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE}
- mkdir ${KEYDIR} >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then
- echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
- ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '${KEYDIR}' and '${KEYDIR}/${KEYFILE}*'" >${TMPFILE}
-chown %{amanda_user}:%{amanda_group} ${KEYDIR} ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1
-chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1
-chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-# SSH RSA key generation on client for amrecover
-KEYDIR="%{AMANDAHOMEDIR}/.ssh"
-KEYFILE="id_rsa_amrecover"
-COMMENT="root@client"
-if [ ! -d ${KEYDIR} ] ; then
- if [ -f ${KEYDIR} ] ; then
- echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE}
- mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
- fi
- echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE}
- mkdir ${KEYDIR} >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then
- echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE}
- ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-echo "`date +'%b %e %Y %T'`: Setting permissions for '${KEYDIR}'" >${TMPFILE}
-chown %{amanda_user}:%{amanda_group} ${KEYDIR} >>${TMPFILE} 2>&1
-chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1
-chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-# environment variables (~amandabackup/.profile)
-echo "`date +'%b %e %Y %T'`: Checking for '%{AMANDAHOMEDIR}/.profile' and ensuring correct environment." >${TMPFILE}
-if [ ! -f %{AMANDAHOMEDIR}/.profile ] ; then
- touch %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1
-fi
-if [ -z "`grep PATH %{AMANDAHOMEDIR}/.profile | grep '%{SBINDIR}'`" ] ; then
- echo "export PATH=\"\$PATH:%{SBINDIR}\"" >>%{AMANDAHOMEDIR}/.profile 2>>${TMPFILE}
-fi
-echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '%{AMANDAHOMEDIR}/.profile'" >>${TMPFILE}
-chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1
-chmod 0640 %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-echo "`date +'%b %e %Y %T'`: Sending anonymous distribution and version information to Zmanda" >> ${INSTALL_LOG}
-if [ -x /usr/bin/wget ]; then
- /usr/bin/wget -q -o /dev/null -O - --timeout=5 http://www.zmanda.com/amanda-tips.php\?version=%{amanda_version}\&os=%{disttag}%{distver}\&type=server
-fi
-
-echo "`date +'%b %e %Y %T'`: === Amanda installation complete. ===" >${TMPFILE}
-
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-if [ -f "${TMPFILE}" ]; then
- rm -f "${TMPFILE}"
-fi
-
-echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'."
-%postun
-/sbin/ldconfig
-%pre backup_server
-TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX`
-if [ $? -ne 0 ]; then
- echo "Unable to mktemp!" 1>&2
- exit 1
-fi
-
-LOGDIR="%{LOGDIR}"
-INSTALL_LOG="${LOGDIR}/install.log"
-INSTALL_ERR="${LOGDIR}/install.err"
-
-echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TMPFILE}
-
-# Check for the 'amanda' user
-echo "`date +'%b %e %Y %T'`: Checking for '%{amanda_user}' user..." >>${TMPFILE}
-if [ "`id -u %{amanda_user} > /dev/null 2>&1 && echo 0 || echo 1`" != "0" ] ; then
- useradd -c "Amanda" -M -g %{amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user}
- if [ %{dist} = "SuSE" ]; then
- PASSWD_EXIT=$?
- else
- # Lock the amanda account until admin sets password
- passwd -l %{amanda_user} >>/dev/null
- PASSWD_EXIT=$?
- fi
- if [ ${PASSWD_EXIT} -eq 0 ] ; then
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: The '%{amanda_user}; user account has been successfully created." >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Furthermore, the account has been automatically locked for you" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: for security purposes. Once a password for the '%{amanda_user}'" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: account has been set, the user can be unlocked by issuing" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: the following command as root.:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: # passwd -u %{amanda_user}" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: If this is not a new installation of Amanda and you have" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: pre-existing Amanda configurations in %{SYSCONFDIR}/amanda" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: you should ensure that 'dumpuser' is set to '%{amanda_user}'" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: in those configurations. Additionally, you should ensure" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: that %{AMANDAHOMEDIR}/.amandahosts on your client systems" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: is properly configured to allow connections for the user" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: '%{amanda_user}'." >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- PASSWD_OK=0
- else
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! The '%{amanda_user}' user account for this system has been !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! created, however the user has no password set. For !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! security purposes this account is normally locked !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! after creation. Unfortunately, when locking this !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! account an error occurred. To ensure the security !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! of your system you should set a password for the !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user account '%{amanda_user}' immediately! To set such a !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! password, please issue the following command.: !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! # passwd %{amanda_user} !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- PASSWD_OK=1
- fi
-else
- # log information about 'amanda' user parameters
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: The Amanda backup software is configured to operate as the" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: user '%{amanda_user}'. This user exists on your system and has not" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: been modified. To ensure that Amanda functions properly," >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: please see that the following parameters are set for that" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: user.:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: SHELL: /bin/sh" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: HOME: %{AMANDAHOMEDIR}" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Default group: %{amanda_group}" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Verifying %{amanda_user} parameters :" >>${TMPFILE}
-
- if [ "`id -gn %{amanda_user}`" != "disk" ] ; then
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' is not part of the disk group,Pl !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! make sure it is corrected before start using Amanda !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: Verified group name of user 'amandabackup'" >>${TMPFILE}
- fi
-
- if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; then
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' default shell should be set to !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! /bin/sh, pl correct before start using Amanda !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: Verified Default shell for user 'amandabackup'" >>${TMPFILE}
- fi
-
- if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f6`" != "%{AMANDAHOMEDIR}" ] ; then
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' home directory should be set to !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! %{AMANDAHOMEDIR} Pl correct before using Amanda !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: Verified Default home directory for user amandabackup" >>${TMPFILE}
- fi
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- PASSWD_OK=0
-fi
-if [ -d %{AMANDAHOMEDIR} ] ; then
- echo -n "`date +'%b %e %Y %T'`: Checking ownership of '%{AMANDAHOMEDIR}'... " >>${TMPFILE}
- if [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[3]}'`" = "%{amanda_user}" ] && \
- [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[4]}'`" = "%{amanda_group}" ] ; then
- echo "correct." >>${TMPFILE}
- VARLIB_OK=0
- else
- echo "incorrect!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Please ensure that the directory '%{AMANDAHOMEDIR}' is owned by" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: the user '%{amanda_user}' and group '%{amanda_group}'." >>${TMPFILE}
- VARLIB_OK=1
- fi
-else
- VARLIB_OK=0
-fi
-echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
-
-if [ ! -e ${LOGDIR} ] ; then
- # create log directory
- mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1
- chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1
-elif [ ! -d ${LOGDIR} ] ; then
- mv ${LOGDIR} ${LOGDIR}.rpmsave >>${TMPFILE} 2>&1
- mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1
- chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1
- mv ${LOGDIR}.rpmsave ${LOGDIR}/ >>${TMPFILE} 2>&1
-fi
-if [ ${PASSWD_OK} -eq 1 ] || [ ${VARLIB_OK} -eq 1 ] ; then
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_ERR}
- echo "Please review '${INSTALL_ERR}' to correct errors which have prevented the Amanda installaton." >&2
- echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'."
- exit 1
-else
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-
-echo "`date +'%b %e %Y %T'`: === Amanda backup server installation started. ===" >${TMPFILE}
-
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-if [ -f "${TMPFILE}" ]; then
- rm -f "${TMPFILE}"
-fi
-%post backup_server
-TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX`
-if [ $? -ne 0 ]; then
- echo "Unable to mktemp!" 1>&2
- exit 1
-fi
-LOGDIR="%{LOGDIR}"
-INSTALL_LOG="${LOGDIR}/install.log"
-INSTALL_ERR="${LOGDIR}/install.err"
-
-echo -n "`date +'%b %e %Y %T'`: Updating system library cache..." >${TMPFILE}
-/sbin/ldconfig
-echo "done." >>${TMPFILE}
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then
- if [ ! -f /etc/xinetd.d/amandaserver ] ; then
- cp %{AMANDAHOMEDIR}/example/xinetd.amandaserver /etc/xinetd.d/amandaserver
- chmod 0644 /etc/xinetd.d/amandaserver >>${TMPFILE} 2>&1
- if [ -f /etc/xinetd.d/amandaclient ] ; then
- rm /etc/xinetd.d/amandaclient
- fi
-
- echo -n "`date +'%b %e %Y %T'`: Reloading xinetd configuration..." >${TMPFILE}
- if [ "%{xinetd_reload}" == "reload" ] ; then
- /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -ne 0 ] ; then
- echo -n "reload failed. Attempting restart..." >>${TMPFILE}
- /etc/init.d/xinetd restart >>${TMPFILE} 2>&1
- ret_val=$?
- fi
- else
- /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1
- ret_val=$?
- fi
- if [ ${ret_val} -eq 0 ] ; then
- echo "success." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
- else
- echo "failed. Please check your system logs." >>${TMPFILE}
- cat ${TMPFILE} 1>&2
- cat ${TMPFILE} >>${INSTALL_ERR}
- fi
- fi
-fi
-
-echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE}
-ret_val=0
-if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then
- touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE}
- fi
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE}
- chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
- chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-else
- echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_ERR}
-fi
-
-# Install .amandahosts to server
-echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.amandahosts' file." >${TMPFILE}
-if [ ! -f %{AMANDAHOMEDIR}/.amandahosts ] ; then
- touch %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1
-fi
-for host in localhost localhost.localdomain ; do
- if [ -z "`grep \"^${host}[[:blank:]]\+root[[:blank:]]\+amindexd[[:blank:]]\+amidxtaped\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then
- echo "${host} root amindexd amidxtaped" >>%{AMANDAHOMEDIR}/.amandahosts
- fi
- if [ -z "`grep \"^${host}[[:blank:]]\+%{amanda_user}[[:blank:]]\+amdump\" %{AMANDAHOMEDIR}/.amandahosts`" ] ; then
- echo "${host} %{amanda_user} amdump" >>%{AMANDAHOMEDIR}/.amandahosts
- fi
-done
-chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1
-chmod 0600 %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-# Install amanda client configuration file
-echo "`date +'%b %e %Y %T'`: Checking '%{SYSCONFDIR}/amanda/amanda-client.conf' file." >${TMPFILE}
-if [ ! -f %{SYSCONFDIR}/amanda/amanda-client.conf ] ; then
- cp %{AMANDAHOMEDIR}/example/amanda-client.conf %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1
-fi
-chown %{amanda_user}:%{amanda_group} %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1
-chmod 0600 %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-# install am_passphrase file to server
-echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.am_passphrase' file." >${TMPFILE}
-if [ ! -f %{AMANDAHOMEDIR}/.am_passphrase ] ; then
- echo "`date +'%b %e %Y %T'`: Create '%{AMANDAHOMEDIR}/.am_passphrase' file." >${TMPFILE}
- touch %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1
- phrase=`echo "amandabackup" | md5sum | awk '{print $1}'`
- echo ${phrase} >>%{AMANDAHOMEDIR}/.am_passphrase
-
- chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1
- chmod 0700 %{AMANDAHOMEDIR}/.am_passphrase >>${TMPFILE} 2>&1
-fi
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-# Install .gnupg directory
-echo "`date +'%b %e %Y %T'`: Installing '%{AMANDAHOMEDIR}/.gnupg'." >${TMPFILE}
-ret_val=0
-if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then
- echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' will be created." >>${TMPFILE}
- mkdir %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' created successfully." >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' creation failed." >>${TMPFILE}
- fi
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE}
- chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -eq 0 ]; then
- chmod 700 %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
- ret_val=$?
- fi
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation successful." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-else
- echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation failed." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_ERR}
-fi
-
-# SSH RSA key generation on server for amdump
-KEYDIR="%{AMANDAHOMEDIR}/.ssh"
-KEYFILE="id_rsa_amdump"
-COMMENT="%{amanda_user}@server"
-if [ ! -d ${KEYDIR} ] ; then
- if [ -f ${KEYDIR} ] ; then
- echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE}
- mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
- fi
- echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE}
- mkdir ${KEYDIR} >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then
- echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE}
- ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '${KEYDIR}' and '${KEYDIR}/${KEYFILE}*'" >${TMPFILE}
-chown %{amanda_user}:%{amanda_group} ${KEYDIR} ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1
-chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1
-chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-# SSH RSA key generation on client for amrecover
-KEYDIR="%{AMANDAHOMEDIR}/.ssh"
-KEYFILE="id_rsa_amrecover"
-COMMENT="root@client"
-if [ ! -d ${KEYDIR} ] ; then
- if [ -f ${KEYDIR} ] ; then
- echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE}
- mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
- fi
- echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE}
- mkdir ${KEYDIR} >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then
- echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE}
- ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '${KEYDIR}'" >${TMPFILE}
-chown %{amanda_user}:%{amanda_group} ${KEYDIR} >>${TMPFILE} 2>&1
-chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1
-chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-# environment variables (~amandabackup/.profile)
-echo "`date +'%b %e %Y %T'`: Checking for '%{AMANDAHOMEDIR}/.profile' and ensuring correct environment." >${TMPFILE}
-if [ ! -f %{AMANDAHOMEDIR}/.profile ] ; then
- touch %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1
-fi
-if [ -z "`grep PATH %{AMANDAHOMEDIR}/.profile | grep '%{SBINDIR}'`" ] ; then
- echo "export PATH=\"\$PATH:%{SBINDIR}\"" >>%{AMANDAHOMEDIR}/.profile 2>>${TMPFILE}
-fi
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '%{AMANDAHOMEDIR}/.profile'" >${TMPFILE}
-chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1
-chmod 0640 %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-echo "`date +'%b %e %Y %T'`: Sending anonymous distribution and version information to Zmanda" >> ${INSTALL_LOG}
-if [ -x /usr/bin/wget ]; then
- /usr/bin/wget -q -o /dev/null -O - --timeout=5 http://www.zmanda.com/amanda-tips.php\?version=%{amanda_version}\&os=%{disttag}%{distver}\&type=server
-fi
-
-echo "`date +'%b %e %Y %T'`: === Amanda backup server installation complete. ===" >${TMPFILE}
-
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-if [ -f "${TMPFILE}" ]; then
- rm -f "${TMPFILE}" >>${TMPFILE} 2>&1
-fi
-
-echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'."
-%postun backup_server
-/sbin/ldconfig
-%pre backup_client
-TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX`
-if [ $? -ne 0 ]; then
- echo "Unable to mktemp!" 1>&2
- exit 1
-fi
-LOGDIR="%{LOGDIR}"
-INSTALL_LOG="${LOGDIR}/install.log"
-INSTALL_ERR="${LOGDIR}/install.err"
-
-echo "`date +'%b %e %Y %T'`: Preparing to install: %{amanda_version_info}" >${TMPFILE}
-
-# Check for the 'amanda' user
-echo "`date +'%b %e %Y %T'`: Checking for '%{amanda_user}' user..." >>${TMPFILE}
-if [ "`id -u %{amanda_user} > /dev/null 2>&1 && echo 0 || echo 1`" != "0" ] ; then
- useradd -c "Amanda" -M -g %{amanda_group} -d %{AMANDAHOMEDIR} -s /bin/sh %{amanda_user} >>${TMPFILE} 2>&1
- if [ %{dist} = "SuSE" ]; then
- PASSWD_EXIT=$?
- else
- # Lock the amanda account until admin sets password
- passwd -l %{amanda_user} >>/dev/null
- PASSWD_EXIT=$?
- fi
- if [ ${PASSWD_EXIT} -eq 0 ] ; then
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: The '%{amanda_user}; user account has been successfully created." >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Furthermore, the account has been automatically locked for you" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: for security purposes. Once a password for the '%{amanda_user}'" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: account has been set, the user can be unlocked by issuing" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: the following command as root.:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: # passwd -u %{amanda_user}" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: If this is not a new installation of Amanda and you have" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: pre-existing Amanda configurations in %{SYSCONFDIR}/amanda" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: you should ensure that 'dumpuser' is set to '%{amanda_user}'" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: in those configurations. Additionally, you should ensure" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: that %{AMANDAHOMEDIR}/.amandahosts on your client systems" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: is properly configured to allow connections for the user" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: '%{amanda_user}'." >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- PASSWD_OK=0
- else
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! The '%{amanda_user}' user account for this system has been !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! created, however the user has no password set. For !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! security purposes this account is normally locked !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! after creation. Unfortunately, when locking this !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! account an error occurred. To ensure the security !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! of your system you should set a password for the !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user account '%{amanda_user}' immediately! To set such a !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! password, please issue the following command.: !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! # passwd %{amanda_user} !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- PASSWD_OK=1
- fi
-else
- # log information about 'amanda' user parameters
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: The Amanda backup software is configured to operate as the" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: user '%{amanda_user}'. This user exists on your system and has not" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: been modified. To ensure that Amanda functions properly," >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: please see that the following parameters are set for that" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: user.:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: SHELL: /bin/sh" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: HOME: %{AMANDAHOMEDIR}" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Default group: %{amanda_group}" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Verifying %{amanda_user} parameters :" >>${TMPFILE}
-
- if [ "`id -gn %{amanda_user}`" != "disk" ] ; then
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' is not part of the disk group,Pl !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! make sure it is corrected before start using Amanda !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: Verified group name of user 'amandabackup'" >>${TMPFILE}
- fi
-
- if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f7`" != "/bin/sh" ] ; then
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' default shell should be set to !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! /bin/sh, pl correct before start using Amanda !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: Verified Default shell for user 'amandabackup'" >>${TMPFILE}
- fi
-
- if [ "`grep ^%{amanda_user} /etc/passwd|cut -d: -f6`" != "%{AMANDAHOMEDIR}" ] ; then
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! user 'amandabackup' home directory should be set to !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! %{AMANDAHOMEDIR} Pl correct before using Amanda !!!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: !!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!" >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: Verified Default home directory for user amandabackup" >>${TMPFILE}
- fi
- echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
- PASSWD_OK=0
-fi
-if [ -d %{AMANDAHOMEDIR} ] ; then
- echo -n "`date +'%b %e %Y %T'`: Checking ownership of '%{AMANDAHOMEDIR}'... " >>${TMPFILE}
- if [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[3]}'`" = "%{amanda_user}" ] && \
- [ "`ls -dl %{AMANDAHOMEDIR} | awk '//{split($_,x); print x[4]}'`" = "%{amanda_group}" ] ; then
- echo "correct." >>${TMPFILE}
- VARLIB_OK=0
- else
- echo "incorrect!" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: Please ensure that the directory '%{AMANDAHOMEDIR}' is owned by" >>${TMPFILE}
- echo "`date +'%b %e %Y %T'`: the user '%{amanda_user}' and group '%{amanda_group}'." >>${TMPFILE}
- VARLIB_OK=1
- fi
-else
- VARLIB_OK=0
-fi
-echo "`date +'%b %e %Y %T'`:" >>${TMPFILE}
-
-if [ ! -e ${LOGDIR} ] ; then
- # create log directory
- mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1
- chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1
-elif [ ! -d ${LOGDIR} ] ; then
- mv ${LOGDIR} ${LOGDIR}.rpmsave >>${TMPFILE} 2>&1
- mkdir -m 0750 ${LOGDIR} >>${TMPFILE} 2>&1
- chown %{amanda_user}:%{amanda_group} ${LOGDIR} >>${TMPFILE} 2>&1
- mv ${LOGDIR}.rpmsave ${LOGDIR}/ >>${TMPFILE} 2>&1
-fi
-if [ ${PASSWD_OK} -eq 1 ] || [ ${VARLIB_OK} -eq 1 ] ; then
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_ERR}
- echo "Please review '${INSTALL_ERR}' to correct errors which have prevented the Amanda installaton." >&2
- echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'."
- exit 1
-else
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-
-echo "`date +'%b %e %Y %T'`: === Amanda backup client installation started. ===" >${TMPFILE}
-
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-if [ -f "${TMPFILE}" ]; then
- rm -f "${TMPFILE}"
-fi
-
-%post backup_client
-TMPFILE=`mktemp /tmp/rpm-amanda.XXXXXXXXXXX`
-if [ $? -ne 0 ]; then
- echo "Unable to mktemp!" 1>&2
- exit 1
-fi
-LOGDIR="%{LOGDIR}"
-INSTALL_LOG="${LOGDIR}/install.log"
-INSTALL_ERR="${LOGDIR}/install.err"
-
-echo -n "`date +'%b %e %Y %T'`: Updating system library cache..." >${TMPFILE}
-/sbin/ldconfig
-echo "done." >>${TMPFILE}
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-if [ -e /etc/xinetd.d ] && [ -d /etc/xinetd.d ] ; then
- if [ ! -f /etc/xinetd.d/amandaclient ] ; then
- cp %{AMANDAHOMEDIR}/example/xinetd.amandaclient /etc/xinetd.d/amandaclient
-
- echo -n "`date +'%b %e %Y %T'`: Reloading xinetd configuration..." >${TMPFILE}
- if [ "%{xinetd_reload}" == "reload" ] ; then
- /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -ne 0 ] ; then
- echo -n "reload failed. Attempting restart..." >>${TMPFILE}
- /etc/init.d/xinetd restart >>${TMPFILE} 2>&1
- ret_val=$?
- fi
- else
- /etc/init.d/xinetd %{xinetd_reload} >>${TMPFILE} 2>&1
- ret_val=$?
- fi
- if [ ${ret_val} -eq 0 ] ; then
- echo "success." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
- else
- echo "failed. Please check your system logs." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
- fi
- fi
-fi
-
-echo "`date +'%b %e %Y %T'`: Installing '%{LOCALSTATEDIR}/amanda/amandates'." >${TMPFILE}
-ret_val=0
-if [ ! -f %{LOCALSTATEDIR}/amanda/amandates ] ; then
- touch %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: The file '%{LOCALSTATEDIR}/amanda/amandates' has been created." >>${TMPFILE}
- fi
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{LOCALSTATEDIR}/amanda/amandates'." >>${TMPFILE}
- chown %{amanda_user}:%{amanda_group} %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
- chmod 0640 %{LOCALSTATEDIR}/amanda/amandates >>${TMPFILE} 2>&1
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation successful." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-else
- echo "`date +'%b %e %Y %T'`: '%{LOCALSTATEDIR}/amanda/amandates' Installation failed." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_ERR}
-fi
-
-# Install .amandahosts to client
-echo "`date +'%b %e %Y %T'`: Checking '%{AMANDAHOMEDIR}/.amandahosts' file." >${TMPFILE}
-if [ ! -f %{AMANDAHOMEDIR}/.amandahosts ] ; then
- touch %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1
-fi
-for host in localhost localhost.localdomain ; do
- if [ -z "`grep \"^${host}[[:blank:]]\+\" %{AMANDAHOMEDIR}/.amandahosts | grep \"[[:blank:]]\+%{amanda_user}[[:blank:]]\+amdump\"`" ] ; then
- echo "${host} %{amanda_user} amdump" >>%{AMANDAHOMEDIR}/.amandahosts
- fi
-done
-chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1
-chmod 0600 %{AMANDAHOMEDIR}/.amandahosts >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-# Install amanda client configuration file
-echo "`date +'%b %e %Y %T'`: Checking '%{SYSCONFDIR}/amanda/amanda-client.conf' file." >${TMPFILE}
-if [ ! -f %{SYSCONFDIR}/amanda/amanda-client.conf ] ; then
- cp %{AMANDAHOMEDIR}/example/amanda-client.conf %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1
-fi
-chown %{amanda_user}:%{amanda_group} %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1
-chmod 0600 %{SYSCONFDIR}/amanda/amanda-client.conf >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-# Install .gnupg directory
-echo "`date +'%b %e %Y %T'`: Installing '%{AMANDAHOMEDIR}/.gnupg'." >${TMPFILE}
-ret_val=0
-if [ ! -d %{AMANDAHOMEDIR}/.gnupg ] ; then
- echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' will be created." >>${TMPFILE}
- mkdir %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' created successfully." >>${TMPFILE}
- else
- echo "`date +'%b %e %Y %T'`: The directory '%{AMANDAHOMEDIR}/.gnupg' creation failed." >>${TMPFILE}
- fi
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: Ensuring correct permissions for '%{SYSCONFDIR}/.gnupg'." >>${TMPFILE}
- chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
- ret_val=$?
- if [ ${ret_val} -eq 0 ]; then
- chmod 700 %{AMANDAHOMEDIR}/.gnupg >>${TMPFILE} 2>&1
- ret_val=$?
- fi
-fi
-if [ ${ret_val} -eq 0 ]; then
- echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation successful." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-else
- echo "`date +'%b %e %Y %T'`: '%{AMANDAHOMEDIR}/.gnupg' Installation failed." >>${TMPFILE}
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_ERR}
-fi
-
-# SSH RSA key generation on client for amrecover
-KEYDIR="%{AMANDAHOMEDIR}/.ssh"
-KEYFILE="id_rsa_amrecover"
-COMMENT="root@client"
-if [ ! -d ${KEYDIR} ] ; then
- if [ -f ${KEYDIR} ] ; then
- echo "`date +'%b %e %Y %T'`: Directory '${KEYDIR}' exists as a file. Renaming to '${KEYDIR}.rpmsave'." >${TMPFILE}
- mv ${KEYDIR} ${KEYDIR}.rpmsave >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
- fi
- echo "`date +'%b %e %Y %T'`: Creating directory '${KEYDIR}'." >${TMPFILE}
- mkdir ${KEYDIR} >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-if [ ! -f ${KEYDIR}/${KEYFILE} ] ; then
- echo "`date +'%b %e %Y %T'`: Creating ssh RSA key in '${KEYDIR}/${KEYFILE}'" >${TMPFILE}
- ssh-keygen -q -C $COMMENT -t rsa -f ${KEYDIR}/${KEYFILE} -N '' >>${TMPFILE} 2>&1
- cat ${TMPFILE}
- cat ${TMPFILE} >>${INSTALL_LOG}
-fi
-echo "`date +'%b %e %Y %T'`: Setting permissions for '${KEYDIR}' and '${KEYDIR}/${KEYFILE}*'" >${TMPFILE}
-chown %{amanda_user}:%{amanda_group} ${KEYDIR} >>${TMPFILE} 2>&1
-chmod 0750 ${KEYDIR} >>${TMPFILE} 2>&1
-chmod 0600 ${KEYDIR}/${KEYFILE}* >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-# environment variables (~amandabackup/.profile)
-echo "`date +'%b %e %Y %T'`: Checking for '%{AMANDAHOMEDIR}/.profile' and ensuring correct environment." >${TMPFILE}
-if [ ! -f %{AMANDAHOMEDIR}/.profile ] ; then
- touch %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1
-fi
-if [ -z "`grep PATH %{AMANDAHOMEDIR}/.profile | grep '%{SBINDIR}'`" ] ; then
- echo "export PATH=\"\$PATH:%{SBINDIR}\"" >>%{AMANDAHOMEDIR}/.profile 2>>${TMPFILE}
-fi
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-echo "`date +'%b %e %Y %T'`: Setting ownership and permissions for '%{AMANDAHOMEDIR}/.profile'" >${TMPFILE}
-chown %{amanda_user}:%{amanda_group} %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1
-chmod 0640 %{AMANDAHOMEDIR}/.profile >>${TMPFILE} 2>&1
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-echo "`date +'%b %e %Y %T'`: Sending anonymous distribution and version information to Zmanda" >> ${INSTALL_LOG}
-if [ -x /usr/bin/wget ]; then
- /usr/bin/wget -q -o /dev/null -O - --timeout=5 http://www.zmanda.com/amanda-tips.php\?version=%{amanda_version}\&os=%{disttag}%{distver}\&type=client
-fi
-
-echo "`date +'%b %e %Y %T'`: === Amanda backup client installation complete. ===" >>${TMPFILE}
-cat ${TMPFILE}
-cat ${TMPFILE} >>${INSTALL_LOG}
-
-if [ -f "${TMPFILE}" ]; then
- rm -f "${TMPFILE}"
-fi
-
-echo "Amanda installation log can be found in '${INSTALL_LOG}' and errors (if any) in '${INSTALL_ERR}'."
-%postun backup_client
-/sbin/ldconfig
-
-# --- Files to install ---
-
-%files backup_client
-%defattr(0755,%{amanda_user},%{amanda_group})
-%{SYSCONFDIR}/amanda
-%{AMANDAHOMEDIR}
-%{AMLIBEXECDIR}
-%{AMLIBDIR}
-%{AMLIBEXECDIR}/amanda-sh-lib.sh
-%{LOCALSTATEDIR}/amanda
-%defattr(4750,root,disk)
-%{AMLIBEXECDIR}/calcsize
-%{AMLIBEXECDIR}/killpgrp
-%{AMLIBEXECDIR}/rundump
-%{AMLIBEXECDIR}/runtar
-%defattr(0750,%{amanda_user},%{amanda_group})
-%{LOGDIR}
-%{SBINDIR}/amaespipe
-%{SBINDIR}/amcryp*
-%{SBINDIR}/amgpgcrypt
-%{SBINDIR}/amoldrecover
-%{SBINDIR}/amrecover
-%defattr(0644,%{amanda_user},%{amanda_group})
-%docdir %{MANDIR}
-%{MANDIR}/man5/amanda.conf.5.gz
-%{MANDIR}/man5/amanda-client.conf.5.gz
-%{MANDIR}/man8/amanda.8.gz
-%{MANDIR}/man8/amcheckdump.8.gz
-%{MANDIR}/man8/amrecover.8.gz
-%{AMLIBEXECDIR}/amcat.awk
-%{AMANDAHOMEDIR}/amanda-release
-%{AMANDAHOMEDIR}/example/xinetd.amandaclient
-%{AMANDAHOMEDIR}/example/amanda-client.conf
-
-%files backup_server
-%defattr(0755,%{amanda_user},%{amanda_group})
-%{SYSCONFDIR}/amanda
-%{AMLIBEXECDIR}
-%{AMLIBDIR}
-%{PERLSITELIB}/Amanda
-%{PERLSITELIB}/auto/Amanda
-%{AMANDAHOMEDIR}
-%{LOCALSTATEDIR}/amanda
-%{SBINDIR}/amaddclient
-%{SBINDIR}/amadmin
-%{SBINDIR}/amcheckdb
-%{SBINDIR}/amcheckdump
-%{SBINDIR}/amcleanup
-%{SBINDIR}/amdd
-%{SBINDIR}/amdevcheck
-%{SBINDIR}/amdump
-%{SBINDIR}/amfetchdump
-%{SBINDIR}/amflush
-%{SBINDIR}/amgetconf
-%{SBINDIR}/amlabel
-%{SBINDIR}/ammt
-%{SBINDIR}/amoverview
-%{SBINDIR}/amplot
-%{SBINDIR}/amreport
-%{SBINDIR}/amrestore
-%{SBINDIR}/amrmtape
-%{SBINDIR}/amserverconfig
-%{SBINDIR}/amstatus
-%{SBINDIR}/amtape
-%{SBINDIR}/amtapetype
-%{SBINDIR}/amtoc
-%{SBINDIR}/amverify
-%{SBINDIR}/amverifyrun
-%{AMLIBEXECDIR}/amanda-sh-lib.sh
-%defattr(4750,root,disk)
-%{AMLIBEXECDIR}/calcsize
-%{AMLIBEXECDIR}/killpgrp
-%{AMLIBEXECDIR}/rundump
-%{AMLIBEXECDIR}/runtar
-%{AMLIBEXECDIR}/dumper
-%{AMLIBEXECDIR}/planner
-%{SBINDIR}/amcheck
-%defattr(0750,%{amanda_user},%{amanda_group})
-%{LOGDIR}
-%{SBINDIR}/amaespipe
-%{SBINDIR}/amcrypt
-%{SBINDIR}/amcrypt-ossl
-%{SBINDIR}/amcrypt-ossl-asym
-%{SBINDIR}/amcryptsimple
-%{SBINDIR}/amgpgcrypt
-%{SBINDIR}/amoldrecover
-%{SBINDIR}/amrecover
-%defattr(0644,%{amanda_user},%{amanda_group})
-%{AMLIBEXECDIR}/amcat.awk
-%{AMLIBEXECDIR}/amplot.awk
-%{AMLIBEXECDIR}/amplot.g
-%{AMLIBEXECDIR}/amplot.gp
-%docdir %{MANDIR}
-%{MANDIR}/man5/amanda.conf.5.gz
-%{MANDIR}/man5/amanda-client.conf.5.gz
-%{MANDIR}/man8/amaddclient.8.gz
-%{MANDIR}/man8/amadmin.8.gz
-%{MANDIR}/man8/amanda.8.gz
-%{MANDIR}/man8/amcheck.8.gz
-%{MANDIR}/man8/amcheckdb.8.gz
-%{MANDIR}/man8/amcheckdump.8.gz
-%{MANDIR}/man8/amcleanup.8.gz
-%{MANDIR}/man8/amdd.8.gz
-%{MANDIR}/man8/amdump.8.gz
-%{MANDIR}/man8/amfetchdump.8.gz
-%{MANDIR}/man8/amflush.8.gz
-%{MANDIR}/man8/amgetconf.8.gz
-%{MANDIR}/man8/amlabel.8.gz
-%{MANDIR}/man8/ammt.8.gz
-%{MANDIR}/man8/amoverview.8.gz
-%{MANDIR}/man8/amplot.8.gz
-%{MANDIR}/man8/amrecover.8.gz
-%{MANDIR}/man8/amreport.8.gz
-%{MANDIR}/man8/amrestore.8.gz
-%{MANDIR}/man8/amrmtape.8.gz
-%{MANDIR}/man8/amserverconfig.8.gz
-%{MANDIR}/man8/amstatus.8.gz
-%{MANDIR}/man8/amtape.8.gz
-%{MANDIR}/man8/amtapetype.8.gz
-%{MANDIR}/man8/amtoc.8.gz
-%{MANDIR}/man8/amverify.8.gz
-%{MANDIR}/man8/amverifyrun.8.gz
-%{MANDIR}/man8/amcrypt.8.gz
-%{MANDIR}/man8/amcrypt-ossl.8.gz
-%{MANDIR}/man8/amcrypt-ossl-asym.8.gz
-%{MANDIR}/man8/amcryptsimple.8.gz
-%{MANDIR}/man8/amgpgcrypt.8.gz
-%{MANDIR}/man8/amaespipe.8.gz
-%{MANDIR}/man8/amdevcheck.8.gz
-%{AMANDAHOMEDIR}/amanda-release
-%{AMANDAHOMEDIR}/example/amanda-client.conf
-%{AMANDAHOMEDIR}/example/xinetd.amandaserver
-
-# --- ChangeLog
-
-%changelog
-* Fri May 02 2008 Dan Locks <dwlocks at zmanda dot com>
-- Changed instances of ${ to %%{ where applicable
-* Tue Mar 11 2008 Dan Locks <dwlocks at zmanda dot com>
-- fixed many rpmlint complaints
-- added --quiet to configure statements
-- moved PERLSITELIB to definitions section
-* Wed Feb 13 2008 Dan Locks <dwlocks at zmanda dot com>
-- added an environment check for PKG_CONFIG_PATH
-- added PKG_CONFIG_PATH conditional to handle cross comp on FC8 (environment
- var is used if provided)
-* Fri Feb 01 2008 Dan Locks <dwlocks at zmanda dot com>
-- Removed amplot executable and manpages from client installation
-- Added amcheckdump.8 manpage
-- Fixed %%{LOCALSTATEDIR}/amanda dir creation.
-* Wed Jan 23 2008 Dan Locks <dwlocks at zmanda dot com>
-- Change %%{SYSCONFDIR}/amanda/amandates to %%{LOCALSTATEDIR}/amanda/amandates,
- and added %%{LOCALSTATEDIR}/amanda to the files lists.
-* Mon Jan 14 2008 Dan Locks <dwlocks at zmanda dot com>
-- Updates for perlified amanda, file location moves, gpg setup.
-* Tue Nov 13 2007 Paddy Sreenivasan <paddy at zmanda dot com>
-- Added SYSCONFDIR to client rpm
-- Set xinetd and amanda-client.conf configuration files as part of postinstall
-* Thu Nov 8 2007 Dan Locks <dwlocks at zmanda dot com>
-- Added Linux distribution detection
-* Wed Nov 7 2007 Paddy Sreenivasan <paddy at zmanda dot com>
-- Added amserverconfig, amaddclient, amgpgcrypt, amcryptsimple and libamdevice.
-- Added amanda configuration template files
-* Fri Sep 21 2007 Paddy Sreenivasan <paddy at zmanda dot com>
-- Remove libamserver, libamtape from client rpm
-* Wed Sep 19 2007 Paddy Sreenivasan <paddy at zmanda dot com>
-- Added Fedora 7
-* Tue Jun 26 2007 Kevin Till <ktill at zmanda dot com>
-- set debug log to /var/log/amanda
-* Fri Jan 12 2007 Paddy Sreenivasan <paddy at zmanda dot com>
-- Added label templates
-* Thu Dec 07 2006 Paddy Sreenivasan <paddy at zmanda dot com>
-- Application API changes
-* Fri Jun 16 2006 Kevin Till <ktill at zmanda dot com>
-- make install will install necessary example files.
- No need to "cp"
-* Wed Jun 07 2006 Paddy Sreenivasan <paddy at zmanda dot com> -
-- Added amoldrecover and amanda-client.conf man page.
-* Thu Jun 01 2006 Kevin Till <ktill at zmanda dot com> -
-- Added amcrypt-ossl, amcrypt-ossl-asym by Ben Slusky.
-* Thu May 18 2006 Paddy Sreenivasan <paddy at zmanda dot com> -
-- Added SLES10, RHEL3 build options.
-* Tue May 09 2006 Chris Lee <cmlee at zmanda dot com> -
-- Added amanda-release file to amandabackup home directory.
-- Installation message logging cleanup.
-* Thu Apr 27 2006 Paddy Sreenivasan <paddy at zmanda dot com> -
-- Removed dependency on tar version.
-- Moved log directory creation after backup user creation.
-* Wed Apr 19 2006 Chris Lee <cmlee at zmanda dot com> -
-- Added informative message to note the location of pre- and post-
-- install script logs files.
-* Mon Apr 17 2006 Chris Lee <cmlee at zmanda dot com> -
-- Reworked installation message logging and reporting.
-* Fri Apr 14 2006 Chris Lee <cmlee at zmanda dot com> -
-- Changed behavior for creating required localhost entries in the
-- amandahosts file to check for these entries even when the file
-- already exists.
-* Wed Apr 12 2006 Chris Lee <cmlee at zmanda dot com> -
-- Removed pre-install check for "disk" group. This group should exist
-- by default on almost all modern distributions.
-* Tue Apr 11 2006 Chris Lee <cmlee at zmanda dot com> -
-- Added amandahosts entry for "localhost" without domain.
-* Fri Apr 07 2006 Chris Lee <cmlee at zmanda dot com> -
-- Changed default entries in .amandahosts to use "localdomain" instead
-- of "localnet".
-- Updated amanda_version and release.
-* Mon Apr 03 2006 Chris Lee <cmlee at zmanda dot com> -
-- Added example amanda.conf to files.
-* Thu Mar 16 2006 Chris Lee <cmlee at zmanda dot com> -
-- Corrected an issue with pre-install scripts wrt bug #218.
-- Corrected an issue with post-install scripts and added testing .profile
-- in amandabackup's home directory for setting environment variables wrt
-- bug #220.
-* Mon Mar 13 2006 Chris Lee <cmlee at zmanda dot com> -
-- Corrected a syntactical error with setting ownership of amandates file
-- wrt bug #216.
-* Wed Mar 08 2006 Chris Lee <cmlee at zmanda dot com> -
-- Added pre-install scripts to verify proper ownership of
-- amandabackup home directory.
-* Thu Feb 2 2006 Paddy Sreenivasan <paddy at zmanda dot com> -
-- Require xinetd. Require termcap and initscripts for Fedora and Redhat.
-* Mon Jan 09 2006 Chris Lee <cmlee at zmanda dot com> -
-- Pre/post install scripts updated:
-- o Resolved an issue where an empty amandates file was installed
-- even if the file already existed on the system.
-- o If .amandahosts does not exist a default is now created.
-- The Amanda user account has been changed to 'amandabackup' for
-- additional security.
-* Tue Jan 03 2006 Paddy Sreenivasan <paddy at zmanda dot com> -
-- Removed amandates from files list.
-* Thu Dec 29 2005 Chris Lee <cmlee at zmanda dot com> -
-- Corrected dependency for awk to "/bin/awk".
-* Thu Dec 29 2005 Kevin Till <ktill at zmanda dot com> -
-- add man pages for amcrypt and amaespipe
-* Thu Dec 29 2005 Chris Lee <cmlee at zmanda dot com> -
-- Updated dependancy info to depend on tar >= 1.15.
-- Included dependancies from top-level package in backup_client and
-- backup_server packages.
-- Reorganized files lists for readability (alphabetically).
-- Updated backup_client files list to include some missing files per
-- bug #129.
-- Updated pre- and post-install to handle potential issue when
-- /var/log/amanda exists and is a file rather than a directory.
-- Corrected permissions for /var/log/amanda in pre-install scripts
-- per bug #78 and 13 December change.
-* Thu Dec 22 2005 Paddy Sreenivasan <paddy at zmanda dot com> -
-- Added amaespipe and amcrypt
-- Added sles9 build definitions
-* Tue Dec 13 2005 Chris Lee <cmlee at zmanda dot com> -
-- Changed permissions for /var/log/amanda, removing set group id bit.
-- Added /etc/amandates to backup_client package.
-* Thu Dec 08 2005 Chris Lee <cmlee at zmanda dot com> -
-- Corrected an issue with detection of existing 'amanda' user account.
-- Corrected ownership of setuid executables per Bug #66.
-- Moved the gnutar and noop files to the backup_client package (where
-- they sould be).
-- Removed amqde from files list.
-- Added logging features to pre- and post-install scripts.
-* Wed Dec 07 2005 Chris Lee <cmlee at zmanda dot com> -
-- Changed a number of directory and file permissions from amanda:root
-- to amanda:disk in response to Bug #57.
-* Fri Dec 02 2005 Chris Lee <cmlee at zmanda dot com> -
-- Corrected SYSCONFDIR path definition. Closes Bug #58.
-* Mon Nov 28 2005 Chris Lee <cmlee at zmanda dot com> -
-- Really fixed user creation preinstall scripts.
-* Wed Nov 23 2005 Paddy Sreenivasan <paddy at zmanda dot com> -
-- Updated package description.
-- Changed Group for packages.
-* Tue Nov 22 2005 Chris Lee <cmlee at zmanda dot com> -
-- Corrected dependancy packaging issue with amanda libraries.
-- Fixed creation of amanda user on systems which it does not exist.
-- Corrected Group definition for SuSE.
-- Updated descriptions to include amanda-libs package.
-- Updated release number to 2.
-* Tue Nov 08 2005 Chris Lee <cmlee at zmanda dot com> -
-- Permissions changes: now using user=amanda, group=disk
-* Sun Oct 30 2005 Chris Lee <cmlee at zmanda dot com> -
-- Parameters to configure options --with-user and --with-group changed
-- such that when test_build is set to '1' the username of the user who
-- runs rpmbuild is used for both values. If test_build is set to '0'
-- then root is used for both values.
-- The release field was also changed to automatically reflect the
-- distribution and distribution release version for which the RPM was
-- built.
-* Tue Oct 18 2005 Chris Lee <cmlee at zmanda dot com> -
-- Initial RPM SPEC file created.
-
+++ /dev/null
-***************
-*** 122,128 ****
- # --- Definitions ---
-
- # Define amanda_version if it is not already defined.
-- %{!?amanda_version: %define amanda_version 2.6.0}
- %{!?amanda_release: %define amanda_release 2}
- %define amanda_version_info "Amanda Community Edition - version %{amanda_version}"
- %define amanda_user amandabackup
---- 122,128 ----
- # --- Definitions ---
-
- # Define amanda_version if it is not already defined.
-+ %{!?amanda_version: %define amanda_version 2.6.0p1}
- %{!?amanda_release: %define amanda_release 2}
- %define amanda_version_info "Amanda Community Edition - version %{amanda_version}"
- %define amanda_user amandabackup
# Buildbot exports some useful env variables.
# Check for $AMVER. I couldn't come up with a good way to detect it.
if [ -z $AMVER ]; then
- AMVER=amanda-2.6.0p1
+ AMVER=amanda-2.6.0p2
fi
# Check for AMTARBALL variable.
if [ -z $AMTARBALL ]; then
# this is useful for changing %amanda_release or %amanda_version
rpmbuild -ba --define "_topdir ${AMPKGDIR}/rpm" \
${AMPKGDIR}/rpm/SPECS/amanda.spec
+cp rpm/RPMS/*/*.rpm . || exit 1
+cp rpm/SRPMS/*.rpm . || exit 1
+++ /dev/null
-#!/bin/bash
-# Buildpkg script for producing RPM packages. Does not require root access.
-
-# This is useful for debugging
-set -x
-# Buildbot exports some useful env variables.
-# Check for $AMVER. I couldn't come up with a good way to detect it.
-if [ -z $AMVER ]; then
- AMVER=amanda-2.6.0p1
-fi
-# Check for AMTARBALL variable.
-if [ -z $AMTARBALL ]; then
- AMTARBALL=$AMVER.tar.gz
-fi
-
-# Check for AMTARBALL file, if it's not there, create it.
-if [ ! -f ${AMTARBALL} ]; then
- mkdir ${AMVER}
- cp -Rfp * ${AMVER}/
- tar -cf ${AMTARBALL} -z ${AMVER}
- rm -rf ${AMVER}
-fi
-
-# Check for the packaging dirs.
-if [ -z $AMPKGDIR ]; then
- AMPKGDIR=${PWD}
-fi
-if [ ! -d ${AMPKGDIR} ]; then
- mkdir ${AMPKGDIR}
-fi
-cd ${AMPKGDIR}
-
-if [ -d rpm ]; then
- rm -rf rpm
-fi
-mkdir rpm
-mkdir rpm/SOURCES
-mkdir rpm/SRPMS
-mkdir rpm/SPECS
-mkdir rpm/BUILD
-mkdir rpm/RPMS
-
-# Make a copy of the tarball with the name that rpmbuild expects
-cp ${AMTARBALL} rpm/SOURCES/${AMVER}.tar.gz
-cp packaging/rpm/amanda.spec rpm/SPECS/amanda.spec
-# Rpmbuild requires absolute paths. annoying. If you need to change the
-# default value of some rpm.spec variable, just pass extra --define options.
-# this is useful for changing %amanda_release or %amanda_version
-rpmbuild -ba --define "_topdir ${AMPKGDIR}/rpm" \
- ${AMPKGDIR}/rpm/SPECS/amanda.spec
+++ /dev/null
-***************
-*** 6,12 ****
- # Buildbot exports some useful env variables.
- # Check for $AMVER. I couldn't come up with a good way to detect it.
- if [ -z $AMVER ]; then
-- AMVER=amanda-2.6.0
- fi
- # Check for AMTARBALL variable.
- if [ -z $AMTARBALL ]; then
---- 6,12 ----
- # Buildbot exports some useful env variables.
- # Check for $AMVER. I couldn't come up with a good way to detect it.
- if [ -z $AMVER ]; then
-+ AMVER=amanda-2.6.0p1
- fi
- # Check for AMTARBALL variable.
- if [ -z $AMTARBALL ]; then
device name for that slot, and a boolean value which is true if the
changer successfully loaded the slot.
+=back
+
=cut
sub reset {
my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"],
$Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP);
-
+
=head1 API STATUS
Will change.
my @specs = Amanda::Cmdline::parse_dumpspecs(["host", "disk", "date"],
$Amanda::Cmdline::CMDLINE_PARSE_DATESTAMP);
-
+
=head1 API STATUS
Will change.
print "tape device is ", getconf($CNF_TAPEDEV), "\n";
-This API closely parallels the C API. See L<conffile.h> for details
+This API closely parallels the C API. See F<conffile.h> for details
on the functions and constants available here.
=head1 API STATUS
Most Amanda applications accept the command-line option C<-o>
to "overwrite" configuration values in C<amanda.conf>. In Perl
-applications, these options should be parsed with L<Getopt::Long>, with
+applications, these options should be parsed with L<Getopt::Long|Getopt::Long>, with
the action being a call to C<add_config_overwrite_opt>. For example:
my $config_overwrites = new_config_overwrites($#ARGV+1);
=over
-=item C<lookup_TYP($subsec_name)>, which returns an opaque object
+=item C<lookup_TYP($subsec_name)>
+
+which returns an opaque object
(C<$ss>) representing the subsection, or C<undef> if no subsection
with that name exists;
-=item C<TYP_name($ss)>, returning the name of the subsection;
+=item C<TYP_name($ss)>
+
+returning the name of the subsection;
+
+=item C<TYP_getconf($ss, $cnf)>
-=item C<TYP_getconf($ss, $cnf)>, which fetches a parameter value from
-C<$ss>; and
+which fetches a parameter value from C<$ss>; and
-=item C<TYP_seen($ss, $cnf)>, which returns a true value if <$cnf>
-was seen in the subsection.
+=item C<TYP_seen($ss, $cnf)>
+
+which returns a true value if <$cnf> was seen in the subsection.
=back
=over
-=item C<tapetype>, with constants beginning with C<$TAPETYPE_>,
+=item C<tapetype>
+
+with constants beginning with C<$TAPETYPE_>
+
+=item C<dumptype>
+
+with constants beginning with C<$DUMPTYPE_>
+
+=item C<holdingdisk>
+
+with constants beginning with C<$HOLDING_>
+
+=item C<application>
-=item C<dumptype>, with constants beginning with C<$DUMPTYPE_>,
+with constants beginning with C<$APPLICATION_>
-=item C<interface>, with constants beginning with C<$INTER_>, and
+=item C<script>
-=item C<holdingdisk>, with constants beginning with C<$HOLDING_>.
+with constants beginning with C<$PP_SCRIPT_>
=back
print "tape device is ", getconf($CNF_TAPEDEV), "\n";
-This API closely parallels the C API. See L<conffile.h> for details
+This API closely parallels the C API. See F<conffile.h> for details
on the functions and constants available here.
=head1 API STATUS
Most Amanda applications accept the command-line option C<-o>
to "overwrite" configuration values in C<amanda.conf>. In Perl
-applications, these options should be parsed with L<Getopt::Long>, with
+applications, these options should be parsed with L<Getopt::Long|Getopt::Long>, with
the action being a call to C<add_config_overwrite_opt>. For example:
my $config_overwrites = new_config_overwrites($#ARGV+1);
=over
-=item C<lookup_TYP($subsec_name)>, which returns an opaque object
+=item C<lookup_TYP($subsec_name)>
+
+which returns an opaque object
(C<$ss>) representing the subsection, or C<undef> if no subsection
with that name exists;
-=item C<TYP_name($ss)>, returning the name of the subsection;
+=item C<TYP_name($ss)>
+
+returning the name of the subsection;
+
+=item C<TYP_getconf($ss, $cnf)>
-=item C<TYP_getconf($ss, $cnf)>, which fetches a parameter value from
-C<$ss>; and
+which fetches a parameter value from C<$ss>; and
-=item C<TYP_seen($ss, $cnf)>, which returns a true value if <$cnf>
-was seen in the subsection.
+=item C<TYP_seen($ss, $cnf)>
+
+which returns a true value if <$cnf> was seen in the subsection.
=back
=over
-=item C<tapetype>, with constants beginning with C<$TAPETYPE_>,
+=item C<tapetype>
+
+with constants beginning with C<$TAPETYPE_>
+
+=item C<dumptype>
+
+with constants beginning with C<$DUMPTYPE_>
+
+=item C<holdingdisk>
+
+with constants beginning with C<$HOLDING_>
+
+=item C<application>
-=item C<dumptype>, with constants beginning with C<$DUMPTYPE_>,
+with constants beginning with C<$APPLICATION_>
-=item C<interface>, with constants beginning with C<$INTER_>, and
+=item C<script>
-=item C<holdingdisk>, with constants beginning with C<$HOLDING_>.
+with constants beginning with C<$PP_SCRIPT_>
=back
print "Label on $device_name is '$dev->volume_label'\n";
}
-See L<http://wiki.zmanda.com/index.php/Device_API> for details on how Devices are used.
+See http://wiki.zmanda.com/index.php/Device_API for details on how Devices are used.
=head1 API STATUS
=item C<start_file($jobinfo)>
-where C<$jobinfo> is a C<dumpfile_t> (see L<Amanda::Datatypes)
+where C<$jobinfo> is a C<dumpfile_t> (see L<Amanda::Datatypes>)
=item C<write_min_size()>
print "Label on $device_name is '$dev->volume_label'\n";
}
-See L<http://wiki.zmanda.com/index.php/Device_API> for details on how Devices are used.
+See http://wiki.zmanda.com/index.php/Device_API for details on how Devices are used.
=head1 API STATUS
=item C<start_file($jobinfo)>
-where C<$jobinfo> is a C<dumpfile_t> (see L<Amanda::Datatypes)
+where C<$jobinfo> is a C<dumpfile_t> (see L<Amanda::Datatypes>)
=item C<write_min_size()>
=item C<find_log()>
Return a list of logfiles for active tapes. The tapelist must be loaded before
-this function is called (see L<Amanda::Tapelist>).
+this function is called (see L<Amanda::Tapefile>, and note that this module will be
+renamed to L<Amanda::Tapelist> in Amanda-2.6.1).
=item C<search_logfile($label, $datestamp, $logfile, $add_missing_disks)>
All of these functions can be imported by name.
+=back
+
=cut
push @EXPORT_OK, qw(open_logfile get_logline close_logfile);
=item C<find_log()>
Return a list of logfiles for active tapes. The tapelist must be loaded before
-this function is called (see L<Amanda::Tapelist>).
+this function is called (see L<Amanda::Tapefile>, and note that this module will be
+renamed to L<Amanda::Tapelist> in Amanda-2.6.1).
=item C<search_logfile($label, $datestamp, $logfile, $add_missing_disks)>
All of these functions can be imported by name.
+=back
+
=cut
%}
@EXPORT_OK = ();
%EXPORT_TAGS = ();
+
+=head1 NAME
+
+Amanda::Tapefile - temporary hack
+
+=head1 HACK?
+
+Yeah, this is just here to make Amanda::Logfile usable. This module
+wil become Amanda::Tapelist in the next release.
+
+=cut
1;
#include "tapefile.h"
%}
+%perlcode %{
+=head1 NAME
+
+Amanda::Tapefile - temporary hack
+
+=head1 HACK?
+
+Yeah, this is just here to make Amanda::Logfile usable. This module
+wil become Amanda::Tapelist in the next release.
+
+=cut
+%}
/* This is just a hack to get Amanda::Logfile working! */
int read_tapelist(char *tapefile);
=item C<setup_application($name, $type, $context)>
-Set up the operating environment for an application, without requiring
-any configuration.
+Set up the operating environment for an application, without requiring any
+configuration.
+
+C<$name> is the name of the application, used in log messages, etc. C<$type>
+is usualy one of "server" or "client". It specifies the subdirectory in which
+debug logfiles will be created. C<$context> indicates the usual manner in
+which this application is invoked; one of C<"cmdline"> for a user-invoked
+command-line utility (e.g., C<amadmin>) which should send human-readable error
+messages to stderr; C<"daemon"> for a program started by C<amandad>, e.g.,
+C<sendbackup>; or C<"scriptutil"> for a small program used from shell scripts,
+e.g., C<amgetconf>
+
+Based on C<$type> and C<$context>, this function does the following:
=over
-=item C<$name> is the name of the application, used in log messages, etc.
+=item *
-=item C<$type> is one of "server" or "client".
+sets up debug logging;
-=item C<$context> is one of "cmdline" for a user-invoked command-line
-utility (e.g., C<amadmin>) or "daemon" for a program started by
-C<amandad>. (TODO: daemon is not supported yet)
+=item *
-=back
+configures internationalization
-Based on C<$type> and C<$context>, this function does the following:
+=item *
-=over
+sets the umask;
-=item sets up debug logging;
+=item *
-=item configures internationalization
+sets the current working directory to the debug or temporary directory;
-=item sets the umask;
+=item *
-=item sets the current working directory to the debug or temporary directory;
+closes any unnecessary file descriptors as a security meaasure;
-=item closes any unnecessary file descriptors as a security meaasure;
+=item *
-=item ignores C<SIGPIPE>; and
+ignores C<SIGPIPE>; and
-=item sets the appropriate target for error messages.
+=item *
+
+sets the appropriate target for error messages.
=back
check_running_as($running_as);
}
-=item safe_env
+=item C<safe_env()>
Return a "safe" environment hash. For non-setuid programs, this means filtering out any
localization variables.
fcntl(STDOUT, F_GETFD, 0) or critical("Standard output is not open");
fcntl(STDERR, F_GETFD, 0) or critical("Standard error is not open");
}
+
+=back
+
+=cut
1;
=item C<setup_application($name, $type, $context)>
-Set up the operating environment for an application, without requiring
-any configuration.
+Set up the operating environment for an application, without requiring any
+configuration.
+
+C<$name> is the name of the application, used in log messages, etc. C<$type>
+is usualy one of "server" or "client". It specifies the subdirectory in which
+debug logfiles will be created. C<$context> indicates the usual manner in
+which this application is invoked; one of C<"cmdline"> for a user-invoked
+command-line utility (e.g., C<amadmin>) which should send human-readable error
+messages to stderr; C<"daemon"> for a program started by C<amandad>, e.g.,
+C<sendbackup>; or C<"scriptutil"> for a small program used from shell scripts,
+e.g., C<amgetconf>
+
+Based on C<$type> and C<$context>, this function does the following:
=over
-=item C<$name> is the name of the application, used in log messages, etc.
+=item *
-=item C<$type> is one of "server" or "client".
+sets up debug logging;
-=item C<$context> is one of "cmdline" for a user-invoked command-line
-utility (e.g., C<amadmin>) or "daemon" for a program started by
-C<amandad>. (TODO: daemon is not supported yet)
+=item *
-=back
+configures internationalization
-Based on C<$type> and C<$context>, this function does the following:
+=item *
-=over
+sets the umask;
-=item sets up debug logging;
+=item *
-=item configures internationalization
+sets the current working directory to the debug or temporary directory;
-=item sets the umask;
+=item *
-=item sets the current working directory to the debug or temporary directory;
+closes any unnecessary file descriptors as a security meaasure;
-=item closes any unnecessary file descriptors as a security meaasure;
+=item *
-=item ignores C<SIGPIPE>; and
+ignores C<SIGPIPE>; and
-=item sets the appropriate target for error messages.
+=item *
+
+sets the appropriate target for error messages.
=back
check_running_as($running_as);
}
-=item safe_env
+=item C<safe_env()>
Return a "safe" environment hash. For non-setuid programs, this means filtering out any
localization variables.
fcntl(STDOUT, F_GETFD, 0) or critical("Standard output is not open");
fcntl(STDERR, F_GETFD, 0) or critical("Standard error is not open");
}
+
+=back
+
+=cut
%}
libamglue_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
EXTRA_DIST += $(libamglue_la_SOURCES)
+##
+## HTML Generation
+##
+
+# This isn't a very robust implementation, as it's only meant to make the HTML
+# available online as part of the automated compilation process. It assumes
+# that all perl modules were built (not just server or client), and that the
+# build directory does not contain any "junk".
+
+# HTML_SOURCE_FILES should contain the .pm files from which the HTML should
+# be geneated. This is just the concatenation of foo_DATA for all $(foodir)
+# into which perl modules are installed.
+HTML_SOURCE_FILES=
+html: make_html amperl.css $(HTML_SOURCE_FILES)
+ rm -rf html-tmp/ && mkdir html-tmp/
+ cp amperl.css html-tmp/
+ $(PERL) make_html html-tmp/ $(HTML_SOURCE_FILES)
+ cd html-tmp/ && tar -zcf $(abs_builddir)/html.tar.gz .
+ rm -rf html-tmp/
##
## SWIG-generated packages
##
Amandadir=$(amperldir)/Amanda
Amanda_DATA =
+HTML_SOURCE_FILES += $(Amanda_DATA)
if WANT_SERVER
# PACKAGE: Amanda::Device
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
libamglue_la_LDFLAGS = $(PERL_EXT_LDFLAGS)
+# This isn't a very robust implementation, as it's only meant to make the HTML
+# available online as part of the automated compilation process. It assumes
+# that all perl modules were built (not just server or client), and that the
+# build directory does not contain any "junk".
+
+# HTML_SOURCE_FILES should contain the .pm files from which the HTML should
+# be geneated. This is just the concatenation of foo_DATA for all $(foodir)
+# into which perl modules are installed.
+HTML_SOURCE_FILES = $(Amanda_DATA)
+
# Tell libtool to not bother versioning the libs we build, since perl won't
# pay attention to such things, anyway.
dvi-am:
-html: html-am
-
info: info-am
info-am:
done; \
true
dist-hook: dist-scripts
+html: make_html amperl.css $(HTML_SOURCE_FILES)
+ rm -rf html-tmp/ && mkdir html-tmp/
+ cp amperl.css html-tmp/
+ $(PERL) make_html html-tmp/ $(HTML_SOURCE_FILES)
+ cd html-tmp/ && tar -zcf $(abs_builddir)/html.tar.gz .
+ rm -rf html-tmp/
# Suffix rules. These are parallel-build compatible, but may cause
# strange behavior if there are other .c files in this directory. The
*/
#include "amglue.h"
+#include "stdint.h"
/*
* C -> Perl
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
check_security_buffer(
char * buffer)
{
- socklen_t i;
+ socklen_t_equiv i;
struct sockaddr_in addr;
char *s, *fp, ch;
char *errstr = NULL;
/*NOTREACHED*/
}
skip_whitespace(s, ch);
- if (!check_security((struct sockaddr_storage *)&addr, s-1, 0, &errstr)) {
+ if (!check_security((sockaddr_union *)&addr, s-1, 0, &errstr)) {
error(_("security check failed: %s"), errstr);
/*NOTREACHED*/
}
char *buf = NULL;
int data_sock = -1;
in_port_t data_port = (in_port_t)-1;
- socklen_t socklen;
+ socklen_t_equiv socklen;
struct sockaddr_in addr;
GSList *dumpspecs;
tapelist_t *tapes = NULL;
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \
{ "due", due,
T_(" [<hostname> [<disks>]* ]*\t # Show due date.") },
{ "balance", balance,
- T_(" [-days <num>]\t\t # Show nightly dump size balance.") },
+ T_(" [--days <num>]\t\t # Show nightly dump size balance.") },
{ "tape", tape,
- T_(" [-days <num>]\t\t # Show which tape is due next.") },
+ T_(" [--days <num>]\t\t # Show which tape is due next.") },
{ "bumpsize", bumpsize,
T_("\t\t\t # Show current bump thresholds.") },
{ "export", export_db,
int argc,
char ** argv)
{
- tape_t *tp, *lasttp;
- int runtapes, i, j;
- int nb_days = 1;
+ int nb_days = 1;
+ int runtapes;
+ tape_t *tp;
+ int i, j;
+ int skip;
+ int nb_new_tape;
if(argc > 4 && strcmp(argv[3],"--days") == 0) {
nb_days = atoi(argv[4]);
runtapes = getconf_int(CNF_RUNTAPES);
tp = lookup_last_reusable_tape(0);
+ skip = 0;
for ( j=0 ; j < nb_days ; j++ ) {
+ nb_new_tape=0;
for ( i=0 ; i < runtapes ; i++ ) {
if(i==0)
- g_printf(_("The next Amanda run should go onto "));
- else
- g_printf(" ");
+ g_fprintf(stdout, _("The next Amanda run should go onto "));
if(tp != NULL) {
- g_printf(_("tape %s or a new tape.\n"), tp->label);
+ if (nb_new_tape > 0) {
+ if (nb_new_tape == 1)
+ g_fprintf(stdout, _("1 new tape.\n"));
+ else
+ g_fprintf(stdout, _("%d new tapes.\n"), nb_new_tape);
+ g_fprintf(stdout, " ");
+ nb_new_tape = 0;
+ }
+ g_fprintf(stdout, _("tape %s or a new tape.\n"), tp->label);
+ if (i < runtapes-1)
+ g_fprintf(stdout, " ");
} else {
- if (runtapes - i == 1)
- g_printf(_("1 new tape.\n"));
- else
- g_printf(_("%d new tapes.\n"), runtapes - i);
- i = runtapes;
+ nb_new_tape++;
}
-
- tp = lookup_last_reusable_tape(i + 1);
- }
- }
- lasttp = lookup_tapepos(lookup_nb_tape());
- i = runtapes;
- if(lasttp && i > 0 && strcmp(lasttp->datestamp,"0") == 0) {
- int c = 0;
- while(lasttp && i > 0 && strcmp(lasttp->datestamp,"0") == 0) {
- c++;
- lasttp = lasttp->prev;
- i--;
- }
- lasttp = lookup_tapepos(lookup_nb_tape());
- i = runtapes;
- if(c == 1) {
- g_printf(_("The next new tape already labelled is: %s.\n"),
- lasttp->label);
+ skip++;
+
+ tp = lookup_last_reusable_tape(skip);
}
- else {
- g_printf(_("The next %d new tapes already labelled are: %s"), c,
- lasttp->label);
- lasttp = lasttp->prev;
- c--;
- while(lasttp && c > 0 && strcmp(lasttp->datestamp,"0") == 0) {
- g_printf(", %s", lasttp->label);
- lasttp = lasttp->prev;
- c--;
- }
- g_printf(".\n");
+ if (nb_new_tape > 0) {
+ if (nb_new_tape == 1)
+ g_fprintf(stdout, _("1 new tape.\n"));
+ else
+ g_fprintf(stdout, _("%d new tapes.\n"), nb_new_tape);
}
}
+
+ print_new_tapes(stdout, nb_days * runtapes);
}
/* ----------------------------------------------- */
char *s;
int ch;
char *cmd_undo, cmd_undo_ch;
- socklen_t socklen;
- struct sockaddr_storage his_addr;
+ socklen_t_equiv socklen;
+ sockaddr_union his_addr;
char *arg = NULL;
char *cmd;
size_t len;
if (!user_validated && strcmp(cmd, "SECURITY") == 0 && arg) {
user_validated = amindexd_debug ||
check_security(
- (struct sockaddr_storage *)&his_addr,
+ (sockaddr_union *)&his_addr,
arg, 0, &errstr);
if(user_validated) {
reply(200, _("Access OK"));
file.type = save_type;
strncpy(file.cont_filename, new_filename, SIZEOF(file.cont_filename));
- file.cont_filename[SIZEOF(file.cont_filename)] = '\0';
+ file.cont_filename[SIZEOF(file.cont_filename)-1] = '\0';
if(write_tapeheader(db->fd, &file)) {
errstr = squotef(_("write_tapeheader file \"%s\": %s"),
db->filename,
while(!empty(directq) && taper > 0) {
diskp = dequeue_disk(&directq);
if (diskp->to_holdingdisk == HOLD_REQUIRED) {
+ char *qname = quote_string(diskp->name);
log_add(L_FAIL, _("%s %s %s %d [%s]"),
- diskp->host->hostname, diskp->name, sched(diskp)->datestamp,
+ diskp->host->hostname, qname, sched(diskp)->datestamp,
sched(diskp)->level,
_("can't dump required holdingdisk"));
+ amfree(qname);
}
else if (!degraded_mode) {
taper_state |= TAPER_STATE_DUMP_TO_TAPE;
event_loop(0);
taper_state &= !TAPER_STATE_DUMP_TO_TAPE;
}
- else
+ else {
+ char *qname = quote_string(diskp->name);
log_add(L_FAIL, _("%s %s %s %d [%s]"),
- diskp->host->hostname, diskp->name, sched(diskp)->datestamp,
+ diskp->host->hostname, qname, sched(diskp)->datestamp,
sched(diskp)->level,
diskp->to_holdingdisk == HOLD_AUTO ?
_("no more holding disk space") :
_("can't dump no-hold disk in degraded mode"));
+ amfree(qname);
+ }
}
/* fill up the tape or start new one for taperflush */
if(cmd != PORT) {
assignedhd_t **h=NULL;
int activehd;
+ char *qname = quote_string(diskp->name);
g_printf(_("driver: did not get PORT from %s for %s:%s\n"),
- chunker->name, diskp->host->hostname, diskp->name);
+ chunker->name, diskp->host->hostname, qname);
+ amfree(qname);
fflush(stdout);
deallocate_bandwidth(diskp->host->netif, sched(diskp)->est_kps);
if (!taper_dumper)
free_serial(result_argv[2]);
+ qname = quote_string(dp->name);
g_printf(_("driver: finished-cmd time %s taper wrote %s:%s\n"),
- walltime_str(curclock()), dp->host->hostname, dp->name);
+ walltime_str(curclock()), dp->host->hostname, qname);
+ amfree(qname);
fflush(stdout);
if (strcmp(result_argv[3], "INPUT-ERROR") == 0) {
dp = serial2disk(result_argv[2]);
if (!taper_dumper)
free_serial(result_argv[2]);
+ qname = quote_string(dp->name);
g_printf(_("driver: finished-cmd time %s taper wrote %s:%s\n"),
- walltime_str(curclock()), dp->host->hostname, dp->name);
+ walltime_str(curclock()), dp->host->hostname, qname);
+ amfree(qname);
fflush(stdout);
log_add(L_WARNING, _("Taper error: %s"), result_argv[3]);
taper_tape_error = stralloc(result_argv[3]);
file_taper_result(
disk_t *dp)
{
+ char *qname = quote_string(dp->name);
+
if (taper_result == DONE) {
update_info_taper(dp, taper_first_label, taper_first_fileno,
sched(dp)->level);
if (taper_input_error) {
g_printf("driver: taper failed %s %s: %s\n",
- dp->host->hostname, dp->name, taper_input_error);
+ dp->host->hostname, qname, taper_input_error);
if (strcmp(sched(dp)->datestamp, driver_timestamp) == 0) {
if(sched(dp)->taper_attempted >= 2) {
log_add(L_FAIL, _("%s %s %s %d [too many taper retries after holding disk error: %s]"),
- dp->host->hostname, dp->name, sched(dp)->datestamp,
+ dp->host->hostname, qname, sched(dp)->datestamp,
sched(dp)->level, taper_input_error);
g_printf("driver: taper failed %s %s, too many taper retry after holding disk error\n",
- dp->host->hostname, dp->name);
+ dp->host->hostname, qname);
amfree(sched(dp)->destname);
amfree(sched(dp)->dumpdate);
amfree(sched(dp)->degr_dumpdate);
amfree(dp->up);
} else {
log_add(L_INFO, _("%s %s %s %d [Will retry dump because of holding disk error: %s]"),
- dp->host->hostname, dp->name, sched(dp)->datestamp,
+ dp->host->hostname, qname, sched(dp)->datestamp,
sched(dp)->level, taper_input_error);
g_printf("driver: taper will retry %s %s because of holding disk error\n",
- dp->host->hostname, dp->name);
+ dp->host->hostname, qname);
if (dp->to_holdingdisk != HOLD_REQUIRED) {
dp->to_holdingdisk = HOLD_NEVER;
sched(dp)->dump_attempted -= 1;
} else if (taper_tape_error) {
if(sched(dp)->taper_attempted >= 2) {
log_add(L_FAIL, _("%s %s %s %d [too many taper retries]"),
- dp->host->hostname, dp->name, sched(dp)->datestamp,
+ dp->host->hostname, qname, sched(dp)->datestamp,
sched(dp)->level);
g_printf("driver: taper failed %s %s, too many taper retry\n",
- dp->host->hostname, dp->name);
+ dp->host->hostname, qname);
amfree(sched(dp)->destname);
amfree(sched(dp)->dumpdate);
amfree(sched(dp)->degr_dumpdate);
amfree(dp->up);
} else {
g_printf("driver: taper will retry %s %s\n",
- dp->host->hostname, dp->name);
+ dp->host->hostname, qname);
/* Re-insert into taper queue. */
headqueue_disk(&tapeq, dp);
}
amfree(dp->up);
}
+ amfree(qname);
+
taper_busy = 0;
taper_input_error = NULL;
taper_tape_error = NULL;
* case for cleanup.
*/
if(sched(dp)->dump_attempted) {
+ char *qname = quote_string(dp->name);
log_add(L_FAIL, _("%s %s %s %d [too many dumper retry: %s]"),
- dp->host->hostname, dp->name, sched(dp)->datestamp,
+ dp->host->hostname, qname, sched(dp)->datestamp,
sched(dp)->level, result_argv[3]);
g_printf(_("driver: dump failed %s %s %s, too many dumper retry: %s\n"),
- result_argv[2], dp->host->hostname, dp->name,
+ result_argv[2], dp->host->hostname, qname,
result_argv[3]);
+ amfree(qname);
}
/* FALLTHROUGH */
case FAILED: /* FAILED <handle> <errstr> */
static void
output_tapeinfo(void)
{
- tape_t *tp, *lasttp;
+ tape_t *tp;
int run_tapes;
int skip = 0;
+ int i, nb_new_tape;
if (last_run_tapes > 0) {
if(amflush_run)
else if(run_tapes > 1)
g_fprintf(mailf, _("The next %d tapes Amanda expects to use are: "),
run_tapes);
-
- while(run_tapes > 0) {
+
+ nb_new_tape = 0;
+ for (i=0 ; i < run_tapes ; i++) {
if(tp != NULL) {
+ if (nb_new_tape > 0) {
+ if (nb_new_tape == 1)
+ g_fprintf(mailf, _("1 new tape, "));
+ else
+ g_fprintf(mailf, _("%d new tapes, "), nb_new_tape);
+ nb_new_tape = 0;
+ }
g_fprintf(mailf, "%s", tp->label);
+ if (i < run_tapes-1) fputs(", ", mailf);
} else {
- if (run_tapes == 1)
- g_fprintf(mailf, _("a new tape"));
- else
- g_fprintf(mailf, _("%d new tapes"), run_tapes);
- run_tapes = 1;
+ nb_new_tape++;
}
-
- if(run_tapes > 1) fputs(", ", mailf);
-
- run_tapes -= 1;
skip++;
+
tp = lookup_last_reusable_tape(skip);
}
+ if (nb_new_tape > 0) {
+ if (nb_new_tape == 1)
+ g_fprintf(mailf, _("1 new tape"));
+ else
+ g_fprintf(mailf, _("%d new tapes"), nb_new_tape);
+ }
fputs(".\n", mailf);
- lasttp = lookup_tapepos(lookup_nb_tape());
run_tapes = getconf_int(CNF_RUNTAPES);
- if(lasttp && run_tapes > 0 && strcmp(lasttp->datestamp,"0") == 0) {
- int c = 0;
- while(lasttp && run_tapes > 0 && strcmp(lasttp->datestamp,"0") == 0) {
- c++;
- lasttp = lasttp->prev;
- run_tapes--;
- }
- lasttp = lookup_tapepos(lookup_nb_tape());
- if(c == 1) {
- g_fprintf(mailf, _("The next new tape already labelled is: %s.\n"),
- lasttp->label);
- }
- else {
- g_fprintf(mailf, _("The next %d new tapes already labelled are: %s"), c,
- lasttp->label);
- lasttp = lasttp->prev;
- c--;
- while(lasttp && c > 0 && strcmp(lasttp->datestamp,"0") == 0) {
- g_fprintf(mailf, ", %s", lasttp->label);
- lasttp = lasttp->prev;
- c--;
- }
- g_fprintf(mailf, ".\n");
- }
- }
+ print_new_tapes(mailf, run_tapes);
}
/* ----- */
i = level > 0;
- if(origkb < 0.0) {
+ if (origkb < 0.0 && (curprog == P_CHUNKER || curprog == P_TAPER) &&
+ isnormal(repdata->dumper.outsize)) {
+ /* take origkb from DUMPER line */
+ origkb = repdata->dumper.outsize;
+ } else if (origkb < 0.0) {
+ /* take origkb from infofile, needed for amflush */
info_t inf;
struct tm *tm;
int Idatestamp;
if(!isnormal(repdata->chunker.outsize) && isnormal(repdata->dumper.outsize)) { /* dump to tape */
stats[i].outsize += kbytes;
if (abs(kbytes - origkb) >= 32) {
+ /* server compressed */
+ stats[i].corigsize += origkb;
stats[i].coutsize += kbytes;
}
}
if(curprog == P_DUMPER) {
stats[i].dumper_time += sec;
if (abs(kbytes - origkb) < 32) {
+ /* not client compressed */
sp->origsize = kbytes;
}
else {
+ /* client compressed */
stats[i].corigsize += sp->origsize;
+ stats[i].coutsize += kbytes;
}
dumpdisks[level] +=1;
stats[i].dumpdisks +=1;
sp->outsize = kbytes;
stats[i].outsize += kbytes;
if (abs(kbytes - origkb) >= 32) {
+ /* server compressed */
+ stats[i].corigsize += origkb;
stats[i].coutsize += kbytes;
}
}
return mktime(tm);
}
+
+void
+print_new_tapes(
+ FILE *output,
+ int nb)
+{
+ tape_t *lasttp, *iter;
+
+ /* Find latest reusable new tape */
+ lasttp = lookup_tapepos(lookup_nb_tape());
+ while (lasttp && lasttp->reuse == 0)
+ lasttp = lasttp->prev;
+
+ if(lasttp && nb > 0 && strcmp(lasttp->datestamp,"0") == 0) {
+ int c = 0;
+ iter = lasttp;
+ /* count the number of tapes we *actually* used */
+ while(iter && nb > 0 && strcmp(iter->datestamp,"0") == 0) {
+ if (iter->reuse) {
+ c++;
+ nb--;
+ }
+ iter = iter->prev;
+ }
+
+ if(c == 1) {
+ g_fprintf(output,
+ _("The next new tape already labelled is: %s.\n"),
+ lasttp->label);
+ } else {
+ g_fprintf(output,
+ _("The next %d new tapes already labelled are: %s"),
+ c, lasttp->label);
+ iter = lasttp->prev;
+ c--;
+ while(iter && c > 0 && strcmp(iter->datestamp,"0") == 0) {
+ if (iter->reuse) {
+ g_fprintf(output, ", %s", iter->label);
+ c--;
+ }
+ iter = iter->prev;
+ }
+ g_fprintf(output, ".\n");
+ }
+ }
+}
int reusable_tape(tape_t *tp);
int guess_runs_from_tapelist(void);
+void print_new_tapes(FILE *output, int nb);
#endif /* !TAPEFILE_H */
return FALSE;
}
+static void
+update_tapelist(
+ taper_state_t *state)
+{
+ char *tapelist_name = NULL;
+ char *tapelist_name_old = NULL;
+
+ tapelist_name = config_dir_relative(getconf_str(CNF_TAPELIST));
+ if (state->cur_tape == 0) {
+ tapelist_name_old = stralloc2(tapelist_name, ".yesterday");
+ } else {
+ char cur_str[NUM_STR_SIZE];
+ g_snprintf(cur_str, SIZEOF(cur_str), "%d", state->cur_tape - 1);
+ tapelist_name_old = vstralloc(tapelist_name,
+ ".today.", cur_str, NULL);
+ }
+
+ if (write_tapelist(tapelist_name_old)) {
+ error("could not write tapelist: %s", strerror(errno));
+ /*NOTREACHED*/
+ }
+ amfree(tapelist_name_old);
+
+ remove_tapelabel(state->device->volume_label);
+ add_tapelabel(state->driver_start_time,
+ state->device->volume_label);
+ if (write_tapelist(tapelist_name)) {
+ error("could not write tapelist: %s", strerror(errno));
+ /*NOTREACHED*/
+ }
+ amfree(tapelist_name);
+}
+
/* Find and label a new tape, if one is not already open. Returns TRUE
* if a tape could be written. */
static gboolean find_and_label_new_tape(taper_state_t * state,
}
static gboolean label_new_tape(taper_state_t * state, dump_info_t * dump_info) {
- char *tapelist_name;
- char *tapelist_name_old;
- char * old_volume_name;
- char * old_volume_time;
+ char *old_volume_name = NULL;
+ char *old_volume_time = NULL;
+ tape_search_request_t request;
+ gboolean search_result;
+ ReadLabelStatusFlags status;
/* If we got here, it means that we have found a tape to label and
* have gotten permission from the driver to write it. But we
state->device = device_open(state->next_tape_device);
amfree(state->next_tape_device);
- if (state->device == NULL) {
- amfree(state->next_tape_label);
- return FALSE;
- }
-
+ if (state->device == NULL)
+ goto skip_volume;
+
device_set_startup_properties_from_config(state->device);
- device_read_label(state->device);
+
+ /* if we have an error, and are sure it isn't just an unlabeled volume,
+ * then skip this volume */
+ status = device_read_label(state->device);
+ if ((status & ~READ_LABEL_STATUS_VOLUME_UNLABELED) &&
+ !(status & READ_LABEL_STATUS_VOLUME_UNLABELED))
+ goto skip_volume;
+
old_volume_name = g_strdup(state->device->volume_label);
old_volume_time = g_strdup(state->device->volume_time);
-
+
if (!device_start(state->device, ACCESS_WRITE, state->next_tape_label,
state->driver_start_time)) {
gboolean tape_used;
+
/* Something broke, see if we can tell if the volume was erased or
* not. */
g_fprintf(stderr, "taper: Error writing label %s to device %s.\n",
state->next_tape_label, state->device->device_name);
- device_finish(state->device);
- device_read_label(state->device);
+
+ if (!device_finish(state->device))
+ goto request_new_volume;
+
+ /* This time, if we can't read the label, assume we've overwritten
+ * the volume or otherwise corrupted it */
+ status = device_read_label(state->device);
+ if ((status & ~READ_LABEL_STATUS_VOLUME_UNLABELED) &&
+ !(status & READ_LABEL_STATUS_VOLUME_UNLABELED))
+ goto request_new_volume;
+
tape_used = check_volume_changed(state->device, old_volume_name,
old_volume_time);
- g_object_unref(state->device);
- state->device = NULL;
- amfree(state->next_tape_label);
- /* If the volume was written, we tell the driver and then immediately
- * try again. */
if (tape_used) {
- putresult(NEW_TAPE, "%s %s\n", dump_info->handle,
- state->device->volume_label);
- if (old_volume_name) {
- log_add(L_WARNING, "Problem writing label to volume %s, "
- "volume may be erased.\n", old_volume_name);
- } else {
- log_add(L_WARNING, "Problem writing label %s to new volume, "
- "volume may be erased.\n", state->next_tape_label);
- }
- amfree(old_volume_name);
- amfree(old_volume_time);
- return find_and_label_new_tape(state, dump_info);
+ goto request_new_volume;
} else {
- /* Otherwise, we grab a new tape without talking to the driver
- * again. */
- tape_search_request_t request;
- gboolean search_result;
- if (old_volume_name) {
- log_add(L_WARNING, "Problem writing label to volume %s, "
- "old volume data intact\n", old_volume_name);
- } else {
- log_add(L_WARNING, "Problem writing label %s to new volume, "
- "old volume data intact\n", state->next_tape_label);
- }
- amfree(old_volume_name);
- amfree(old_volume_time);
- request.state = state;
- request.prolong = TRUE;
- request.errmsg = NULL;
- search_result = GPOINTER_TO_INT(tape_search_thread(&request));
- if (search_result) {
- amfree(request.errmsg);
- return label_new_tape(state, dump_info);
- } else {
- /* Problem finding a new tape! */
- log_taper_scan_errmsg(request.errmsg);
- putresult(NO_NEW_TAPE, "%s\n", dump_info->handle);
- return FALSE;
- }
+ goto skip_volume;
}
- } else {
- amfree(old_volume_name);
- amfree(old_volume_time);
}
+ amfree(old_volume_name);
+ amfree(old_volume_time);
amfree(state->next_tape_label);
- tapelist_name = config_dir_relative(getconf_str(CNF_TAPELIST));
- if (state->cur_tape == 0) {
- tapelist_name_old = stralloc2(tapelist_name, ".yesterday");
- } else {
- char cur_str[NUM_STR_SIZE];
- g_snprintf(cur_str, SIZEOF(cur_str), "%d", state->cur_tape - 1);
- tapelist_name_old = vstralloc(tapelist_name,
- ".today.", cur_str, NULL);
- }
-
- if (write_tapelist(tapelist_name_old)) {
- error("could not write tapelist: %s", strerror(errno));
- /*NOTREACHED*/
- }
- amfree(tapelist_name_old);
-
- remove_tapelabel(state->device->volume_label);
- add_tapelabel(state->driver_start_time,
- state->device->volume_label);
- if (write_tapelist(tapelist_name)) {
- error("could not write tapelist: %s", strerror(errno));
- /*NOTREACHED*/
- }
- amfree(tapelist_name);
+ update_tapelist(state);
state->cur_tape++;
log_add(L_START, "datestamp %s label %s tape %d",
state->device->volume_label);
return TRUE;
+
+request_new_volume:
+ /* Tell the driver we overwrote this volume, even if it was empty, and request
+ * a new volume. */
+ if (state->device) {
+ g_object_unref(state->device);
+ state->device = NULL;
+ }
+
+ putresult(NEW_TAPE, "%s %s\n", dump_info->handle,
+ state->next_tape_label);
+ if (old_volume_name) {
+ log_add(L_WARNING, "Problem writing label '%s' to volume %s, "
+ "volume may be erased.\n",
+ state->next_tape_label, old_volume_name);
+ } else {
+ log_add(L_WARNING, "Problem writing label '%s' to new volume, "
+ "volume may be erased.\n", state->next_tape_label);
+ }
+
+ amfree(state->next_tape_label);
+ amfree(old_volume_name);
+ amfree(old_volume_time);
+
+ return find_and_label_new_tape(state, dump_info);
+
+skip_volume:
+ /* grab a new volume without talking to the driver again -- we do this if we're
+ * confident we didn't overwrite the last tape we got. */
+ if (state->device) {
+ g_object_unref(state->device);
+ state->device = NULL;
+ }
+
+ if (old_volume_name) {
+ log_add(L_WARNING, "Problem writing label '%s' to volume '%s', "
+ "old volume data intact\n",
+ state->next_tape_label, old_volume_name);
+ } else {
+ log_add(L_WARNING, "Problem writing label '%s' to new volume, "
+ "old volume data intact\n", state->next_tape_label);
+ }
+
+ amfree(state->next_tape_label);
+ amfree(old_volume_name);
+ amfree(old_volume_time);
+
+ request.state = state;
+ request.prolong = TRUE;
+ request.errmsg = NULL;
+ search_result = GPOINTER_TO_INT(tape_search_thread(&request));
+ if (search_result) {
+ amfree(request.errmsg);
+ return label_new_tape(state, dump_info);
+ } else {
+ /* Problem finding a new tape! */
+ log_taper_scan_errmsg(request.errmsg);
+ putresult(NO_NEW_TAPE, "%s\n", dump_info->handle);
+ return FALSE;
+ }
}
/* Find out if the dump is PARTIAL or not, and set the proper driver
$(top_srcdir)/config/amanda/rsh-security.m4 \
$(top_srcdir)/config/amanda/s3-device.m4 \
$(top_srcdir)/config/amanda/shmem.m4 \
+ $(top_srcdir)/config/amanda/socklen_t_equiv.m4 \
$(top_srcdir)/config/amanda/ssh-security.m4 \
$(top_srcdir)/config/amanda/summary.m4 \
$(top_srcdir)/config/amanda/swig.m4 \