summaryrefslogtreecommitdiffstats
path: root/sysutils/bacula-server-devel
diff options
context:
space:
mode:
authorgarga <garga@FreeBSD.org>2006-03-15 10:22:09 +0000
committergarga <garga@FreeBSD.org>2006-03-15 10:22:09 +0000
commitf758976611b2efe78a7a2936ad723d9ec778f96e (patch)
treea5e7bdb24938014a200bebb9dc40f23c7fe025c1 /sysutils/bacula-server-devel
parentcd8907a55f0eb151e42e31ad35a2751a6f7f866b (diff)
downloadFreeBSD-ports-f758976611b2efe78a7a2936ad723d9ec778f96e.zip
FreeBSD-ports-f758976611b2efe78a7a2936ad723d9ec778f96e.tar.gz
Add bacula-server-devel , the network backup solution (server) -
DEVELOPMENT Version. PR: ports/91736 Submitted by: Dan Langille <dan@langille.org>
Diffstat (limited to 'sysutils/bacula-server-devel')
-rw-r--r--sysutils/bacula-server-devel/Makefile315
-rw-r--r--sysutils/bacula-server-devel/distinfo2
-rw-r--r--sysutils/bacula-server-devel/files/bacula-barcodes51
-rw-r--r--sysutils/bacula-server-devel/files/chio-bacula200
-rw-r--r--sysutils/bacula-server-devel/files/patch-configure21
-rw-r--r--sysutils/bacula-server-devel/files/patch-scripts-Makefile.in51
-rw-r--r--sysutils/bacula-server-devel/files/patch-src-console-Makefile.in19
-rw-r--r--sysutils/bacula-server-devel/pkg-deinstall32
-rw-r--r--sysutils/bacula-server-devel/pkg-deinstall.client24
-rw-r--r--sysutils/bacula-server-devel/pkg-descr13
-rw-r--r--sysutils/bacula-server-devel/pkg-install58
-rw-r--r--sysutils/bacula-server-devel/pkg-install.client17
-rw-r--r--sysutils/bacula-server-devel/pkg-message13
-rw-r--r--sysutils/bacula-server-devel/pkg-plist38
-rw-r--r--sysutils/bacula-server-devel/pkg-plist.client7
15 files changed, 861 insertions, 0 deletions
diff --git a/sysutils/bacula-server-devel/Makefile b/sysutils/bacula-server-devel/Makefile
new file mode 100644
index 0000000..f2400f2
--- /dev/null
+++ b/sysutils/bacula-server-devel/Makefile
@@ -0,0 +1,315 @@
+# New ports collection makefile for: bacula
+# Date created: 5 March 2006
+# Whom: Dan Langille <dan@langille.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= bacula
+DISTVERSION= 1.38.6-beta3-20060304
+CATEGORIES= sysutils
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR= bacula
+PKGNAMESUFFIX?= -server-devel
+
+MAINTAINER= dan@langille.org
+COMMENT?= The network backup solution (server) - DEVELOPMENT Version
+
+CONFLICTS= bacula-server-[0-9]* bacula-client-[0-9]*
+
+# 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
+#
+GNU_CONFIGURE= yes
+CONFIGURE_ARGS= --with-tcp-wrappers=/usr/lib \
+ --enable-smartalloc \
+ --with-working-dir=${BACULA_DIR} \
+ --with-scriptdir=${PREFIX}/share/${PORTNAME} \
+ --mandir=${PREFIX}/man \
+ --with-fd-user=root \
+ --with-fd-group=wheel \
+ --with-dir-user=bacula \
+ --with-dir-group=bacula \
+ --with-sd-user=bacula \
+ --with-sd-group=operator \
+ --with-readline=yes \
+ --disable-conio
+
+CONFIGURE_ENV+= CPPFLAGS="-I/usr/include/readline -I${LOCALBASE}/include" \
+ LDFLAGS="-L${LOCALBASE}/lib" \
+ PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \
+ PTHREAD_LIBS="${PTHREAD_LIBS}"
+
+ALL_OPTIONS= CLIENT_ONLY WXCONSOLE GNOMECONSOLE SQLITE3 MYSQL POSTGRESQL MTX OPENSSL
+
+.for opt in ${ALL_OPTIONS}
+.if defined(WITH_${opt})
+BATCH= yes
+.endif
+.endfor
+
+.if !defined(BATCH)
+IS_INTERACTIVE= yes
+.endif
+
+.if defined(WITH_CLIENT_ONLY)
+OPTIONS+= WXCONSOLE "Build with wxGTK based GUI console" off
+OPTIONS+= GNOMECONSOLE "Build with GNOME based GUI console" off
+.else
+OPTIONS= SQLITE3 "Use SqLite-3 database instead of SqLite-2" off
+OPTIONS+= MYSQL "Use MySQL database instead of SqLite" off
+OPTIONS+= POSTGRESQL "Use PostgreSQL database instead of SqLite" off
+OPTIONS+= MTX "Install mtx for control of autochanger devices" off
+.endif
+
+OPTIONS+= OPENSSL "Enable OpenSSL for encrypted communication" off
+
+# Prepare if gnome-console is selected this must be happen before
+# include of bsd.port.pre.mk!
+WANT_GNOME= yes
+.if defined(WITH_GNOMECONSOLE)
+USE_GNOME= libgnome
+.endif
+
+PLIST_SUB+= BACULA_DIR=${BACULA_DIR}
+
+MAN8= bacula.8
+
+.include <bsd.port.pre.mk>
+
+# Client only or full server version
+.if defined(WITH_CLIENT_ONLY)
+CONFFILES= fd
+CONFIGURE_ARGS+= --enable-client-only
+
+PKGDEINSTALL= ${PKGDIR}/pkg-deinstall.client
+PKGINSTALL= ${PKGDIR}/pkg-install.client
+# Build gnome-console
+.if defined(WITH_GNOMECONSOLE)
+CONFIGURE_ARGS+= --enable-gnome
+PLIST_SUB+= GNOMECONS=""
+.else
+# We didn't need GTK (it's not possible to put WANT_GNOME in an .if statement!)
+WITHOUT_GNOME= yes
+PLIST_SUB+= GNOMECONS="@comment "
+.endif
+# Build wx-console
+.if defined(WITH_WXCONSOLE)
+CONFIGURE_ARGS+= --enable-wx-console
+LIB_DEPENDS+= wx_gtk2-2.4.0:${PORTSDIR}/x11-toolkits/wxgtk24
+CONFIGURE_ENV+= WXCONFIG=${X11BASE}/bin/wxgtk2-2.4-config
+PLIST_SUB+= WXCONS=""
+.else
+# We didn't need GTK (it's not possible to put WANT_GNOME in an .if statement!)
+WITHOUT_GNOME= yes
+PLIST_SUB+= WXCONS="@comment "
+.endif
+.else
+# Server only Options
+PLIST_SUB+= GNOMECONS="@comment "
+PLIST_SUB+= WXCONS="@comment "
+CONFFILES= sd dir
+.if defined(WITH_MYSQL)
+CONFIGURE_ARGS+= --with-mysql=yes
+USE_MYSQL= yes
+DBTYPE= mysql
+.elif defined(WITH_POSTGRESQL)
+USE_PGSQL= yes
+CONFIGURE_ARGS+= --with-postgresql=yes
+DBTYPE= postgresql
+.elif defined(WITH_SQLITE3)
+CONFIGURE_ARGS+= --with-sqlite3=yes
+LIB_DEPENDS+= sqlite3:${PORTSDIR}/databases/sqlite3
+DBTYPE= sqlite
+.else
+CONFIGURE_ARGS+= --with-sqlite=yes
+LIB_DEPENDS+= sqlite.2:${PORTSDIR}/databases/sqlite2
+DBTYPE= sqlite
+.endif
+PLIST_SUB+= DBTYPE=${DBTYPE}
+# Install mtx
+.if defined(WITH_MTX)
+RUN_DEPENDS+= ${LOCALBASE}/sbin/mtx:${PORTSDIR}/misc/mtx
+.endif
+.endif
+
+.if defined(WITH_OPENSSL)
+CONFIGURE_ARGS+= --with-openssl
+.endif
+
+.if defined(WITH_CLIENT_ONLY)
+MAN8=bacula.8
+.endif
+
+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 newer versions of FreeBSD"
+ @${ECHO_MSG} "===> READ ${WRKSRC}/platforms/freebsd/pthreads-fix.txt"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "You may use the following build options (or make config):"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} " WITH_CLIENT_ONLY=yes if you only want the file daemon."
+ @${ECHO_MSG} " WITH_WXCONSOLE=yes if you only want a wxGTK based GUI console."
+ @${ECHO_MSG} " WITH_GNOMECONSOLE=yes if you only want a GNOME based GUI console."
+ @${ECHO_MSG} " WITH_MTX=yes if you want to use mtx instead of chio for autochanger control."
+ @${ECHO_MSG} " WITH_SQLITE3=yes if you want SqLite-3 instead of SqLite-2 as the database."
+.if !defined(WITH_MYSQL) && !defined(WITH_POSTGRESQL)
+ @${ECHO_MSG} " WITH_MYSQL=yes if you want MySQL instead of SqLite as the database."
+ @${ECHO_MSG} " WITH_POSTGRESQL=yes if you want PostgreSQL instead of SqLite as the database."
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "The default DB is SQLite-2!"
+.endif
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "===> Using ${DBTYPE} as the bacula database."
+ @${ECHO_MSG} ""
+.else
+ @${ECHO_MSG} "===> Building file daemon only."
+.endif
+
+post-patch:
+# Default bconsole.conf is ${PREFIX}/etc
+ @${REINPLACE_CMD} -e 's|./bconsole.conf|${PREFIX}/etc/bconsole.conf|g' ${WRKSRC}/src/console/console.c
+.if defined(WITH_CLIENT_ONLY)
+# In client port only install startup script out of script dir (see below post-install)
+# Dont mkdir ${PREFIX}/share/bacule cause it's empty
+ @${REINPLACE_CMD} -e 's|^\(fd_subdirs = .*\)scripts\(.*\)|\1\2|g' ${WRKSRC}/Makefile.in
+ ${REINPLACE_CMD} -e 's|\(.*$$(MKDIR) $$(DESTDIR)$$(scriptdir)\)|#\1|g' ${WRKSRC}/Makefile.in
+.else
+# In server port don't install filed
+ @${REINPLACE_CMD} -e 's|^all_subdirs = .*|all_subdirs = scripts src\/lib src\/findlib $${subdirs}|g' ${WRKSRC}/Makefile.in
+.endif
+
+post-install:
+# Migration: move existing bacula.sh to z-bacula.sh to start bacula AFTER DB start
+ if [ -f ${PREFIX}/etc/rc.d/bacula.sh ]; then \
+ ${MV} ${PREFIX}/etc/rc.d/bacula.sh ${PREFIX}/etc/rc.d/z-bacula.sh; \
+ fi
+ if [ -f ${PREFIX}/etc/rc.d/bacula.sh.sample ]; then \
+ ${MV} ${PREFIX}/etc/rc.d/bacula.sh.sample ${PREFIX}/etc/rc.d/z-bacula.sh.sample; \
+ fi
+.if defined(WITH_CLIENT_ONLY)
+# Install start script
+ ${INSTALL_SCRIPT} ${WRKSRC}/scripts/bacula ${PREFIX}/etc/rc.d/z-bacula.sh.sample
+# Extend only /etc/services
+ @ ${SETENV} PKG_PREFIX=${PREFIX} \
+ ${SH} ${PKGINSTALL} ${PORTNAME}
+# Console stuff
+ if [ -f ${PREFIX}/etc/bconsole.conf.new ]; then \
+ ${ECHO_CMD} "etc/bconsole.conf.new" >> ${TMPPLIST}; \
+ elif [ -f ${PREFIX}/etc/bconsole.conf ]; then \
+ ${MV} ${PREFIX}/etc/bconsole.conf ${PREFIX}/etc/bconsole.conf.sample; \
+ ${ECHO_CMD} "etc/bconsole.conf.sample" >> ${TMPPLIST}; \
+ fi
+.if defined(WITH_WXCONSOLE)
+ if [ -f ${PREFIX}/etc/wx-console.conf.new ]; then \
+ ${ECHO_CMD} "etc/wx-console.conf.new" >> ${TMPPLIST}; \
+ elif [ -f ${PREFIX}/etc/wx-console.conf ]; then \
+ ${MV} ${PREFIX}/etc/wx-console.conf ${PREFIX}/etc/wx-console.conf.sample; \
+ ${ECHO_CMD} "etc/wx-console.conf.sample" >> ${TMPPLIST}; \
+ fi
+.endif
+.if defined(WITH_GNOMECONSOLE)
+ if [ -f ${PREFIX}/etc/gnome-console.conf.new ]; then \
+ ${ECHO_CMD} "etc/gnome-console.conf.new" >> ${TMPPLIST}; \
+ elif [ -f ${PREFIX}/etc/gnome-console.conf ]; then \
+ ${MV} ${PREFIX}/etc/gnome-console.conf ${PREFIX}/etc/gnome-console.conf.sample; \
+ ${ECHO_CMD} "etc/gnome-console.conf.sample" >> ${TMPPLIST}; \
+ fi
+.endif
+
+# @${CHMOD} a+x ${WRKSRC}/scripts/bacula.man
+.if defined(WITH_CLIENT_ONLY)
+ ${INSTALL_MAN} ${WRKSRC}/scripts/bacula.man ${PREFIX}/man/man8/bacula.8
+.endif
+.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/bacula-barcodes.samples ; \
+ ${ECHO_CMD} "etc/bacula-barcodes.samples" >> ${TMPPLIST}; \
+ fi
+# chmod of bsmtp program so bacula can use it with dropped down permissions
+ ${CHMOD} o+x ${PREFIX}/sbin/bsmtp
+ ${CHOWN} -R bacula:bacula ${PREFIX}/share/bacula
+.endif
+# Install leaves existing conf files untouched. Respect this here!
+ for na in ${CONFFILES}; 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 \
+ ${MV} ${PREFIX}/etc/bacula-$$na.conf ${PREFIX}/etc/bacula-$$na.conf.sample; \
+ ${ECHO_CMD} "etc/bacula-$$na.conf.sample" >> ${TMPPLIST}; \
+ fi; \
+ done
+
+# Inform user after install about important things ....
+ @${ECHO_MSG} "*********************************************************************"
+ @${ECHO_MSG} "NOTE:"
+ @${ECHO_MSG} "Sample files are installed in ${PREFIX}/etc:"
+ @${ECHO_MSG} " bconsole.conf.sample, bacula-barcodes.sample, bacula-fd.conf.sample"
+.if !defined(WITH_CLIENT_ONLY)
+ @${ECHO_MSG} " bacula-sd.conf.sample, bacula-dir.conf.sample"
+ @${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} "autochanger. 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 accessible by user bacula."
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "Due to lack of some features in the FreeBSD tape driver"
+ @${ECHO_MSG} "implementation you MUST add some OS dependent options to"
+ @${ECHO_MSG} "the bacula-sd.conf file:"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} " Hardware End of Medium = no;"
+ @${ECHO_MSG} " Backward Space Record = no;"
+ @${ECHO_MSG} " Backward Space File = no;"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "With 2 filemarks at EOT (see man mt):"
+ @${ECHO_MSG} " Fast Forward Space File = no;"
+ @${ECHO_MSG} " BSF at EOM = yes;"
+ @${ECHO_MSG} " TWO EOF = yes;"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "With 1 filemarks at EOT (see man mt):"
+ @${ECHO_MSG} " Fast Forward Space File = yes;"
+ @${ECHO_MSG} " BSF at EOM = no;"
+ @${ECHO_MSG} " TWO EOF = no;"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "NOTE: YOU CAN SWITCH EOT model ONLY when starting"
+ @${ECHO_MSG} " from scratch with EMPTY tapes!!!!"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "It is also important that all the scripts accessed"
+ @${ECHO_MSG} "by RunBeforeJob and RunAfterJob can be executed by"
+ @${ECHO_MSG} "the user bacula."
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "For USB support read the bacula manual!! It could be necessary"
+ @${ECHO_MSG} "to configure/compile a new kernel!"
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "Look at $PREFIX/share/bacula/update_bacula_tables for"
+ @${ECHO_MSG} "database update procedure. Details can be found in the"
+ @${ECHO_MSG} "ReleaseNotes"
+.endif
+ @${ECHO_MSG} "*********************************************************************"
+
+.if !defined(WITH_CLIENT_ONLY)
+ ${CAT} pkg-message
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/bacula-server-devel/distinfo b/sysutils/bacula-server-devel/distinfo
new file mode 100644
index 0000000..293c267
--- /dev/null
+++ b/sysutils/bacula-server-devel/distinfo
@@ -0,0 +1,2 @@
+MD5 (bacula-1.38.6-beta3-20060304.tar.gz) = 307153832c052779dc48f31c2d057fe3
+SIZE (bacula-1.38.6-beta3-20060304.tar.gz) = 1927972
diff --git a/sysutils/bacula-server-devel/files/bacula-barcodes b/sysutils/bacula-server-devel/files/bacula-barcodes
new file mode 100644
index 0000000..0a0b2dc
--- /dev/null
+++ b/sysutils/bacula-server-devel/files/bacula-barcodes
@@ -0,0 +1,51 @@
+#
+# Bacula barcode simulation file
+# used by ${PREFIX}/sbin/chio-bacula (FreeBSD)
+#
+# The volumenames are returned by the "changer list" command
+# labeling in the console is done by "label barcodes"
+# (then all volumes belog to the default pool).
+# All Lines with an "#" at the bedinning are ignored
+#
+# !!!! If you export an tape and reinsert another one,
+# !!!! don't forget to change the volume name in this file!
+#
+1:Volume1-100
+2:Volume1-101
+3:Volume1-102
+4:Volume1-103
+5:Volume1-104
+6:Volume1-105
+7:Volume1-106
+8:Volume1-107
+9:Volume1-108
+10:Volume1-109
+11:Volume1-110
+12:Volume1-111
+#
+# Further volumes exported from the changer
+#
+# 36GB AIT2 tapes
+#Volume1-100
+#Volume1-101
+#Volume1-102
+#Volume1-103
+#Volume1-104
+#Volume1-105
+#Volume1-106
+#Volume1-107
+#Volume1-108
+#Volume1-109
+#Volume1-110
+#Volume1-111
+#Volume1-112
+#Volume1-113
+#Volume1-114
+#Volume1-115
+#
+# 50GB AIT2 tapes
+#Volume2-200
+#Volume2-201
+#Volume2-202
+#Volume2-203
+#Volume2-204
diff --git a/sysutils/bacula-server-devel/files/chio-bacula b/sysutils/bacula-server-devel/files/chio-bacula
new file mode 100644
index 0000000..cc5999c
--- /dev/null
+++ b/sysutils/bacula-server-devel/files/chio-bacula
@@ -0,0 +1,200 @@
+#!/bin/sh
+#
+# Bacula interface to FreeBSD chio autoloader command with
+# multiple drive support
+# (By Lars K.ller, lars+bacula@koellers.net, 2004)
+#
+# If you set in your Device resource
+#
+# Changer Command = "path-to-this-script/chio-bacula" %c %o %S %a
+# you will have the following input to this script:
+#
+# chio-bacula "changer-device" "command" "slot" "archive-device" "drive-index"
+# $1 $2 $3 $4 $5
+# for example:
+#
+# chio-bacula /dev/sg0 load 1 /dev/nst0 0 (on a FreeBSD system)
+#
+# If you need to to an offline, refer to the drive as $4
+# e.g. mt -f $f offline
+#
+# Many changers need an offline after the unload. Also many
+# changers need a sleep 60 after the mtx load.
+#
+# N.B. If you change the script, take care to return either
+# the mtx exit code or a 0. If the script exits with a non-zero
+# exit code, Bacula will assume the request failed.
+#
+me=$(basename $0)
+
+# Debug output, take care this file is writeable for user bacula!
+#LOG=/var/db/bacula/chio-bacula.log
+#exec 2>>$LOG
+#echo "------------------------- $(date) Start $(basename $0) -------------------------" >> $LOG
+#set -x
+
+# Debug
+logger -p user.err "$me $@"
+
+# This simulates a barcode reader in the changer.
+# The labes of the virtual barcode reader are located in the BARCODE_FILE
+SIMULATE_BARCODE=true
+BARCODE_FILE=/usr/local/etc/bacula-barcodes
+MTX=/bin/chio
+# Set default values (see case statement below for
+# free mapping of drive index and tape device
+# We have a double drive Qualstar where drive 1 is the default bacula drive
+#TAPE=/dev/bacula-tape
+TAPE=/dev/nrsa0
+DRIVE=0
+# Time to wait for (un)loading
+SLEEP=20
+
+usage()
+{
+ echo ""
+ echo "The $me script for bacula"
+ echo "--------------------------------------"
+ echo ""
+ echo "usage: $me <changer-device> <command> [slot] [devicename of tapedrive] [drive index]"
+ echo ""
+ echo "Valid commands:"
+ echo ""
+ echo "unload Unloads a tape into the slot"
+ echo " from where it was loaded."
+ echo "load <slot> Loads a tape from the slot <slot>"
+ echo " (slot-base is calculated to 1 as first slot)"
+ echo "list Lists full storage slots"
+ echo "loaded Gives slot from where the tape was loaded."
+ echo " 0 means the tape drive is empty."
+ echo "slots Gives Number of aviable slots."
+ echo ""
+ echo "Example:"
+ echo " $me /dev/changer load 1 loads a tape from slot 1"
+ echo ""
+ exit 2
+}
+
+# The changer device
+if [ -z "$1" ] ; then
+ usage;
+else
+ CHANGER=$1
+fi
+# The command
+if [ -z "$2" ] ; then
+ usage;
+else
+ COMMAND=$2
+fi
+# The slot number
+if [ ! -z "$3" ]; then
+ SLOT=$3
+ # btape fill says "... slot 1 drive 0" :-(
+ if [ "$SLOT" = "slot" ]; then
+ shift
+ SLOT=$3
+ fi
+fi
+# Set tape device
+if [ ! -z "$4" ]; then
+ TAPE=$4
+fi
+
+# Here you can map bacula drive number to any tape device
+# DRIVE is the chio drive number used below by chio!
+case $5 in
+ 0)
+ # First Drive in Changer is Bacula drive
+ DRIVE=0
+ #TAPE=/dev/bacula-tape
+ TAPE=/dev/nrsa0
+ ;;
+ 1)
+ DRIVE=1
+ #TAPE=/dev/bacula-tape2
+ TAPE=/dev/nrsa1
+ ;;
+esac
+
+#
+# Main
+#
+case ${COMMAND} in
+ unload)
+ # enable the following line if you need to eject the cartridge
+ mt -f ${TAPE} off
+ sleep 2
+ # if we have a slot, try it
+ if [ ! -z "$SLOT" ]; then
+ ${MTX} -f ${CHANGER} move drive ${DRIVE} slot $((${SLOT}-1))
+ exit $?
+ fi
+ # Try other way (works if source element information is valid for drive)
+ ${MTX} -f ${CHANGER} return drive ${DRIVE}
+ # If the changer is power cycled with a tape loaded in a drive
+ # we can compute the slot in case of a complete filled magazine, with
+ # one slot free.
+ if [ "$?" != "0" ]; then
+ free_slot=`${MTX} -f ${CHANGER} stat | grep "^slot " | grep -v "FULL" | awk '{print $2}'`
+ free_slot=${free_slot%:}
+ ${MTX} -f ${CHANGER} move drive ${DRIVE} slot $free_slot
+ fi
+ ;;
+
+ load)
+ ${MTX} -f ${CHANGER} move slot $((${SLOT}-1)) drive ${DRIVE}
+ rtn=$?
+ # Increase the sleep time if you have a slow device
+ sleep $SLEEP
+ exit $rtn
+ ;;
+
+ list)
+ if [ "${SIMULATE_BARCODE}" = "true" ]; then
+ if [ -f "$BARCODE_FILE" ]; then
+ cat $BARCODE_FILE | grep -v -e "^#" -e "^$"
+ exit 0
+ else
+ echo "Barcode file $BARCODE_FILE missing ... exiting!"
+ exit 1
+ fi
+ else
+ ${MTX} -f ${CHANGER} status | grep "^slot .*: .*FULL>" | awk '{print $2}' | awk -F: '{print $1+1" "}' | tr -d "[\r\n]"
+ fi
+ ;;
+
+ loaded)
+ # echo "Request loaded"
+ ${MTX} -f ${CHANGER} status -S > /tmp/mtx.$$
+ rtn=$?
+ # Try to get chio slot source from drive entry
+ SLOT=$(cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: <FULL> .*slot" | awk '{print $6+1}' | tr -d ">")
+ if [ -z "$SLOT" ]; then
+ # This handles the case a source slot is not available (power on
+ # of the changer with a drive loaded) and all other slots are
+ # occupied with a tape!
+ SLOT=$(cat /tmp/mtx.$$ | grep "^slot .*: <ACCESS>" | awk '{print $2+1}')
+ if [ -z "$SLOT" ]; then
+ echo 0
+ else
+ echo $SLOT
+ fi
+ else
+ echo $SLOT
+ fi
+ # All tapes are in the slots
+ #cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: .* source: <>" | awk "{print 0}"
+ rm -f /tmp/mtx.$$
+ exit $rtn
+ ;;
+
+ slots)
+ # echo "Request slots"
+ ${MTX} -f ${CHANGER} status | grep "^slot " | tail -1 | awk '{print $2+1}' | tr -d ":"
+ ;;
+
+ *)
+ usage
+ ;;
+esac
diff --git a/sysutils/bacula-server-devel/files/patch-configure b/sysutils/bacula-server-devel/files/patch-configure
new file mode 100644
index 0000000..f370488
--- /dev/null
+++ b/sysutils/bacula-server-devel/files/patch-configure
@@ -0,0 +1,21 @@
+*** configure.org Sun Mar 6 16:46:54 2005
+--- configure Sun Mar 6 16:49:20 2005
+***************
+*** 29490,29497 ****
+ DISTVER=`uname -a |awk '{print $3}'`
+ VER=`echo $DISTVER | cut -c 1`
+ if test x$VER = x4 ; then
+! PTHREAD_LIB="-pthread"
+! CFLAGS="${CFLAGS} -pthread"
+ fi
+ lld="qd"
+ llu="qu"
+--- 21037,21044 ----
+ DISTVER=`uname -a |awk '{print $3}'`
+ VER=`echo $DISTVER | cut -c 1`
+ if test x$VER = x4 ; then
+! PTHREAD_LIB="${PTHREAD_LIBS}"
+! CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
+ fi
+ lld="qd"
+ llu="qu"
diff --git a/sysutils/bacula-server-devel/files/patch-scripts-Makefile.in b/sysutils/bacula-server-devel/files/patch-scripts-Makefile.in
new file mode 100644
index 0000000..9100d3a
--- /dev/null
+++ b/sysutils/bacula-server-devel/files/patch-scripts-Makefile.in
@@ -0,0 +1,51 @@
+--- scripts/Makefile.in.org Thu Feb 23 14:56:12 2006
++++ scripts/Makefile.in Mon Mar 6 11:20:05 2006
+@@ -33,11 +33,11 @@
+ $(MKDIR) $(DESTDIR)$(mandir)
+
+ install: installdirs
+- $(INSTALL_SCRIPT) startmysql $(DESTDIR)$(scriptdir)/startmysql
+- $(INSTALL_SCRIPT) stopmysql $(DESTDIR)$(scriptdir)/stopmysql
+- $(INSTALL_SCRIPT) bconsole $(DESTDIR)$(scriptdir)/bconsole
+- $(INSTALL_SCRIPT) gconsole $(DESTDIR)$(scriptdir)/gconsole
+- $(INSTALL_SCRIPT) bacula $(DESTDIR)$(scriptdir)/bacula
++# $(INSTALL_SCRIPT) startmysql $(DESTDIR)$(scriptdir)/startmysql
++# $(INSTALL_SCRIPT) stopmysql $(DESTDIR)$(scriptdir)/stopmysql
++# $(INSTALL_SCRIPT) bconsole $(DESTDIR)$(scriptdir)/bconsole
++# $(INSTALL_SCRIPT) gconsole $(DESTDIR)$(scriptdir)/gconsole
++ $(INSTALL_SCRIPT) bacula $(DESTDIR)$(sysconfdir)/rc.d/z-bacula.sh.sample
+ @if test -f ${DESTDIR}${scriptdir}/mtx-changer; then \
+ echo " ==> Saving existing mtx-changer to mtx-changer.old"; \
+ $(MV) -f ${DESTDIR}${scriptdir}/mtx-changer ${DESTDIR}${scriptdir}/mtx-changer.old; \
+@@ -53,14 +53,14 @@
+ $(MV) -f ${DESTDIR}${scriptdir}/dvd-handler ${DESTDIR}${scriptdir}/dvd-handler.old; \
+ fi
+ $(INSTALL_SCRIPT) dvd-handler $(DESTDIR)$(scriptdir)/dvd-handler
+- $(INSTALL_DATA) btraceback.gdb $(DESTDIR)$(scriptdir)/btraceback.gdb
+- $(INSTALL_DATA) btraceback.dbx $(DESTDIR)$(scriptdir)/btraceback.dbx
+- chmod 0644 $(DESTDIR)$(scriptdir)/btraceback.gdb \
+- $(DESTDIR)$(scriptdir)/btraceback.dbx
+- $(INSTALL_SCRIPT) btraceback $(DESTDIR)$(sbindir)/btraceback
+- gzip <bacula.man >bacula.8.gz
+- $(INSTALL_DATA) bacula.8.gz $(DESTDIR)$(mandir)/bacula.8.gz
+- @rm -f bacula.8.gz
++# $(INSTALL_DATA) btraceback.gdb $(DESTDIR)$(scriptdir)/btraceback.gdb
++# $(INSTALL_DATA) btraceback.dbx $(DESTDIR)$(scriptdir)/btraceback.dbx
++# chmod 0644 $(DESTDIR)$(scriptdir)/btraceback.gdb \
++# $(DESTDIR)$(scriptdir)/btraceback.dbx
++# $(INSTALL_SCRIPT) btraceback $(DESTDIR)$(sbindir)/btraceback
++# gzip <bacula.man >bacula.8.gz
++ $(INSTALL_DATA) bacula.man $(DESTDIR)$(mandir)/bacula.8
++# @rm -f bacula.8.gz
+
+
+ uninstall:
+@@ -68,7 +68,7 @@
+ (cd $(DESTDIR)$(scriptdir); $(RMF) stopmysql)
+ (cd $(DESTDIR)$(scriptdir); $(RMF) bconsole)
+ (cd $(DESTDIR)$(scriptdir); $(RMF) gconsole)
+- (cd $(DESTDIR)$(scriptdir); $(RMF) bacula)
++ (cd $(DESTDIR)$(scriptdir); $(RMF) z-bacula.sh)
+ (cd $(DESTDIR)$(scriptdir); $(RMF) fd)
+ (cd $(DESTDIR)$(scriptdir); $(RMF) mtx-changer)
+ (cd $(DESTDIR)$(scriptdir); $(RMF) disk-changer)
diff --git a/sysutils/bacula-server-devel/files/patch-src-console-Makefile.in b/sysutils/bacula-server-devel/files/patch-src-console-Makefile.in
new file mode 100644
index 0000000..e31efc2
--- /dev/null
+++ b/sysutils/bacula-server-devel/files/patch-src-console-Makefile.in
@@ -0,0 +1,19 @@
+*** src/console/Makefile.in.org Sat Apr 3 20:40:26 2004
+--- src/console/Makefile.in Sat May 8 14:01:49 2004
+***************
+*** 89,95 ****
+ destconf=$$srcconf; \
+ if test -f ${DESTDIR}${sysconfdir}/console.conf; then \
+ echo "Existing console.conf moved to bconsole.conf"; \
+! @$(MV) ${DESTDIR}${sysconfdir}/console.conf ${DESTDIR}${sysconfdir}/bconsole.conf; \
+ destconf=$$srcconf.new; \
+ fi; \
+ fi; \
+--- 89,95 ----
+ destconf=$$srcconf; \
+ if test -f ${DESTDIR}${sysconfdir}/console.conf; then \
+ echo "Existing console.conf moved to bconsole.conf"; \
+! $(MV) ${DESTDIR}${sysconfdir}/console.conf ${DESTDIR}${sysconfdir}/bconsole.conf; \
+ destconf=$$srcconf.new; \
+ fi; \
+ fi; \
diff --git a/sysutils/bacula-server-devel/pkg-deinstall b/sysutils/bacula-server-devel/pkg-deinstall
new file mode 100644
index 0000000..3af0615
--- /dev/null
+++ b/sysutils/bacula-server-devel/pkg-deinstall
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin:/usr/sbin
+TMPFILE=/tmp/services-$RANDOM-$$
+if [ -z "${BACULA_DIR}" ]; then
+ BACULA_DIR=/var/db/bacula
+fi
+
+case "$2" in
+"DEINSTALL")
+ # Delete entries in /etc/services
+ sed -e '/# Bacula port start/,/# Bacule port end/{' \
+ -e 'd' \
+ -e '}' /etc/services > $TMPFILE
+ mv -f $TMPFILE /etc/services
+
+ if [ -d ${BACULA_DIR} ]; then
+ rmdir ${BACULA_DIR};
+ fi
+ if [ -d ${BACULA_DIR} ]; then
+ echo "Check if ${BACULA_DIR} is empty and delete it to permanently remove the bacula port"
+ fi
+
+ # Note how to delete UID/GID
+ USER=bacula
+ GROUP=${USER}
+ if pw usershow "${USER}" 2>/dev/null 1>&2; then
+ echo "To delete Bacula user permanently, use 'pw userdel ${USER}'"
+ echo "To delete Bacula group permanently, use 'pw groupdel ${GROUP}'"
+ fi
+ ;;
+esac
diff --git a/sysutils/bacula-server-devel/pkg-deinstall.client b/sysutils/bacula-server-devel/pkg-deinstall.client
new file mode 100644
index 0000000..cadbda5
--- /dev/null
+++ b/sysutils/bacula-server-devel/pkg-deinstall.client
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin:/usr/sbin
+TMPFILE=/tmp/services-$RANDOM-$$
+if [ -z "${BACULA_DIR}" ]; then
+ BACULA_DIR=/var/db/bacula
+fi
+
+case "$2" in
+"DEINSTALL")
+ # Delete entries in /etc/services
+ sed -e '/# Bacula port start/,/# Bacule port end/{' \
+ -e 'd' \
+ -e '}' /etc/services > $TMPFILE
+ mv -f $TMPFILE /etc/services
+
+ if [ -d ${BACULA_DIR} ]; then
+ rmdir ${BACULA_DIR};
+ fi
+ if [ -d ${BACULA_DIR} ]; then
+ echo "Check if ${BACULA_DIR} is empty and delete it to permanently remove the bacula port"
+ fi
+ ;;
+esac
diff --git a/sysutils/bacula-server-devel/pkg-descr b/sysutils/bacula-server-devel/pkg-descr
new file mode 100644
index 0000000..5a47fd1
--- /dev/null
+++ b/sysutils/bacula-server-devel/pkg-descr
@@ -0,0 +1,13 @@
+Bacula is a set of computer programs that permit you (or the system
+administrator) to manage backup, recovery, and verification of
+computer data across a network of computers of different kinds.
+In technical terms, it is a network Client/Server based backup program.
+Bacula is relatively easy to use and efficient, while offering many
+advanced storage management features that make it easy to find and
+recover lost or damaged files. Due to its modular design, Bacula is
+scalable from small single computer systems to systems consisting of
+hundreds of computers located over a large network.
+
+This port is built from the development branch of Bacula.
+
+WWW: http://www.bacula.org/
diff --git a/sysutils/bacula-server-devel/pkg-install b/sysutils/bacula-server-devel/pkg-install
new file mode 100644
index 0000000..460b57f
--- /dev/null
+++ b/sysutils/bacula-server-devel/pkg-install
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin:/usr/sbin
+if [ -z "${BACULA_DIR}" ]; then
+ BACULA_DIR=/var/db/bacula
+fi
+
+# Always add lines in /etc/services
+grep -q "bacula-dir" /etc/services
+if [ "$?" != "0" ]; then
+ echo "# Bacula port start
+bacula-dir 9101/tcp #Bacula director daemon
+bacula-fd 9102/tcp #Bacula file daemon
+bacula-sd 9103/tcp #Bacula storage daemon
+# Bacule port end" >> /etc/services
+fi
+
+case $2 in
+POST-INSTALL)
+ # Install UID/GID
+ USER=bacula
+ GROUP=${USER}
+ UID=910
+ GID=${UID}
+
+ if pw group show "${GROUP}" 2>/dev/null; then
+ echo "You already have a group \"${GROUP}\", so I will use it."
+ else
+ if pw groupadd ${GROUP} -g ${GID}; then
+ echo "Added group \"${GROUP}\"."
+ else
+ echo "Adding group \"${GROUP}\" failed..."
+ exit 1
+ fi
+ fi
+
+ if pw user show "${USER}" 2>/dev/null; then
+ echo "You already have a user \"${USER}\", so I will use it."
+ if pw usermod ${USER} -d ${BACULA_DIR} -G operator
+ then
+ echo "Changed home directory of \"${USER}\" to \"${BACULA_DIR}\""
+ else
+ echo "Changing home directory of \"${USER}\" to \"${BACULA_DIR}\" failed..."
+ exit 1
+ fi
+ else
+ if pw useradd ${USER} -u ${UID} -g ${GROUP} -G operator -h - \
+ -d ${BACULA_DIR} -s /sbin/nologin -c "Bacula Daemon"
+ then
+ echo "Added user \"${USER}\"."
+ else
+ echo "Adding user \"${USER}\" failed..."
+ exit 1
+ fi
+ fi
+ chown -R ${USER}:${GROUP} ${BACULA_DIR}
+ ;;
+esac
diff --git a/sysutils/bacula-server-devel/pkg-install.client b/sysutils/bacula-server-devel/pkg-install.client
new file mode 100644
index 0000000..7dc31b4
--- /dev/null
+++ b/sysutils/bacula-server-devel/pkg-install.client
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+PATH=/bin:/usr/bin:/usr/sbin
+if [ -z "${BACULA_DIR}" ]; then
+ BACULA_DIR=/var/db/bacula
+fi
+
+# Always add lines in /etc/services
+grep -q "bacula-dir" /etc/services
+if [ "$?" != "0" ]; then
+ echo "# Bacula port start
+bacula-dir 9101/tcp #Bacula director daemon
+bacula-fd 9102/tcp #Bacula file daemon
+bacula-sd 9103/tcp #Bacula storage daemon
+# Bacule port end" >> /etc/services
+fi
+
diff --git a/sysutils/bacula-server-devel/pkg-message b/sysutils/bacula-server-devel/pkg-message
new file mode 100644
index 0000000..05bf55f
--- /dev/null
+++ b/sysutils/bacula-server-devel/pkg-message
@@ -0,0 +1,13 @@
+################################################################################
+ Please read the file"
+
+ ${DOCSDIR}/ReleaseNotes"
+
+ for the upgrade procedure!
+
+ IF YOU IGNORE THIS you may !! LOSE DATA !!
+
+ For USB support read the manual. It could be necessary
+ to configure/compile a new kernel!
+
+################################################################################
diff --git a/sysutils/bacula-server-devel/pkg-plist b/sysutils/bacula-server-devel/pkg-plist
new file mode 100644
index 0000000..1c96821
--- /dev/null
+++ b/sysutils/bacula-server-devel/pkg-plist
@@ -0,0 +1,38 @@
+%%DATADIR%%/query.sql
+etc/rc.d/z-bacula.sh.sample
+sbin/chio-bacula
+sbin/bacula-dir
+sbin/bacula-sd
+sbin/bcopy
+sbin/bextract
+sbin/bls
+sbin/bscan
+sbin/btape
+%%WXCONS%%sbin/wx-console
+%%GNOMECONS%%sbin/gnome-console
+sbin/dbcheck
+sbin/bsmtp
+@unexec if cmp -s %D/share/bacula/mtx-changer.old %D/share/bacula/mtx-changer; then rm -f %D/share/bacula/mtx-changer.old; fi
+@unexec if cmp -s %D/share/bacula/disk-changer.old %D/share/bacula/disk-changer; then rm -f %D/share/bacula/disk-changer.old; fi
+%%DATADIR%%/mtx-changer
+%%DATADIR%%/create_bacula_database
+%%DATADIR%%/create_%%DBTYPE%%_database
+%%DATADIR%%/drop_bacula_database
+%%DATADIR%%/drop_%%DBTYPE%%_database
+%%DATADIR%%/drop_bacula_tables
+%%DATADIR%%/drop_%%DBTYPE%%_tables
+%%DATADIR%%/grant_bacula_privileges
+%%DATADIR%%/grant_%%DBTYPE%%_privileges
+%%DATADIR%%/make_bacula_tables
+%%DATADIR%%/make_%%DBTYPE%%_tables
+%%DATADIR%%/update_bacula_tables
+%%DATADIR%%/update_%%DBTYPE%%_tables
+%%DATADIR%%/delete_catalog_backup
+%%DATADIR%%/make_catalog_backup
+%%DATADIR%%/dvd-handler
+%%DATADIR%%/disk-changer
+
+@dirrm %%DATADIR%%
+@unexec /usr/bin/killall badula-sd > /dev/null 2>&1 || true
+@unexec /usr/bin/killall bacula-dir > /dev/null 2>&1 || true
+@exec mkdir -p %%BACULA_DIR%%
diff --git a/sysutils/bacula-server-devel/pkg-plist.client b/sysutils/bacula-server-devel/pkg-plist.client
new file mode 100644
index 0000000..41c7f6c
--- /dev/null
+++ b/sysutils/bacula-server-devel/pkg-plist.client
@@ -0,0 +1,7 @@
+etc/rc.d/z-bacula.sh.sample
+sbin/bacula-fd
+sbin/bconsole
+%%GNOMECONS%%sbin/gnome-console
+%%WXCONS%%sbin/wx-console
+@unexec /usr/bin/killall badula-fd > /dev/null 2>&1 || true
+@exec mkdir -p %%BACULA_DIR%%
OpenPOWER on IntegriCloud