[
if test "$withval" != "no"; then
if test "$withval" = "yes"; then
- if test -f /usr/local/mysql/include/mysql/mysql.h; then
- MYSQL_INCDIR=/usr/local/mysql/include/mysql
- if test -f /usr/local/mysql/lib64/mysql/libmysqlclient.a; then
- MYSQL_LIBDIR=/usr/local/mysql/lib64/mysql
- else
- MYSQL_LIBDIR=/usr/local/mysql/lib/mysql
- fi
- MYSQL_BINDIR=/usr/local/mysql/bin
- elif test -f /usr/include/mysql/mysql.h; then
- MYSQL_INCDIR=/usr/include/mysql
- if test -f /usr/lib64/mysql/libmysqlclient.a; then
- MYSQL_LIBDIR=/usr/lib64/mysql
- else
- MYSQL_LIBDIR=/usr/lib/mysql
- fi
- MYSQL_BINDIR=/usr/bin
- elif test -f /usr/include/mysql.h; then
- MYSQL_INCDIR=/usr/include
- if test -f /usr/lib64/libmysqlclient.a; then
- MYSQL_LIBDIR=/usr/lib64
- else
- MYSQL_LIBDIR=/usr/lib
- fi
- MYSQL_BINDIR=/usr/bin
- elif test -f /usr/local/include/mysql/mysql.h; then
- MYSQL_INCDIR=/usr/local/include/mysql
- if test -f /usr/local/lib64/mysql/libmysqlclient.a; then
- MYSQL_LIBDIR=/usr/local/lib64/mysql
- else
- MYSQL_LIBDIR=/usr/local/lib/mysql
- fi
- MYSQL_BINDIR=/usr/local/bin
- elif test -f /usr/local/include/mysql.h; then
- MYSQL_INCDIR=/usr/local/include
- if test -f /usr/local/lib64/libmysqlclient.a; then
- MYSQL_LIBDIR=/usr/local/lib64
- else
- MYSQL_LIBDIR=/usr/local/lib
- fi
- MYSQL_BINDIR=/usr/local/bin
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Unable to find mysql.h in standard locations)
- fi
+ if test -f /usr/local/mysql/include/mysql/mysql.h; then
+ MYSQL_INCDIR=/usr/local/mysql/include/mysql
+ if test -f /usr/local/mysql/lib64/mysql/libmysqlclient.a; then
+ MYSQL_LIBDIR=/usr/local/mysql/lib64/mysql
+ else
+ MYSQL_LIBDIR=/usr/local/mysql/lib/mysql
+ fi
+ MYSQL_BINDIR=/usr/local/mysql/bin
+ elif test -f /usr/include/mysql/mysql.h; then
+ MYSQL_INCDIR=/usr/include/mysql
+ if test -f /usr/lib64/mysql/libmysqlclient.a; then
+ MYSQL_LIBDIR=/usr/lib64/mysql
+ else
+ MYSQL_LIBDIR=/usr/lib/mysql
+ fi
+ MYSQL_BINDIR=/usr/bin
+ elif test -f /usr/include/mysql.h; then
+ MYSQL_INCDIR=/usr/include
+ if test -f /usr/lib64/libmysqlclient.a; then
+ MYSQL_LIBDIR=/usr/lib64
+ else
+ MYSQL_LIBDIR=/usr/lib
+ fi
+ MYSQL_BINDIR=/usr/bin
+ elif test -f /usr/local/include/mysql/mysql.h; then
+ MYSQL_INCDIR=/usr/local/include/mysql
+ if test -f /usr/local/lib64/mysql/libmysqlclient.a; then
+ MYSQL_LIBDIR=/usr/local/lib64/mysql
+ else
+ MYSQL_LIBDIR=/usr/local/lib/mysql
+ fi
+ MYSQL_BINDIR=/usr/local/bin
+ elif test -f /usr/local/include/mysql.h; then
+ MYSQL_INCDIR=/usr/local/include
+ if test -f /usr/local/lib64/libmysqlclient.a; then
+ MYSQL_LIBDIR=/usr/local/lib64
+ else
+ MYSQL_LIBDIR=/usr/local/lib
+ fi
+ MYSQL_BINDIR=/usr/local/bin
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(Unable to find mysql.h in standard locations)
+ fi
else
- if test -f $withval/include/mysql/mysql.h; then
- MYSQL_INCDIR=$withval/include/mysql
- if test -f $withval/lib64/mysql/libmysqlclient.a; then
- MYSQL_LIBDIR=$withval/lib64/mysql
- else
- MYSQL_LIBDIR=$withval/lib/mysql
- fi
- MYSQL_BINDIR=$withval/bin
- elif test -f $withval/include/mysql.h; then
- MYSQL_INCDIR=$withval/include
- if test -f "$withval/lib64/libmysqlclient.a"; then
- MYSQL_LIBDIR=$withval/lib64
- else
- MYSQL_LIBDIR=$withval/lib
- fi
- MYSQL_BINDIR=$withval/bin
- else
- AC_MSG_RESULT(no)
- AC_MSG_ERROR(Invalid MySQL directory $withval - unable to find mysql.h under $withval)
- fi
+ if test -f $withval/include/mysql/mysql.h; then
+ MYSQL_INCDIR=$withval/include/mysql
+ if test -f $withval/lib64/mysql/libmysqlclient.a; then
+ MYSQL_LIBDIR=$withval/lib64/mysql
+ else
+ MYSQL_LIBDIR=$withval/lib/mysql
+ # Solaris ...
+ if test -f $withval/lib/libmysqlclient.so; then
+ MYSQL_LIBDIR=$withval/lib
+ fi
+ fi
+ MYSQL_BINDIR=$withval/bin
+ elif test -f $withval/include/mysql.h; then
+ MYSQL_INCDIR=$withval/include
+ if test -f "$withval/lib64/libmysqlclient.a"; then
+ MYSQL_LIBDIR=$withval/lib64
+ else
+ MYSQL_LIBDIR=$withval/lib
+ fi
+ MYSQL_BINDIR=$withval/bin
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(Invalid MySQL directory $withval - unable to find mysql.h under $withval)
+ fi
fi
SQL_INCLUDE=-I$MYSQL_INCDIR
if test -f "$MYSQL_LIBDIR/libmysqlclient_r.a"; then
elif test -f $withval/include/postgresql/libpq-fe.h; then
POSTGRESQL_INCDIR=$withval/include/postgresql
if test -d $withval/lib64; then
- POSTGRESQL_LIBDIR=$withval/lib64
+ POSTGRESQL_LIBDIR=$withval/lib64
else
- POSTGRESQL_LIBDIR=$withval/lib
+ POSTGRESQL_LIBDIR=$withval/lib
fi
POSTGRESQL_BINDIR=$withval/bin
else
if test "$withval" != "no"; then
if test "$withval" = "yes"; then
- if test -f /usr/local/mysql/include/mysql/mysql.h; then
- MYSQL_INCDIR=/usr/local/mysql/include/mysql
- if test -f /usr/local/mysql/lib64/mysql/libmysqlclient.a; then
- MYSQL_LIBDIR=/usr/local/mysql/lib64/mysql
- else
- MYSQL_LIBDIR=/usr/local/mysql/lib/mysql
- fi
- MYSQL_BINDIR=/usr/local/mysql/bin
- elif test -f /usr/include/mysql/mysql.h; then
- MYSQL_INCDIR=/usr/include/mysql
- if test -f /usr/lib64/mysql/libmysqlclient.a; then
- MYSQL_LIBDIR=/usr/lib64/mysql
- else
- MYSQL_LIBDIR=/usr/lib/mysql
- fi
- MYSQL_BINDIR=/usr/bin
- elif test -f /usr/include/mysql.h; then
- MYSQL_INCDIR=/usr/include
- if test -f /usr/lib64/libmysqlclient.a; then
- MYSQL_LIBDIR=/usr/lib64
- else
- MYSQL_LIBDIR=/usr/lib
- fi
- MYSQL_BINDIR=/usr/bin
- elif test -f /usr/local/include/mysql/mysql.h; then
- MYSQL_INCDIR=/usr/local/include/mysql
- if test -f /usr/local/lib64/mysql/libmysqlclient.a; then
- MYSQL_LIBDIR=/usr/local/lib64/mysql
- else
- MYSQL_LIBDIR=/usr/local/lib/mysql
- fi
- MYSQL_BINDIR=/usr/local/bin
- elif test -f /usr/local/include/mysql.h; then
- MYSQL_INCDIR=/usr/local/include
- if test -f /usr/local/lib64/libmysqlclient.a; then
- MYSQL_LIBDIR=/usr/local/lib64
- else
- MYSQL_LIBDIR=/usr/local/lib
- fi
- MYSQL_BINDIR=/usr/local/bin
- else
- echo "$as_me:$LINENO: result: no" >&5
+ if test -f /usr/local/mysql/include/mysql/mysql.h; then
+ MYSQL_INCDIR=/usr/local/mysql/include/mysql
+ if test -f /usr/local/mysql/lib64/mysql/libmysqlclient.a; then
+ MYSQL_LIBDIR=/usr/local/mysql/lib64/mysql
+ else
+ MYSQL_LIBDIR=/usr/local/mysql/lib/mysql
+ fi
+ MYSQL_BINDIR=/usr/local/mysql/bin
+ elif test -f /usr/include/mysql/mysql.h; then
+ MYSQL_INCDIR=/usr/include/mysql
+ if test -f /usr/lib64/mysql/libmysqlclient.a; then
+ MYSQL_LIBDIR=/usr/lib64/mysql
+ else
+ MYSQL_LIBDIR=/usr/lib/mysql
+ fi
+ MYSQL_BINDIR=/usr/bin
+ elif test -f /usr/include/mysql.h; then
+ MYSQL_INCDIR=/usr/include
+ if test -f /usr/lib64/libmysqlclient.a; then
+ MYSQL_LIBDIR=/usr/lib64
+ else
+ MYSQL_LIBDIR=/usr/lib
+ fi
+ MYSQL_BINDIR=/usr/bin
+ elif test -f /usr/local/include/mysql/mysql.h; then
+ MYSQL_INCDIR=/usr/local/include/mysql
+ if test -f /usr/local/lib64/mysql/libmysqlclient.a; then
+ MYSQL_LIBDIR=/usr/local/lib64/mysql
+ else
+ MYSQL_LIBDIR=/usr/local/lib/mysql
+ fi
+ MYSQL_BINDIR=/usr/local/bin
+ elif test -f /usr/local/include/mysql.h; then
+ MYSQL_INCDIR=/usr/local/include
+ if test -f /usr/local/lib64/libmysqlclient.a; then
+ MYSQL_LIBDIR=/usr/local/lib64
+ else
+ MYSQL_LIBDIR=/usr/local/lib
+ fi
+ MYSQL_BINDIR=/usr/local/bin
+ else
+ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
- { { echo "$as_me:$LINENO: error: Unable to find mysql.h in standard locations" >&5
+ { { echo "$as_me:$LINENO: error: Unable to find mysql.h in standard locations" >&5
echo "$as_me: error: Unable to find mysql.h in standard locations" >&2;}
{ (exit 1); exit 1; }; }
- fi
+ fi
else
- if test -f $withval/include/mysql/mysql.h; then
- MYSQL_INCDIR=$withval/include/mysql
- if test -f $withval/lib64/mysql/libmysqlclient.a; then
- MYSQL_LIBDIR=$withval/lib64/mysql
- else
- MYSQL_LIBDIR=$withval/lib/mysql
- fi
- MYSQL_BINDIR=$withval/bin
- elif test -f $withval/include/mysql.h; then
- MYSQL_INCDIR=$withval/include
- if test -f "$withval/lib64/libmysqlclient.a"; then
- MYSQL_LIBDIR=$withval/lib64
- else
- MYSQL_LIBDIR=$withval/lib
- fi
- MYSQL_BINDIR=$withval/bin
- else
- echo "$as_me:$LINENO: result: no" >&5
+ if test -f $withval/include/mysql/mysql.h; then
+ MYSQL_INCDIR=$withval/include/mysql
+ if test -f $withval/lib64/mysql/libmysqlclient.a; then
+ MYSQL_LIBDIR=$withval/lib64/mysql
+ else
+ MYSQL_LIBDIR=$withval/lib/mysql
+ # Solaris ...
+ if test -f $withval/lib/libmysqlclient.so; then
+ MYSQL_LIBDIR=$withval/lib
+ fi
+ fi
+ MYSQL_BINDIR=$withval/bin
+ elif test -f $withval/include/mysql.h; then
+ MYSQL_INCDIR=$withval/include
+ if test -f "$withval/lib64/libmysqlclient.a"; then
+ MYSQL_LIBDIR=$withval/lib64
+ else
+ MYSQL_LIBDIR=$withval/lib
+ fi
+ MYSQL_BINDIR=$withval/bin
+ else
+ echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
- { { echo "$as_me:$LINENO: error: Invalid MySQL directory $withval - unable to find mysql.h under $withval" >&5
+ { { echo "$as_me:$LINENO: error: Invalid MySQL directory $withval - unable to find mysql.h under $withval" >&5
echo "$as_me: error: Invalid MySQL directory $withval - unable to find mysql.h under $withval" >&2;}
{ (exit 1); exit 1; }; }
- fi
+ fi
fi
SQL_INCLUDE=-I$MYSQL_INCDIR
- if test -f $MYSQL_LIBDIR/libmysqlclient_r.a; then
+ if test -f "$MYSQL_LIBDIR/libmysqlclient_r.a"; then
SQL_LFLAGS="-L$MYSQL_LIBDIR -lmysqlclient_r -lz"
cat >>confdefs.h <<\_ACEOF
#define HAVE_THREAD_SAFE_MYSQL 1
MTX=@MTX@
+# mt status output
+# SunOS No Additional Sense
+# FreeBSD Current Driver State: at rest.
+# Linux ONLINE
+
+OS=`uname`
+case ${OS} in
+ SunOS)
+ ready="No Additional Sense"
+ ;;
+ FreeBSD)
+ ready="Current Driver State: at rest."
+ ;;
+ *)
+ stat="ONLINE"
+ ;;
+esac
+
#
# log whats done
#
# Note, this is very system dependent, so if you are
# not running on Linux, you will probably need to
# re-write it, or at least change the grep target.
+# We've attempted to get the appropriate OS grep targets
+# in the code at the top of this script.
#
wait_for_drive() {
i=0
while [ $i -le 300 ]; do # Wait max 300 seconds
- if mt -f $1 status | grep ONLINE >/dev/null 2>&1; then
+ if mt -f $1 status | grep ${ready} >/dev/null 2>&1; then
break
fi
debug "Device $1 - not ready, retrying..."
#
# shell script to create Bacula SQLite tables
-bindir=@SQL_BINDIR@
-cd @working_dir@
-sqlite=@DB_NAME@
-
-${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
-END-OF-DATA
+touch @working_dir@/bacula.db
exit 0
#!/bin/sh
#
-# shell script to Delete the SQLite Bacula database (same as deleting
-# the tables)
+# shell script to Delete the SQLite tables, we simply delete and recreate
+# the database.
#
rm -f @working_dir@/bacula.db
+touch @working_dir@/bacula.db
FILE *con_fd = NULL; /* Console file descriptor */
brwlock_t con_lock; /* Console lock structure */
-static char *catalog_db = NULL; /* database type */
+static char *catalog_db = NULL; /* database type */
const char *host_os = HOST_OS;
const char *distname = DISTNAME;
term_last_jobs_list();
}
-
+static bool open_dest_file(JCR *jcr, DEST *d, const char *mode)
+{
+ d->fd = fopen(d->where, mode);
+ if (!d->fd) {
+ berrno be;
+ d->fd = stdout;
+ Qmsg2(jcr, M_ERROR, 0, _("fopen %s failed: ERR=%s\n"), d->where,
+ be.strerror());
+ d->fd = NULL;
+ return false;
+ }
+ return true;
+}
/*
* Handle sending the message to the appropriate place
int len, dtlen;
MSGS *msgs;
BPIPE *bpipe;
+ char *mode;
Dmsg2(850, "Enter dispatch_msg type=%d msg=%s", type, msg);
}
fputs(msg, d->fd);
break;
+ case MD_APPEND:
+ Dmsg1(850, "APPEND for following msg: %s", msg);
+ mode = "ab";
+ goto send_to_file;
case MD_FILE:
Dmsg1(850, "FILE for following msg: %s", msg);
- if (!d->fd) {
- d->fd = fopen(d->where, "w+b");
- if (!d->fd) {
- berrno be;
- d->fd = stdout;
- Qmsg2(jcr, M_ERROR, 0, _("fopen %s failed: ERR=%s\n"), d->where,
- be.strerror());
- d->fd = NULL;
- break;
- }
+ mode = "w+b";
+send_to_file:
+ if (!d->fd && !open_dest_file(jcr, d, mode)) {
+ break;
}
fputs(dt, d->fd);
fputs(msg, d->fd);
- break;
- case MD_APPEND:
- Dmsg1(850, "APPEND for following msg: %s", msg);
- if (!d->fd) {
- d->fd = fopen(d->where, "ab");
- if (!d->fd) {
- berrno be;
- d->fd = stdout;
- Qmsg2(jcr, M_ERROR, 0, _("fopen %s failed: ERR=%s\n"), d->where,
- be.strerror());
- d->fd = NULL;
- break;
+ /* On error, we close and reopen to handle log rotation */
+ if (ferror(d->fd)) {
+ fclose(d->fd);
+ if (open_dest_file(jcr, d, mode)) {
+ fputs(dt, d->fd);
+ fputs(msg, d->fd);
}
}
- fputs(dt, d->fd);
- fputs(msg, d->fd);
break;
case MD_DIRECTOR:
Dmsg1(850, "DIRECTOR for following msg: %s", msg);
_("3304 Issuing autochanger \"load slot %d, drive %d\" command.\n"),
slot, drive);
dcr->VolCatInfo.Slot = slot; /* slot to be loaded */
- changer = edit_device_codes(dcr, changer,
- dcr->device->changer_command, "load");
+ changer = edit_device_codes(dcr, changer, dcr->device->changer_command, "load");
dev->close();
Dmsg1(200, "Run program=%s\n", changer);
status = run_program(changer, timeout, NULL);
{
JCR *jcr = dcr->jcr;
DEVICE *dev = dcr->dev;
- POOLMEM *changer, *results;
int status, loaded;
uint32_t timeout = dcr->device->max_changer_wait;
int drive = dcr->dev->drive_index;
+ POOL_MEM results(PM_MESSAGE);
+ POOLMEM *changer;
if (!dev->is_autochanger()) {
return -1;
return dev->Slot;
}
- results = get_pool_memory(PM_MESSAGE);
- changer = get_pool_memory(PM_FNAME);
-
-
/* Find out what is loaded, zero means device is unloaded */
+ changer = get_pool_memory(PM_FNAME);
lock_changer(dcr);
Jmsg(jcr, M_INFO, 0, _("3301 Issuing autochanger \"loaded? drive %d\" command.\n"),
drive);
changer = edit_device_codes(dcr, changer, dcr->device->changer_command, "loaded");
- *results = 0;
+ *results.c_str() = 0;
Dmsg1(100, "Run program=%s\n", changer);
- status = run_program(changer, timeout, results);
- Dmsg3(100, "run_prog: %s stat=%d result=%s\n", changer, status, results);
+ status = run_program_full_output(changer, timeout, results.c_str());
+ Dmsg3(100, "run_prog: %s stat=%d result=%s\n", changer, status, results.c_str());
if (status == 0) {
- loaded = str_to_int32(results);
+ loaded = str_to_int32(results.c_str());
if (loaded > 0) {
Jmsg(jcr, M_INFO, 0, _("3302 Autochanger \"loaded? drive %d\", result is Slot %d.\n"),
drive, loaded);
} else {
berrno be;
be.set_errno(status);
- Jmsg(jcr, M_INFO, 0, _("3991 Bad autochanger \"loaded? drive %d\" command: ERR=%s.\n"),
- drive, be.strerror());
+ Jmsg(jcr, M_INFO, 0, _("3991 Bad autochanger \"loaded? drive %d\" command: "
+ "ERR=%s.\nResults=%s\n"), drive, be.strerror(), results.c_str());
loaded = -1; /* force unload */
}
unlock_changer(dcr);
free_pool_memory(changer);
- free_pool_memory(results);
return loaded;
}
}
if (loaded > 0) {
+ POOL_MEM results(PM_MESSAGE);
POOLMEM *changer = get_pool_memory(PM_FNAME);
lock_changer(dcr);
Jmsg(jcr, M_INFO, 0,
dcr->device->changer_command, "unload");
dev->close();
Dmsg1(100, "Run program=%s\n", changer);
- int stat = run_program(changer, timeout, NULL);
+ *results.c_str() = 0;
+ int stat = run_program_full_output(changer, timeout, results.c_str());
dcr->VolCatInfo.Slot = slot;
if (stat != 0) {
berrno be;
be.set_errno(stat);
- Jmsg(jcr, M_INFO, 0, _("3995 Bad autochanger \"unload slot %d, drive %d\": ERR=%s.\n"),
- slot, dev->drive_index, be.strerror());
+ Jmsg(jcr, M_INFO, 0, _("3995 Bad autochanger \"unload slot %d, drive %d\": "
+ "ERR=%s\nResults=%s\n"),
+ loaded, dev->drive_index, be.strerror(), results.c_str());
ok = false;
dev->Slot = -1; /* unknown */
} else {
}
free_restore_volume_list(jcr);
+ dev->close();
set_volume_name("TestVolume2", 2);
jcr->bsr = NULL;
create_restore_volume_list(jcr);
- dev->close();
if (!acquire_device_for_read(dcr)) {
Pmsg2(0, _("Cannot open Dev=%s, Vol=%s\n"), dev->print_name(), dcr->VolumeName);
return false;
*/
#undef VERSION
-#define VERSION "1.39.24"
-#define BDATE "02 October 2006"
-#define LSMDATE "02Oct06"
+#define VERSION "1.39.25"
+#define BDATE "07 October 2006"
+#define LSMDATE "07Oct06"
#define BYEAR "2006" /* year for copyright messages in progs */
/* Debug flags */
Technical notes on version 1.39
General:
+07Oct06
+kes Begin work on new GUI "console".
+kes Make configure look in non-standard MySQL library directory
+ for Solaris.
+kes Make mtx-changer automatically configure the autochanger wait
+ procedure for Solaris, FreeBSD, and Linux. Previously, only Linux
+ was implemented.
+kes Correct drop_sqlite_tables.in script to not delete the database.
+kes When writing to a log file, close and reopen the file descriptor
+ if there is an error writing the file.
+kes Modify the autochanger loaded?, load, and unload commands to print
+ the full text of any mtx output if there is an error. Helps to
+ ease diagnosis of autochanger problems.
+kes Correct a few Win32 errno returns in the VSS code so that hopefully
+ a resonable Win32 error message will be printed.
+kes Convert a few strcat()... to bstrncat() in the Win32 code.
+
+Version 1.39.24 released:
02Oct06
kes Apply dvd find volume patch from Richard Mortimer.
kes Eliminate the dvd specific mount routines using only the
dev->mount/unmount.
kes Make update_free_space a method of DEVICE and rename
update_freespace.
-01Sep06
+01Oct06
kes Require a messages command acl to be able to receive messages
in a console.
kes Add console, system, and scan job types in util.c.