Index: head/sysutils/bacula/Makefile =================================================================== --- head/sysutils/bacula/Makefile (revision 99896) +++ head/sysutils/bacula/Makefile (revision 99897) @@ -1,164 +1,165 @@ # New ports collection makefile for: bacula # Date created: 24 February 2003 # Whom: Dmitry Sivachenko # # $FreeBSD$ # PORTNAME= bacula -PORTVERSION= 1.32f -PORTREVISION= 1 +PORTVERSION= 1.32f4 +#PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= bacula +DISTNAME= ${PORTNAME}-1.32f-4 MAINTAINER= Lars.Koeller@Uni-Bielefeld.DE COMMENT= The network backup solution # The user/group IDs below are registered, see # http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/book.html#DADS-UID # BACULA_DIR=/var/db/bacula # USE_REINPLACE= yes GNU_CONFIGURE= yes CONFIGURE_ARGS= --with-tcp-wrappers=/usr/lib \ --enable-smartalloc \ --with-working-dir=${BACULA_DIR} \ --with-fd-user=root \ --with-fd-group=wheel \ --with-dir-user=bacula \ --with-dir-group=bacula \ --with-sd-user=bacula \ --with-sd-group=operator CONFIGURE_ENV+= CPPFLAGS="-I${LOCALBASE}/include" \ LDFLAGS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}" # Default is full build with sqlite .if defined(WITH_CLIENT_ONLY) CONFIGURE_ARGS+= --enable-client-only PLIST_SUB+= SERVER="@comment " .else .if defined(WITH_MYSQL) CONFIGURE_ARGS+= --with-mysql=${LOCALBASE} LIB_DEPENDS+= mysqlclient.10:${PORTSDIR}/databases/mysql323-client DBTYPE= mysql .else CONFIGURE_ARGS+= --with-sqlite=yes LIB_DEPENDS+= sqlite.2:${PORTSDIR}/databases/sqlite DBTYPE= sqlite .endif PLIST_SUB+= DBTYPE=${DBTYPE} PLIST_SUB+= SERVER="" .endif .include PORTDOCS= bacula.pdf html-manual/* pre-everything:: .if !defined(WITH_CLIENT_ONLY) @${ECHO_MSG} "=======> ATTENTION <=======" @${ECHO_MSG} "===> Note that there is a pthreads problem, which leads to the loss of 500kB" @${ECHO_MSG} "===> of data at the end of an tape. This is corrected in FreeBSD" @${ECHO_MSG} "===> 4.9-RELEASE and 5.2-RELEASE or use the -stable or -current tree." @${ECHO_MSG} "" @${ECHO_MSG} "You may use the following build options:" @${ECHO_MSG} "" @${ECHO_MSG} " WITH_CLIENT_ONLY=yes if you only want the file daemon." .if !defined(WITH_MYSQL) @${ECHO_MSG} " WITH_MYSQL=yes if you want MySQL instead of SqLite as the database." .else @${ECHO_MSG} "" @${ECHO_MSG} "===> Using MySQL as the bacula database." .endif @${ECHO_MSG} "" .else @${ECHO_MSG} "===> Building file daemon only." .endif post-patch: @${REINPLACE_CMD} -e 's|-pthread|${PTHREAD_CFLAGS}|g' ${WRKSRC}/configure post-install: .if defined(WITH_CLIENT_ONLY) # Extend only /etc/services @ ${SETENV} PKG_PREFIX=${PREFIX} \ ${SH} ${PKGINSTALL} ${PORTNAME} # don't know how to make it better ${RM} -f ${PREFIX}/etc/rc.d/bacula.sh.sample .else # Extend /etc/services and install UID/GID @ ${SETENV} PKG_PREFIX=${PREFIX} \ ${SH} ${PKGINSTALL} ${PORTNAME} POST-INSTALL # Install config files and preserve existing ones ${INSTALL_SCRIPT} ${FILESDIR}/chio-bacula ${PREFIX}/sbin if [ -f ${PREFIX}/etc/bacula-barcodes ]; then \ ${INSTALL_DATA} ${FILESDIR}/bacula-barcodes ${PREFIX}/etc/bacula-barcodes.new ; \ ${ECHO_CMD} "etc/bacula-barcodes.new" >> ${TMPPLIST}; \ else \ ${INSTALL_DATA} ${FILESDIR}/bacula-barcodes ${PREFIX}/etc ; \ ${ECHO_CMD} "etc/bacula-barcodes" >> ${TMPPLIST}; \ fi if [ -f ${PREFIX}/etc/console.conf.new ]; then \ ${ECHO_CMD} "etc/console.conf.new" >> ${TMPPLIST}; \ elif [ -f ${PREFIX}/etc/console.conf ]; then \ ${ECHO_CMD} "etc/console.conf" >> ${TMPPLIST}; \ fi # chmod of smtp program so bacula can use it with dropped down permissions ${CHMOD} o+x ${PREFIX}/sbin/smtp ${CHOWN} -R bacula:bacula ${PREFIX}/share/bacula .endif # Install leaves existing conf files untouched. Respect this here! for na in sd fd dir; do \ if [ -f ${PREFIX}/etc/bacula-$$na.conf.new ]; then \ ${ECHO_CMD} "etc/bacula-$$na.conf.new" >> ${TMPPLIST}; \ elif [ -f ${PREFIX}/etc/bacula-$$na.conf ]; then \ ${ECHO_CMD} "etc/bacula-$$na.conf" >> ${TMPPLIST}; \ fi \ done; \ .if !defined(NOPORTDOCS) ${MKDIR} ${DOCSDIR}/html-manual ${INSTALL_DATA} ${WRKSRC}/doc/bacula.pdf ${DOCSDIR} cd ${WRKSRC}/doc && ${FIND} html-manual | \ ${CPIO} -pdm -L -R root:wheel ${DOCSDIR} .endif # Inform user after install about important things .... .if !defined(WITH_CLIENT_ONLY) @${ECHO_MSG} "*******************************************************" @${ECHO_MSG} "NOTE:" @${ECHO_MSG} "" @${ECHO_MSG} "An auto-changer manipulation script based on FreeBSDs" @${ECHO_MSG} "chio command is included and installed at" @${ECHO_MSG} "" @${ECHO_MSG} " ${PREFIX}/sbin/chio-bacula" @${ECHO_MSG} "" @${ECHO_MSG} "Please have a look at it if you want to use an" @${ECHO_MSG} "auto-changer. You have to configure the usage in" @${ECHO_MSG} "" @${ECHO_MSG} " ${PREFIX}/etc/bacula-dir.conf" @${ECHO_MSG} "" @${ECHO_MSG} "Take care of correct permissions for changer and" @${ECHO_MSG} "tape device (e.g. /dev/ch0 and /dev/n[r]sa0) i.e." @${ECHO_MSG} "they must be accesable by user bacula." @${ECHO_MSG} "" @${ECHO_MSG} "Due to lack of some features in the FreeBSD tape driver" @${ECHO_MSG} "implemtation you MUST add some OS dependent options to" @${ECHO_MSG} "the bacula-sd.conf file:" @${ECHO_MSG} "" @${ECHO_MSG} " Backward Space Record = no;" @${ECHO_MSG} " Hardware End of Medium = no;" @${ECHO_MSG} " Fast Forward Space File = no;" @${ECHO_MSG} " BSF at EOM = yes;" @${ECHO_MSG} "" @${ECHO_MSG} "It is also important that all the scripts accessed" @${ECHO_MSG} "by RunBeforeJob and RunAfterJob could be executed by" @${ECHO_MSG} "the user bacula, too." @${ECHO_MSG} "" @${ECHO_MSG} "*******************************************************" .endif .include Property changes on: head/sysutils/bacula/Makefile ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.12 \ No newline at end of property +1.13 \ No newline at end of property Index: head/sysutils/bacula/distinfo =================================================================== --- head/sysutils/bacula/distinfo (revision 99896) +++ head/sysutils/bacula/distinfo (revision 99897) @@ -1 +1 @@ -MD5 (bacula-1.32f.tar.gz) = 2c635cf693262fc946eb13aa271e0263 +MD5 (bacula-1.32f-4.tar.gz) = 7880dc20db5c9833dcecb29e31a631a5 Property changes on: head/sysutils/bacula/distinfo ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.6 \ No newline at end of property +1.7 \ No newline at end of property Index: head/sysutils/bacula/files/patch-weekofmonth =================================================================== --- head/sysutils/bacula/files/patch-weekofmonth (revision 99896) +++ head/sysutils/bacula/files/patch-weekofmonth (nonexistent) @@ -1,62 +0,0 @@ - -This patch fixes an incorrect calculation of the week -of the month reported by Volker Sauer. It should work on either -1.32e or 1.32f. - -Apply the patch with: - - cd - patch -p0 <1.32f-weekofmonth.patch - make - ... - -Index: src/dird/scheduler.c -=================================================================== -RCS file: /cvsroot/bacula/bacula/src/dird/scheduler.c,v -retrieving revision 1.13.6.1 -diff -u -b -r1.13.6.1 scheduler.c ---- src/dird/scheduler.c 21 Dec 2003 15:17:42 -0000 1.13.6.1 -+++ src/dird/scheduler.c 6 Jan 2004 09:43:31 -0000 -@@ -205,7 +205,7 @@ - mday = tm.tm_mday - 1; - wday = tm.tm_wday; - month = tm.tm_mon; -- wom = tm_wom(tm.tm_mday, tm.tm_wday); /* get week of month */ -+ wom = mday / 7; - woy = tm_woy(now); /* get week of year */ - - /* Loop through all jobs */ -@@ -237,7 +237,7 @@ - if (bit_is_set(next_hour, run->hour)) { - tm.tm_hour++; - if (tm.tm_hour > 23) { -- tm.tm_hour = 0; -+ continue; /* next day */ - } - runtime = mktime(&tm); - add_job(job, run, now, runtime); -Index: src/dird/ua_output.c -=================================================================== -RCS file: /cvsroot/bacula/bacula/src/dird/ua_output.c,v -retrieving revision 1.25.2.11.2.3 -diff -u -b -r1.25.2.11.2.3 ua_output.c ---- src/dird/ua_output.c 21 Dec 2003 15:17:42 -0000 1.25.2.11.2.3 -+++ src/dird/ua_output.c 6 Jan 2004 09:43:32 -0000 -@@ -454,7 +454,7 @@ - mday = tm.tm_mday - 1; - wday = tm.tm_wday; - month = tm.tm_mon; -- wom = tm_wom(tm.tm_mday, tm.tm_wday); -+ wom = mday / 7; - woy = tm_woy(now); - - /* Break down tomorrow into components */ -@@ -463,7 +463,7 @@ - tmday = tm.tm_mday - 1; - twday = tm.tm_wday; - tmonth = tm.tm_mon; -- twom = tm_wom(tm.tm_mday, tm.tm_wday); -+ twom = tmday / 7; - twoy = tm_woy(tomorrow); - - if (run == NULL) { Property changes on: head/sysutils/bacula/files/patch-weekofmonth ___________________________________________________________________ Deleted: cvs2svn:cvs-rev ## -1 +0,0 ## -1.1 \ No newline at end of property Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Index: head/sysutils/bacula/files/patch-eom-nextvol =================================================================== --- head/sysutils/bacula/files/patch-eom-nextvol (revision 99896) +++ head/sysutils/bacula/files/patch-eom-nextvol (nonexistent) @@ -1,278 +0,0 @@ - -This patch fixes two bugs. -1. Reported by Phil: where when the end of a Volume was reached, - Bacula went into a loop requesting the next Volume then gave up. -2. Reported by Lars: the order of the next Volume selected by Bacula - was not as expected. - -Apply the patch with: - - cd - patch -p0 <1.32f-2-eom-nextvol.patch - make - ... - -Index: ReleaseNotes -=================================================================== -RCS file: /cvsroot/bacula/bacula/ReleaseNotes,v -retrieving revision 1.52.2.9.2.7 -retrieving revision 1.52.2.9.2.8 -diff -u -b -r1.52.2.9.2.7 -r1.52.2.9.2.8 ---- ReleaseNotes 31 Dec 2003 09:10:55 -0000 1.52.2.9.2.7 -+++ ReleaseNotes 5 Jan 2004 16:49:44 -0000 1.52.2.9.2.8 -@@ -1,7 +1,14 @@ - -- Release Notes for Bacula 1.32f -+ Release Notes for Bacula 1.32g - - Bacula code: Total files = 262 Total lines = 80,318 (*.h *.c *.in) -+ -+Changes since 1.32f -+- Fix bug reported by Phil (could not duplicate here) where at the end -+ of a Volume, Bacula wanted a new Volume and got into a loop requesting -+ it, then gave up. -+- Modify selection of next Volume to select most currently appended Volume, -+ or if none oldest recycled Volume (problem reported by Lars). - - Changes since 1.32e: - - Note, this change affects only the Win32 FD. -Index: src/cats/sql_find.c -=================================================================== -RCS file: /cvsroot/bacula/bacula/src/cats/sql_find.c,v -retrieving revision 1.23.2.7.2.1 -retrieving revision 1.23.2.7.2.2 -diff -u -b -r1.23.2.7.2.1 -r1.23.2.7.2.2 ---- src/cats/sql_find.c 7 Dec 2003 15:01:42 -0000 1.23.2.7.2.1 -+++ src/cats/sql_find.c 5 Jan 2004 16:49:45 -0000 1.23.2.7.2.2 -@@ -7,7 +7,7 @@ - * - * Kern Sibbald, December 2000 - * -- * Version $Id: sql_find.c,v 1.23.2.7.2.1 2003/12/07 15:01:42 kerns Exp $ -+ * Version $Id: sql_find.c,v 1.23.2.7.2.2 2004/01/05 16:49:45 kerns Exp $ - */ - - /* -@@ -218,6 +218,7 @@ - { - SQL_ROW row; - int numrows; -+ char *order; - - db_lock(mdb); - if (item == -1) { /* find oldest volume */ -@@ -232,12 +233,19 @@ - item = 1; - } else { - /* Find next available volume */ -+ if (strcmp(mr->VolStatus, "Recycled") == 0 || -+ strcmp(mr->VolStatus, "Purged") == 0) { -+ order = "ORDER BY LastWritten ASC,MediaId"; /* take oldest */ -+ } else { -+ order = "ORDER BY LastWritten DESC,MediaId"; /* take most recently written */ -+ } - Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks," --"VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes," --"VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,Recycle,Slot," --"FirstWritten,LastWritten,VolStatus " --"FROM Media WHERE PoolId=%u AND MediaType='%s' AND VolStatus='%s' " --"ORDER BY LastWritten,MediaId", mr->PoolId, mr->MediaType, mr->VolStatus); -+ "VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes," -+ "VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,Recycle,Slot," -+ "FirstWritten,LastWritten,VolStatus " -+ "FROM Media WHERE PoolId=%u AND MediaType='%s' AND VolStatus='%s' " -+ "%s LIMIT 1", -+ mr->PoolId, mr->MediaType, mr->VolStatus, order); - } - if (!QUERY_DB(jcr, mdb, mdb->cmd)) { - db_unlock(mdb); -Index: src/stored/mount.c -=================================================================== -RCS file: /cvsroot/bacula/bacula/src/stored/mount.c,v -retrieving revision 1.42.2.9.2.3 -retrieving revision 1.42.2.9.2.4 -diff -u -b -r1.42.2.9.2.3 -r1.42.2.9.2.4 ---- src/stored/mount.c 8 Dec 2003 20:53:47 -0000 1.42.2.9.2.3 -+++ src/stored/mount.c 5 Jan 2004 16:49:45 -0000 1.42.2.9.2.4 -@@ -5,7 +5,7 @@ - * - * Kern Sibbald, August MMII - * -- * Version $Id: mount.c,v 1.42.2.9.2.3 2003/12/08 20:53:47 kerns Exp $ -+ * Version $Id: mount.c,v 1.42.2.9.2.4 2004/01/05 16:49:45 kerns Exp $ - */ - /* - Copyright (C) 2000-2003 Kern Sibbald and John Walker -@@ -30,7 +30,8 @@ - #include "bacula.h" /* pull in global headers */ - #include "stored.h" /* pull in Storage Deamon headers */ - --/* Forward referenced functions */ -+/* Forward referenced routines */ -+static void mark_volume_in_error(JCR *jcr, DEVICE *dev); - - - /* -@@ -47,11 +48,17 @@ - */ - int mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, int release) - { -- int retry = 0, autochanger; -- bool ask, recycle; -+ int retry = 0; -+ bool ask = false, recycle, autochanger; -+ int vol_label_status; - - Dmsg0(100, "Enter mount_next_volume()\n"); - -+ /* -+ * Attempt to mount the next volume. If something non-fatal goes -+ * wrong, we come back here to re-try (new op messages, re-read -+ * Volume, ...) -+ */ - mount_next_vol: - if (retry++ > 5) { - Jmsg(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s.\n"), -@@ -62,8 +69,8 @@ - Jmsg(jcr, M_FATAL, 0, _("Job %d canceled.\n"), jcr->JobId); - return 0; - } -- autochanger = 0; -- recycle = ask = false; -+ autochanger = false; /* Assume no autochanger */ -+ recycle = false; - if (release) { - Dmsg0(100, "mount_next_volume release=1\n"); - release_volume(jcr, dev); -@@ -97,15 +104,10 @@ - * It assumes that the device is not already in use! - * - */ -- -- - dev->state &= ~(ST_APPEND|ST_READ|ST_EOT|ST_WEOT|ST_EOF); - -- for ( ;; ) { -- int vol_label_status; - autochanger = autoload_device(jcr, dev, 1, NULL); - Dmsg1(100, "autoload_dev returns %d\n", autochanger); -- - /* - * If we autochanged to correct Volume or (we have not just - * released the Volume AND we can automount) we go ahead -@@ -116,7 +118,7 @@ - ask = false; /* don't ask SYSOP this time */ - } - Dmsg2(100, "Ask=%d autochanger=%d\n", ask, autochanger); -- release = 1; /* release next time if we "recurse" */ -+ release = true; /* release next time if we "recurse" */ - - if (ask && !dir_ask_sysop_to_mount_next_volume(jcr, dev)) { - Dmsg0(100, "Error return ask_sysop ...\n"); -@@ -181,14 +183,15 @@ - /* Check if this is a valid Volume in the pool */ - pm_strcpy(&jcr->VolumeName, dev->VolHdr.VolName); - if (!dir_get_volume_info(jcr, GET_VOL_INFO_FOR_WRITE)) { -- Mmsg(&jcr->errmsg, _("Director wanted Volume \"%s\".\n" -+ Jmsg(jcr, M_WARNING, 0, _("Director wanted Volume \"%s\".\n" - " Current Volume \"%s\" not acceptable because:\n" - " %s"), - VolCatInfo.VolCatName, dev->VolHdr.VolName, - jcr->dir_bsock->msg); - /* Restore desired volume name, note device info out of sync */ - memcpy(&jcr->VolCatInfo, &VolCatInfo, sizeof(jcr->VolCatInfo)); -- goto mount_error; -+ ask = true; -+ goto mount_next_vol; - } - Dmsg1(100, "want new name=%s\n", jcr->VolumeName); - memcpy(&dev->VolCatInfo, &jcr->VolCatInfo, sizeof(dev->VolCatInfo)); -@@ -230,15 +233,11 @@ - /* NOTE! Fall-through wanted. */ - case VOL_NO_MEDIA: - default: --mount_error: - /* Send error message */ - Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg); - ask = true; -- /* was - goto ask_again; */ - goto mount_next_vol; - } -- break; -- } - - /* - * See if we have a fresh tape or a tape with data. -@@ -322,6 +321,10 @@ - Jmsg(jcr, M_INFO, 0, _("Wrote label to prelabeled Volume \"%s\" on device %s\n"), - jcr->VolumeName, dev_name(dev)); - } -+ /* -+ * End writing real Volume label (from pre-labeled tape), or recycling -+ * the volume. -+ */ - - } else { - /* -@@ -335,11 +338,7 @@ - if (!eod_dev(dev)) { - Jmsg(jcr, M_ERROR, 0, _("Unable to position to end of data %s. ERR=%s\n"), - dev_name(dev), strerror_dev(dev)); -- Jmsg(jcr, M_INFO, 0, _("Marking Volume \"%s\" in Error in Catalog.\n"), -- jcr->VolumeName); -- bstrncpy(dev->VolCatInfo.VolCatStatus, "Error", sizeof(dev->VolCatInfo.VolCatStatus)); -- Dmsg0(100, "dir_update_vol_info. Set Error.\n"); -- dir_update_volume_info(jcr, dev, 0); -+ mark_volume_in_error(jcr, dev); - goto mount_next_vol; - } - /* *****FIXME**** we should do some checking for files too */ -@@ -355,9 +354,7 @@ - Jmsg(jcr, M_ERROR, 0, _("I canot write on this volume because:\n\ - The number of files mismatch! Volume=%u Catalog=%u\n"), - dev_file(dev), dev->VolCatInfo.VolCatFiles); -- bstrncpy(dev->VolCatInfo.VolCatStatus, "Error", sizeof(dev->VolCatInfo.VolCatStatus)); -- Dmsg0(100, "dir_update_vol_info. Set Error.\n"); -- dir_update_volume_info(jcr, dev, 0); -+ mark_volume_in_error(jcr, dev); - goto mount_next_vol; - } - } -@@ -372,7 +369,19 @@ - return 1; - } - -+static void mark_volume_in_error(JCR *jcr, DEVICE *dev) -+{ -+ Jmsg(jcr, M_INFO, 0, _("Marking Volume \"%s\" in Error in Catalog.\n"), -+ jcr->VolumeName); -+ bstrncpy(dev->VolCatInfo.VolCatStatus, "Error", sizeof(dev->VolCatInfo.VolCatStatus)); -+ Dmsg0(100, "dir_update_vol_info. Set Error.\n"); -+ dir_update_volume_info(jcr, dev, 0); -+} - -+/* -+ * If we are reading, we come here at the end of the tape -+ * and see if there are more volumes to be mounted. -+ */ - int mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) - { - Dmsg2(90, "NumVolumes=%d CurVolume=%d\n", jcr->NumVolumes, jcr->CurVolume); -@@ -399,7 +408,6 @@ - */ - void release_volume(JCR *jcr, DEVICE *dev) - { -- - if (jcr->WroteVol) { - Jmsg0(jcr, M_ERROR, 0, "Hey!!!!! WroteVol non-zero !!!!!\n"); - } -@@ -411,7 +419,8 @@ - memset(&dev->VolCatInfo, 0, sizeof(dev->VolCatInfo)); - memset(&jcr->VolCatInfo, 0, sizeof(jcr->VolCatInfo)); - memset(&dev->VolHdr, 0, sizeof(dev->VolHdr)); -- dev->state &= ~ST_LABEL; /* label not yet read */ -+ /* Force re-read of label */ -+ dev->state &= ~(ST_LABEL|ST_READ|ST_APPEND); - jcr->VolumeName[0] = 0; - - if ((dev->state & ST_OPENED) && Property changes on: head/sysutils/bacula/files/patch-eom-nextvol ___________________________________________________________________ Deleted: cvs2svn:cvs-rev ## -1 +0,0 ## -1.1 \ No newline at end of property Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Index: head/sysutils/bacula-server/Makefile =================================================================== --- head/sysutils/bacula-server/Makefile (revision 99896) +++ head/sysutils/bacula-server/Makefile (revision 99897) @@ -1,164 +1,165 @@ # New ports collection makefile for: bacula # Date created: 24 February 2003 # Whom: Dmitry Sivachenko # # $FreeBSD$ # PORTNAME= bacula -PORTVERSION= 1.32f -PORTREVISION= 1 +PORTVERSION= 1.32f4 +#PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= bacula +DISTNAME= ${PORTNAME}-1.32f-4 MAINTAINER= Lars.Koeller@Uni-Bielefeld.DE COMMENT= The network backup solution # The user/group IDs below are registered, see # http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/book.html#DADS-UID # BACULA_DIR=/var/db/bacula # USE_REINPLACE= yes GNU_CONFIGURE= yes CONFIGURE_ARGS= --with-tcp-wrappers=/usr/lib \ --enable-smartalloc \ --with-working-dir=${BACULA_DIR} \ --with-fd-user=root \ --with-fd-group=wheel \ --with-dir-user=bacula \ --with-dir-group=bacula \ --with-sd-user=bacula \ --with-sd-group=operator CONFIGURE_ENV+= CPPFLAGS="-I${LOCALBASE}/include" \ LDFLAGS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}" # Default is full build with sqlite .if defined(WITH_CLIENT_ONLY) CONFIGURE_ARGS+= --enable-client-only PLIST_SUB+= SERVER="@comment " .else .if defined(WITH_MYSQL) CONFIGURE_ARGS+= --with-mysql=${LOCALBASE} LIB_DEPENDS+= mysqlclient.10:${PORTSDIR}/databases/mysql323-client DBTYPE= mysql .else CONFIGURE_ARGS+= --with-sqlite=yes LIB_DEPENDS+= sqlite.2:${PORTSDIR}/databases/sqlite DBTYPE= sqlite .endif PLIST_SUB+= DBTYPE=${DBTYPE} PLIST_SUB+= SERVER="" .endif .include PORTDOCS= bacula.pdf html-manual/* pre-everything:: .if !defined(WITH_CLIENT_ONLY) @${ECHO_MSG} "=======> ATTENTION <=======" @${ECHO_MSG} "===> Note that there is a pthreads problem, which leads to the loss of 500kB" @${ECHO_MSG} "===> of data at the end of an tape. This is corrected in FreeBSD" @${ECHO_MSG} "===> 4.9-RELEASE and 5.2-RELEASE or use the -stable or -current tree." @${ECHO_MSG} "" @${ECHO_MSG} "You may use the following build options:" @${ECHO_MSG} "" @${ECHO_MSG} " WITH_CLIENT_ONLY=yes if you only want the file daemon." .if !defined(WITH_MYSQL) @${ECHO_MSG} " WITH_MYSQL=yes if you want MySQL instead of SqLite as the database." .else @${ECHO_MSG} "" @${ECHO_MSG} "===> Using MySQL as the bacula database." .endif @${ECHO_MSG} "" .else @${ECHO_MSG} "===> Building file daemon only." .endif post-patch: @${REINPLACE_CMD} -e 's|-pthread|${PTHREAD_CFLAGS}|g' ${WRKSRC}/configure post-install: .if defined(WITH_CLIENT_ONLY) # Extend only /etc/services @ ${SETENV} PKG_PREFIX=${PREFIX} \ ${SH} ${PKGINSTALL} ${PORTNAME} # don't know how to make it better ${RM} -f ${PREFIX}/etc/rc.d/bacula.sh.sample .else # Extend /etc/services and install UID/GID @ ${SETENV} PKG_PREFIX=${PREFIX} \ ${SH} ${PKGINSTALL} ${PORTNAME} POST-INSTALL # Install config files and preserve existing ones ${INSTALL_SCRIPT} ${FILESDIR}/chio-bacula ${PREFIX}/sbin if [ -f ${PREFIX}/etc/bacula-barcodes ]; then \ ${INSTALL_DATA} ${FILESDIR}/bacula-barcodes ${PREFIX}/etc/bacula-barcodes.new ; \ ${ECHO_CMD} "etc/bacula-barcodes.new" >> ${TMPPLIST}; \ else \ ${INSTALL_DATA} ${FILESDIR}/bacula-barcodes ${PREFIX}/etc ; \ ${ECHO_CMD} "etc/bacula-barcodes" >> ${TMPPLIST}; \ fi if [ -f ${PREFIX}/etc/console.conf.new ]; then \ ${ECHO_CMD} "etc/console.conf.new" >> ${TMPPLIST}; \ elif [ -f ${PREFIX}/etc/console.conf ]; then \ ${ECHO_CMD} "etc/console.conf" >> ${TMPPLIST}; \ fi # chmod of smtp program so bacula can use it with dropped down permissions ${CHMOD} o+x ${PREFIX}/sbin/smtp ${CHOWN} -R bacula:bacula ${PREFIX}/share/bacula .endif # Install leaves existing conf files untouched. Respect this here! for na in sd fd dir; do \ if [ -f ${PREFIX}/etc/bacula-$$na.conf.new ]; then \ ${ECHO_CMD} "etc/bacula-$$na.conf.new" >> ${TMPPLIST}; \ elif [ -f ${PREFIX}/etc/bacula-$$na.conf ]; then \ ${ECHO_CMD} "etc/bacula-$$na.conf" >> ${TMPPLIST}; \ fi \ done; \ .if !defined(NOPORTDOCS) ${MKDIR} ${DOCSDIR}/html-manual ${INSTALL_DATA} ${WRKSRC}/doc/bacula.pdf ${DOCSDIR} cd ${WRKSRC}/doc && ${FIND} html-manual | \ ${CPIO} -pdm -L -R root:wheel ${DOCSDIR} .endif # Inform user after install about important things .... .if !defined(WITH_CLIENT_ONLY) @${ECHO_MSG} "*******************************************************" @${ECHO_MSG} "NOTE:" @${ECHO_MSG} "" @${ECHO_MSG} "An auto-changer manipulation script based on FreeBSDs" @${ECHO_MSG} "chio command is included and installed at" @${ECHO_MSG} "" @${ECHO_MSG} " ${PREFIX}/sbin/chio-bacula" @${ECHO_MSG} "" @${ECHO_MSG} "Please have a look at it if you want to use an" @${ECHO_MSG} "auto-changer. You have to configure the usage in" @${ECHO_MSG} "" @${ECHO_MSG} " ${PREFIX}/etc/bacula-dir.conf" @${ECHO_MSG} "" @${ECHO_MSG} "Take care of correct permissions for changer and" @${ECHO_MSG} "tape device (e.g. /dev/ch0 and /dev/n[r]sa0) i.e." @${ECHO_MSG} "they must be accesable by user bacula." @${ECHO_MSG} "" @${ECHO_MSG} "Due to lack of some features in the FreeBSD tape driver" @${ECHO_MSG} "implemtation you MUST add some OS dependent options to" @${ECHO_MSG} "the bacula-sd.conf file:" @${ECHO_MSG} "" @${ECHO_MSG} " Backward Space Record = no;" @${ECHO_MSG} " Hardware End of Medium = no;" @${ECHO_MSG} " Fast Forward Space File = no;" @${ECHO_MSG} " BSF at EOM = yes;" @${ECHO_MSG} "" @${ECHO_MSG} "It is also important that all the scripts accessed" @${ECHO_MSG} "by RunBeforeJob and RunAfterJob could be executed by" @${ECHO_MSG} "the user bacula, too." @${ECHO_MSG} "" @${ECHO_MSG} "*******************************************************" .endif .include Property changes on: head/sysutils/bacula-server/Makefile ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.12 \ No newline at end of property +1.13 \ No newline at end of property Index: head/sysutils/bacula-server/distinfo =================================================================== --- head/sysutils/bacula-server/distinfo (revision 99896) +++ head/sysutils/bacula-server/distinfo (revision 99897) @@ -1 +1 @@ -MD5 (bacula-1.32f.tar.gz) = 2c635cf693262fc946eb13aa271e0263 +MD5 (bacula-1.32f-4.tar.gz) = 7880dc20db5c9833dcecb29e31a631a5 Property changes on: head/sysutils/bacula-server/distinfo ___________________________________________________________________ Modified: cvs2svn:cvs-rev ## -1 +1 ## -1.6 \ No newline at end of property +1.7 \ No newline at end of property Index: head/sysutils/bacula-server/files/patch-weekofmonth =================================================================== --- head/sysutils/bacula-server/files/patch-weekofmonth (revision 99896) +++ head/sysutils/bacula-server/files/patch-weekofmonth (nonexistent) @@ -1,62 +0,0 @@ - -This patch fixes an incorrect calculation of the week -of the month reported by Volker Sauer. It should work on either -1.32e or 1.32f. - -Apply the patch with: - - cd - patch -p0 <1.32f-weekofmonth.patch - make - ... - -Index: src/dird/scheduler.c -=================================================================== -RCS file: /cvsroot/bacula/bacula/src/dird/scheduler.c,v -retrieving revision 1.13.6.1 -diff -u -b -r1.13.6.1 scheduler.c ---- src/dird/scheduler.c 21 Dec 2003 15:17:42 -0000 1.13.6.1 -+++ src/dird/scheduler.c 6 Jan 2004 09:43:31 -0000 -@@ -205,7 +205,7 @@ - mday = tm.tm_mday - 1; - wday = tm.tm_wday; - month = tm.tm_mon; -- wom = tm_wom(tm.tm_mday, tm.tm_wday); /* get week of month */ -+ wom = mday / 7; - woy = tm_woy(now); /* get week of year */ - - /* Loop through all jobs */ -@@ -237,7 +237,7 @@ - if (bit_is_set(next_hour, run->hour)) { - tm.tm_hour++; - if (tm.tm_hour > 23) { -- tm.tm_hour = 0; -+ continue; /* next day */ - } - runtime = mktime(&tm); - add_job(job, run, now, runtime); -Index: src/dird/ua_output.c -=================================================================== -RCS file: /cvsroot/bacula/bacula/src/dird/ua_output.c,v -retrieving revision 1.25.2.11.2.3 -diff -u -b -r1.25.2.11.2.3 ua_output.c ---- src/dird/ua_output.c 21 Dec 2003 15:17:42 -0000 1.25.2.11.2.3 -+++ src/dird/ua_output.c 6 Jan 2004 09:43:32 -0000 -@@ -454,7 +454,7 @@ - mday = tm.tm_mday - 1; - wday = tm.tm_wday; - month = tm.tm_mon; -- wom = tm_wom(tm.tm_mday, tm.tm_wday); -+ wom = mday / 7; - woy = tm_woy(now); - - /* Break down tomorrow into components */ -@@ -463,7 +463,7 @@ - tmday = tm.tm_mday - 1; - twday = tm.tm_wday; - tmonth = tm.tm_mon; -- twom = tm_wom(tm.tm_mday, tm.tm_wday); -+ twom = tmday / 7; - twoy = tm_woy(tomorrow); - - if (run == NULL) { Property changes on: head/sysutils/bacula-server/files/patch-weekofmonth ___________________________________________________________________ Deleted: cvs2svn:cvs-rev ## -1 +0,0 ## -1.1 \ No newline at end of property Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Index: head/sysutils/bacula-server/files/patch-eom-nextvol =================================================================== --- head/sysutils/bacula-server/files/patch-eom-nextvol (revision 99896) +++ head/sysutils/bacula-server/files/patch-eom-nextvol (nonexistent) @@ -1,278 +0,0 @@ - -This patch fixes two bugs. -1. Reported by Phil: where when the end of a Volume was reached, - Bacula went into a loop requesting the next Volume then gave up. -2. Reported by Lars: the order of the next Volume selected by Bacula - was not as expected. - -Apply the patch with: - - cd - patch -p0 <1.32f-2-eom-nextvol.patch - make - ... - -Index: ReleaseNotes -=================================================================== -RCS file: /cvsroot/bacula/bacula/ReleaseNotes,v -retrieving revision 1.52.2.9.2.7 -retrieving revision 1.52.2.9.2.8 -diff -u -b -r1.52.2.9.2.7 -r1.52.2.9.2.8 ---- ReleaseNotes 31 Dec 2003 09:10:55 -0000 1.52.2.9.2.7 -+++ ReleaseNotes 5 Jan 2004 16:49:44 -0000 1.52.2.9.2.8 -@@ -1,7 +1,14 @@ - -- Release Notes for Bacula 1.32f -+ Release Notes for Bacula 1.32g - - Bacula code: Total files = 262 Total lines = 80,318 (*.h *.c *.in) -+ -+Changes since 1.32f -+- Fix bug reported by Phil (could not duplicate here) where at the end -+ of a Volume, Bacula wanted a new Volume and got into a loop requesting -+ it, then gave up. -+- Modify selection of next Volume to select most currently appended Volume, -+ or if none oldest recycled Volume (problem reported by Lars). - - Changes since 1.32e: - - Note, this change affects only the Win32 FD. -Index: src/cats/sql_find.c -=================================================================== -RCS file: /cvsroot/bacula/bacula/src/cats/sql_find.c,v -retrieving revision 1.23.2.7.2.1 -retrieving revision 1.23.2.7.2.2 -diff -u -b -r1.23.2.7.2.1 -r1.23.2.7.2.2 ---- src/cats/sql_find.c 7 Dec 2003 15:01:42 -0000 1.23.2.7.2.1 -+++ src/cats/sql_find.c 5 Jan 2004 16:49:45 -0000 1.23.2.7.2.2 -@@ -7,7 +7,7 @@ - * - * Kern Sibbald, December 2000 - * -- * Version $Id: sql_find.c,v 1.23.2.7.2.1 2003/12/07 15:01:42 kerns Exp $ -+ * Version $Id: sql_find.c,v 1.23.2.7.2.2 2004/01/05 16:49:45 kerns Exp $ - */ - - /* -@@ -218,6 +218,7 @@ - { - SQL_ROW row; - int numrows; -+ char *order; - - db_lock(mdb); - if (item == -1) { /* find oldest volume */ -@@ -232,12 +233,19 @@ - item = 1; - } else { - /* Find next available volume */ -+ if (strcmp(mr->VolStatus, "Recycled") == 0 || -+ strcmp(mr->VolStatus, "Purged") == 0) { -+ order = "ORDER BY LastWritten ASC,MediaId"; /* take oldest */ -+ } else { -+ order = "ORDER BY LastWritten DESC,MediaId"; /* take most recently written */ -+ } - Mmsg(&mdb->cmd, "SELECT MediaId,VolumeName,VolJobs,VolFiles,VolBlocks," --"VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes," --"VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,Recycle,Slot," --"FirstWritten,LastWritten,VolStatus " --"FROM Media WHERE PoolId=%u AND MediaType='%s' AND VolStatus='%s' " --"ORDER BY LastWritten,MediaId", mr->PoolId, mr->MediaType, mr->VolStatus); -+ "VolBytes,VolMounts,VolErrors,VolWrites,MaxVolBytes,VolCapacityBytes," -+ "VolRetention,VolUseDuration,MaxVolJobs,MaxVolFiles,Recycle,Slot," -+ "FirstWritten,LastWritten,VolStatus " -+ "FROM Media WHERE PoolId=%u AND MediaType='%s' AND VolStatus='%s' " -+ "%s LIMIT 1", -+ mr->PoolId, mr->MediaType, mr->VolStatus, order); - } - if (!QUERY_DB(jcr, mdb, mdb->cmd)) { - db_unlock(mdb); -Index: src/stored/mount.c -=================================================================== -RCS file: /cvsroot/bacula/bacula/src/stored/mount.c,v -retrieving revision 1.42.2.9.2.3 -retrieving revision 1.42.2.9.2.4 -diff -u -b -r1.42.2.9.2.3 -r1.42.2.9.2.4 ---- src/stored/mount.c 8 Dec 2003 20:53:47 -0000 1.42.2.9.2.3 -+++ src/stored/mount.c 5 Jan 2004 16:49:45 -0000 1.42.2.9.2.4 -@@ -5,7 +5,7 @@ - * - * Kern Sibbald, August MMII - * -- * Version $Id: mount.c,v 1.42.2.9.2.3 2003/12/08 20:53:47 kerns Exp $ -+ * Version $Id: mount.c,v 1.42.2.9.2.4 2004/01/05 16:49:45 kerns Exp $ - */ - /* - Copyright (C) 2000-2003 Kern Sibbald and John Walker -@@ -30,7 +30,8 @@ - #include "bacula.h" /* pull in global headers */ - #include "stored.h" /* pull in Storage Deamon headers */ - --/* Forward referenced functions */ -+/* Forward referenced routines */ -+static void mark_volume_in_error(JCR *jcr, DEVICE *dev); - - - /* -@@ -47,11 +48,17 @@ - */ - int mount_next_write_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block, int release) - { -- int retry = 0, autochanger; -- bool ask, recycle; -+ int retry = 0; -+ bool ask = false, recycle, autochanger; -+ int vol_label_status; - - Dmsg0(100, "Enter mount_next_volume()\n"); - -+ /* -+ * Attempt to mount the next volume. If something non-fatal goes -+ * wrong, we come back here to re-try (new op messages, re-read -+ * Volume, ...) -+ */ - mount_next_vol: - if (retry++ > 5) { - Jmsg(jcr, M_FATAL, 0, _("Too many errors trying to mount device %s.\n"), -@@ -62,8 +69,8 @@ - Jmsg(jcr, M_FATAL, 0, _("Job %d canceled.\n"), jcr->JobId); - return 0; - } -- autochanger = 0; -- recycle = ask = false; -+ autochanger = false; /* Assume no autochanger */ -+ recycle = false; - if (release) { - Dmsg0(100, "mount_next_volume release=1\n"); - release_volume(jcr, dev); -@@ -97,15 +104,10 @@ - * It assumes that the device is not already in use! - * - */ -- -- - dev->state &= ~(ST_APPEND|ST_READ|ST_EOT|ST_WEOT|ST_EOF); - -- for ( ;; ) { -- int vol_label_status; - autochanger = autoload_device(jcr, dev, 1, NULL); - Dmsg1(100, "autoload_dev returns %d\n", autochanger); -- - /* - * If we autochanged to correct Volume or (we have not just - * released the Volume AND we can automount) we go ahead -@@ -116,7 +118,7 @@ - ask = false; /* don't ask SYSOP this time */ - } - Dmsg2(100, "Ask=%d autochanger=%d\n", ask, autochanger); -- release = 1; /* release next time if we "recurse" */ -+ release = true; /* release next time if we "recurse" */ - - if (ask && !dir_ask_sysop_to_mount_next_volume(jcr, dev)) { - Dmsg0(100, "Error return ask_sysop ...\n"); -@@ -181,14 +183,15 @@ - /* Check if this is a valid Volume in the pool */ - pm_strcpy(&jcr->VolumeName, dev->VolHdr.VolName); - if (!dir_get_volume_info(jcr, GET_VOL_INFO_FOR_WRITE)) { -- Mmsg(&jcr->errmsg, _("Director wanted Volume \"%s\".\n" -+ Jmsg(jcr, M_WARNING, 0, _("Director wanted Volume \"%s\".\n" - " Current Volume \"%s\" not acceptable because:\n" - " %s"), - VolCatInfo.VolCatName, dev->VolHdr.VolName, - jcr->dir_bsock->msg); - /* Restore desired volume name, note device info out of sync */ - memcpy(&jcr->VolCatInfo, &VolCatInfo, sizeof(jcr->VolCatInfo)); -- goto mount_error; -+ ask = true; -+ goto mount_next_vol; - } - Dmsg1(100, "want new name=%s\n", jcr->VolumeName); - memcpy(&dev->VolCatInfo, &jcr->VolCatInfo, sizeof(dev->VolCatInfo)); -@@ -230,15 +233,11 @@ - /* NOTE! Fall-through wanted. */ - case VOL_NO_MEDIA: - default: --mount_error: - /* Send error message */ - Jmsg(jcr, M_WARNING, 0, "%s", jcr->errmsg); - ask = true; -- /* was - goto ask_again; */ - goto mount_next_vol; - } -- break; -- } - - /* - * See if we have a fresh tape or a tape with data. -@@ -322,6 +321,10 @@ - Jmsg(jcr, M_INFO, 0, _("Wrote label to prelabeled Volume \"%s\" on device %s\n"), - jcr->VolumeName, dev_name(dev)); - } -+ /* -+ * End writing real Volume label (from pre-labeled tape), or recycling -+ * the volume. -+ */ - - } else { - /* -@@ -335,11 +338,7 @@ - if (!eod_dev(dev)) { - Jmsg(jcr, M_ERROR, 0, _("Unable to position to end of data %s. ERR=%s\n"), - dev_name(dev), strerror_dev(dev)); -- Jmsg(jcr, M_INFO, 0, _("Marking Volume \"%s\" in Error in Catalog.\n"), -- jcr->VolumeName); -- bstrncpy(dev->VolCatInfo.VolCatStatus, "Error", sizeof(dev->VolCatInfo.VolCatStatus)); -- Dmsg0(100, "dir_update_vol_info. Set Error.\n"); -- dir_update_volume_info(jcr, dev, 0); -+ mark_volume_in_error(jcr, dev); - goto mount_next_vol; - } - /* *****FIXME**** we should do some checking for files too */ -@@ -355,9 +354,7 @@ - Jmsg(jcr, M_ERROR, 0, _("I canot write on this volume because:\n\ - The number of files mismatch! Volume=%u Catalog=%u\n"), - dev_file(dev), dev->VolCatInfo.VolCatFiles); -- bstrncpy(dev->VolCatInfo.VolCatStatus, "Error", sizeof(dev->VolCatInfo.VolCatStatus)); -- Dmsg0(100, "dir_update_vol_info. Set Error.\n"); -- dir_update_volume_info(jcr, dev, 0); -+ mark_volume_in_error(jcr, dev); - goto mount_next_vol; - } - } -@@ -372,7 +369,19 @@ - return 1; - } - -+static void mark_volume_in_error(JCR *jcr, DEVICE *dev) -+{ -+ Jmsg(jcr, M_INFO, 0, _("Marking Volume \"%s\" in Error in Catalog.\n"), -+ jcr->VolumeName); -+ bstrncpy(dev->VolCatInfo.VolCatStatus, "Error", sizeof(dev->VolCatInfo.VolCatStatus)); -+ Dmsg0(100, "dir_update_vol_info. Set Error.\n"); -+ dir_update_volume_info(jcr, dev, 0); -+} - -+/* -+ * If we are reading, we come here at the end of the tape -+ * and see if there are more volumes to be mounted. -+ */ - int mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) - { - Dmsg2(90, "NumVolumes=%d CurVolume=%d\n", jcr->NumVolumes, jcr->CurVolume); -@@ -399,7 +408,6 @@ - */ - void release_volume(JCR *jcr, DEVICE *dev) - { -- - if (jcr->WroteVol) { - Jmsg0(jcr, M_ERROR, 0, "Hey!!!!! WroteVol non-zero !!!!!\n"); - } -@@ -411,7 +419,8 @@ - memset(&dev->VolCatInfo, 0, sizeof(dev->VolCatInfo)); - memset(&jcr->VolCatInfo, 0, sizeof(jcr->VolCatInfo)); - memset(&dev->VolHdr, 0, sizeof(dev->VolHdr)); -- dev->state &= ~ST_LABEL; /* label not yet read */ -+ /* Force re-read of label */ -+ dev->state &= ~(ST_LABEL|ST_READ|ST_APPEND); - jcr->VolumeName[0] = 0; - - if ((dev->state & ST_OPENED) && Property changes on: head/sysutils/bacula-server/files/patch-eom-nextvol ___________________________________________________________________ Deleted: cvs2svn:cvs-rev ## -1 +0,0 ## -1.1 \ No newline at end of property Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property