aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorwxs <wxs@FreeBSD.org>2009-06-16 02:17:17 +0800
committerwxs <wxs@FreeBSD.org>2009-06-16 02:17:17 +0800
commitd146e63356ee896aa4149abc631d3e4c16740bff (patch)
treed23205c8690729e47af50792dff451d27cf3616e /sysutils
parent82a436449cbf03f3a2e17bfa6487cb4d873d7cf9 (diff)
downloadfreebsd-ports-graphics-d146e63356ee896aa4149abc631d3e4c16740bff.tar.gz
freebsd-ports-graphics-d146e63356ee896aa4149abc631d3e4c16740bff.tar.zst
freebsd-ports-graphics-d146e63356ee896aa4149abc631d3e4c16740bff.zip
- Reintroduce bacula2.x as sysutils/bacula2-server and sysutils/bacula2-client
- The 3.x line of bacula does not work with 2.x so these ports exist for those who can not upgrade to 3.x. Besides security/infrastructure fixes this port is not likely to see any functional upgrades. - The bacula-*-devel ports will be updated to a 3.1 release when it is available. PR: ports/135580 Submitted by: Vaclav Haisman <v.haisman@sh.cvut.cz> Approved by: dvl (old maintainer) Thanks to: miwi for build-testing
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/Makefile2
-rw-r--r--sysutils/bacula2-client/Makefile14
-rw-r--r--sysutils/bacula2-server/Makefile310
-rw-r--r--sysutils/bacula2-server/distinfo3
-rw-r--r--sysutils/bacula2-server/files/bacula-barcodes51
-rw-r--r--sysutils/bacula2-server/files/bacula-dir.in31
-rw-r--r--sysutils/bacula2-server/files/bacula-fd.in31
-rw-r--r--sysutils/bacula2-server/files/bacula-sd.conf.in20
-rw-r--r--sysutils/bacula2-server/files/bacula-sd.in31
-rw-r--r--sysutils/bacula2-server/files/chio-bacula200
-rw-r--r--sysutils/bacula2-server/files/patch-scripts-Makefile.in11
-rw-r--r--sysutils/bacula2-server/files/patch-src-console-Makefile.in19
-rw-r--r--sysutils/bacula2-server/files/patch-src-qt-console-build-depkgs-qt-console11
-rw-r--r--sysutils/bacula2-server/files/patch-src-stored-acquire.c23
-rw-r--r--sysutils/bacula2-server/files/patch-src-stored-reserve.c28
-rw-r--r--sysutils/bacula2-server/files/pkg-message.client.in15
-rw-r--r--sysutils/bacula2-server/files/pkg-message.server.in63
-rw-r--r--sysutils/bacula2-server/pkg-deinstall.client31
-rw-r--r--sysutils/bacula2-server/pkg-deinstall.server32
-rw-r--r--sysutils/bacula2-server/pkg-descr11
-rw-r--r--sysutils/bacula2-server/pkg-install.client43
-rw-r--r--sysutils/bacula2-server/pkg-install.server62
-rw-r--r--sysutils/bacula2-server/pkg-plist45
-rw-r--r--sysutils/bacula2-server/pkg-plist.client8
24 files changed, 1095 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index 4794bb276fc..89b76e608e8 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -45,6 +45,8 @@
SUBDIR += autopsy
SUBDIR += avfs
SUBDIR += b43-fwcutter
+ SUBDIR += bacula2-client
+ SUBDIR += bacula2-server
SUBDIR += bacula-bat
SUBDIR += bacula-client
SUBDIR += bacula-client-devel
diff --git a/sysutils/bacula2-client/Makefile b/sysutils/bacula2-client/Makefile
new file mode 100644
index 00000000000..304a49909d9
--- /dev/null
+++ b/sysutils/bacula2-client/Makefile
@@ -0,0 +1,14 @@
+
+# $FreeBSD$
+
+PORTNAME= bacula2
+PKGNAMESUFFIX= -client
+
+MASTERDIR= ${.CURDIR}/../bacula2-server
+COMMENT= The network backup solution (client)
+PLIST= ${PKGDIR}/pkg-plist.client
+
+WITH_CLIENT_ONLY= yes
+USE_RC_SUBR= bacula-fd
+
+.include "${MASTERDIR}/Makefile"
diff --git a/sysutils/bacula2-server/Makefile b/sysutils/bacula2-server/Makefile
new file mode 100644
index 00000000000..382353b1295
--- /dev/null
+++ b/sysutils/bacula2-server/Makefile
@@ -0,0 +1,310 @@
+# New ports collection makefile for: bacula
+# Date created: 24 February 2003
+# Whom: Dmitry Sivachenko <demon@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= bacula2
+DISTVERSION= 2.4.4
+CATEGORIES?= sysutils
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR= bacula
+
+MAINTAINER= v.haisman@sh.cvut.cz
+COMMENT?= The network backup solution (server)
+
+PKGNAMESUFFIX?= -server
+
+CONFLICTS= bacula-server-devel-[0-9]* \
+ bacula-client-devel-[0-9]* \
+ bacula-docs-devel-[0-9]* \
+ bacula-server-[0-9]* \
+ bacula-client-[0-9]*
+
+UNIQUENAME?=${PORTNAME}${PKGNAMESUFFIX}
+
+DISTFILES= bacula-${DISTVERSION}.tar.gz
+WRKSRC= ${WRKDIR}/bacula-${DISTVERSION}
+
+.if !defined(WITH_BAT)
+.if !defined(WITH_CLIENT_ONLY)
+USE_RC_SUBR?= bacula-dir bacula-sd
+.endif
+
+.if defined(WITH_CLIENT_ONLY)
+SUB_FILES+= pkg-message.client
+.else
+SUB_FILES+= pkg-message.server
+.endif
+.endif
+
+# 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
+#
+MANCOMPRESSED= yes
+GNU_CONFIGURE= yes
+CONFIGURE_ARGS+= --with-tcp-wrappers=/usr/lib \
+ --enable-smartalloc \
+ --with-working-dir=${BACULA_DIR} \
+ --with-scriptdir=${PREFIX}/share/${PORTNAME} \
+ --with-readline=yes \
+ --disable-conio \
+ --enable-batch-insert
+
+.if defined(WITH_CLIENT_ONLY)
+CONFIGURE_ARGS+= --with-fd-user=root \
+ --with-fd-group=wheel
+.else
+CONFIGURE_ARGS+=--with-dir-user=bacula \
+ --with-dir-group=bacula \
+ --with-sd-user=bacula \
+ --with-sd-group=operator
+.endif
+
+CONFIGURE_ENV+= CPPFLAGS="-I/usr/include/readline -I${LOCALBASE}/include" \
+ LDFLAGS="-L${LOCALBASE}/lib" \
+ PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \
+ PTHREAD_LIBS="${PTHREAD_LIBS}"
+
+.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: deprecated" off
+OPTIONS+= GNOMECONSOLE "Build with GNOME based GUI console: deprecated" off
+.elif defined(WITH_BAT)
+OPTIONS=
+.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+= NLS "Native Language Support via gettext utilities" on
+OPTIONS+= OPENSSL "Enable OpenSSL for encrypted communication" off
+
+# Prepare if bgnome-console is selected this must be happen before
+# include of bsd.port.pre.mk!
+WANT_GNOME= yes
+.if defined(WITH_GNOMECONSOLE)
+USE_GNOME= libgnome gnomelibs libgnomeui
+.endif
+
+.if !defined(WITH_BAT)
+PLIST_SUB+= BACULA_DIR=${BACULA_DIR}
+.endif
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_NLS)
+USE_GETTEXT= yes
+CONFIGURE_ARGS+= --enable-nls
+.else
+CONFIGURE_ARGS+= --disable-nls
+.endif
+
+# overridden if client install
+PKGDEINSTALL= ${PKGDIR}/pkg-deinstall.server
+PKGINSTALL= ${PKGDIR}/pkg-install.server
+
+# 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 bgnome-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 bwx-console
+.if defined(WITH_WXCONSOLE)
+USE_WX= 2.4
+CONFIGURE_ARGS+= --enable-bwx-console
+CONFIGURE_ENV+= WXCONFIG="${WX_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
+SUB_LIST+= REQ_MYSQL=mysql REQ_PGSQL=""
+.elif defined(WITH_POSTGRESQL)
+DEFAULT_PGSQL_VER?= 82
+USE_PGSQL= yes
+CONFIGURE_ARGS+= --with-postgresql=yes
+DBTYPE= postgresql
+SUB_LIST+= REQ_MYSQL="" REQ_PGSQL=postgresql
+.elif defined(WITH_SQLITE3)
+CONFIGURE_ARGS+= --with-sqlite3=yes
+LIB_DEPENDS+= sqlite3:${PORTSDIR}/databases/sqlite3
+DBTYPE= sqlite3
+.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_BAT)
+.if defined(WITH_CLIENT_ONLY)
+MAN8=bacula-fd.8 bconsole.8
+.else
+MAN8=bacula.8 bacula-dir.8 bacula-sd.8 bcopy.8 bextract.8 bls.8 bscan.8 btape.8 btraceback.8 dbcheck.8
+MAN1=bsmtp.1 bacula-bgnome-console.1 bacula-tray-monitor.1 bacula-bwxconsole.1
+.endif
+.endif
+
+MAKE_ARGS+= -E MAN8 -E MAN1
+MAKE_ENV+= MAN8="${MAN8}" MAN1="${MAN1}"
+
+pre-everything::
+.if !defined(WITH_CLIENT_ONLY)
+ @${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} " WITH_OPENSSL=yes Enable OpenSSL for encrypted communication."
+ @${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/bacula 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 '/^fd_subdirs = /s|src/filed||' -e 's|src/console||' ${WRKSRC}/Makefile.in
+.endif
+
+.if !target(pre-install)
+pre-install:
+ if [ ! -d "${BACULA_DIR}" ]; then \
+ ${ECHO_CMD} "creating ${BACULA_DIR}" ; \
+ ${MKDIR} ${BACULA_DIR}; \
+ else \
+ ${ECHO_CMD} "${BACULA_DIR} already exists"; \
+ fi
+
+# Extend /etc/services and install UID/GID
+ @ ${SETENV} PKG_PREFIX=${PREFIX} \
+ ${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL
+.endif
+
+
+.if !target(post-install)
+post-install:
+.if defined(WITH_CLIENT_ONLY)
+# 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}; \
+ ${CHGRP} bacula ${PREFIX}/etc/bconsole.conf.new; \
+ elif [ -f ${PREFIX}/etc/bconsole.conf ]; then \
+ ${MV} ${PREFIX}/etc/bconsole.conf ${PREFIX}/etc/bconsole.conf.sample; \
+ ${CHGRP} bacula ${PREFIX}/etc/bconsole.conf.sample; \
+ ${ECHO_CMD} "etc/bconsole.conf.sample" >> ${TMPPLIST}; \
+ fi
+.if defined(WITH_WXCONSOLE)
+ if [ -f ${PREFIX}/etc/bwx-console.conf.new ]; then \
+ ${ECHO_CMD} "etc/bwx-console.conf.new" >> ${TMPPLIST}; \
+ elif [ -f ${PREFIX}/etc/bwx-console.conf ]; then \
+ ${MV} ${PREFIX}/etc/bwx-console.conf ${PREFIX}/etc/bwx-console.conf.sample; \
+ ${ECHO_CMD} "etc/bwx-console.conf.sample" >> ${TMPPLIST}; \
+ fi
+.endif
+.if defined(WITH_GNOMECONSOLE)
+ if [ -f ${PREFIX}/etc/bgnome-console.conf.new ]; then \
+ ${ECHO_CMD} "etc/bgnome-console.conf.new" >> ${TMPPLIST}; \
+ elif [ -f ${PREFIX}/etc/bgnome-console.conf ]; then \
+ ${MV} ${PREFIX}/etc/bgnome-console.conf ${PREFIX}/etc/bgnome-console.conf.sample; \
+ ${ECHO_CMD} "etc/bgnome-console.conf.sample" >> ${TMPPLIST}; \
+ fi
+.endif
+
+# ensure that users in the bacula group can run bconsole
+ ${CHGRP} bacula ${PREFIX}/sbin/bconsole
+.else
+# 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
+
+ @${CAT} ${PKGMESSAGE}
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/bacula2-server/distinfo b/sysutils/bacula2-server/distinfo
new file mode 100644
index 00000000000..7b43df3c426
--- /dev/null
+++ b/sysutils/bacula2-server/distinfo
@@ -0,0 +1,3 @@
+MD5 (bacula-2.4.4.tar.gz) = 4eb6155b45611018af03002d37a2ffde
+SHA256 (bacula-2.4.4.tar.gz) = 3a698bdf0fd3f55733a6a4aabe8c3dc2b1ed1ad5ca7fab000f6e0f804a9d3d38
+SIZE (bacula-2.4.4.tar.gz) = 3145564
diff --git a/sysutils/bacula2-server/files/bacula-barcodes b/sysutils/bacula2-server/files/bacula-barcodes
new file mode 100644
index 00000000000..0a0b2dc28f2
--- /dev/null
+++ b/sysutils/bacula2-server/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/bacula2-server/files/bacula-dir.in b/sysutils/bacula2-server/files/bacula-dir.in
new file mode 100644
index 00000000000..4124b1a2e9f
--- /dev/null
+++ b/sysutils/bacula2-server/files/bacula-dir.in
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: bacula_dir
+# REQUIRE: DAEMON %%REQ_MYSQL%% %%REQ_PGSQL%%
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# bacula_dir_enable (bool): Set to NO by default.
+# Set it to YES to enable bacula_dir.
+# bacula_dir_flags (params): Set params used to start bacula_dir.
+#
+
+. %%RC_SUBR%%
+
+name="bacula_dir"
+rcvar=${name}_enable
+command=%%PREFIX%%/sbin/bacula-dir
+
+load_rc_config $name
+
+: ${bacula_dir_enable="NO"}
+: ${bacula_dir_flags=" -u bacula -g bacula -v -c %%PREFIX%%/etc/bacula-dir.conf"}
+: ${bacula_dir_pidfile="/var/run/bacula-dir.9101.pid"}
+
+pidfile="${bacula_dir_pidfile}"
+
+run_rc_command "$1"
diff --git a/sysutils/bacula2-server/files/bacula-fd.in b/sysutils/bacula2-server/files/bacula-fd.in
new file mode 100644
index 00000000000..507a1699e6b
--- /dev/null
+++ b/sysutils/bacula2-server/files/bacula-fd.in
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: bacula_fd
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# bacula_fd_enable (bool): Set to NO by default.
+# Set it to YES to enable bacula_fd.
+# bacula_fd_flags (params): Set params used to start bacula_fd.
+#
+
+. %%RC_SUBR%%
+
+name="bacula_fd"
+rcvar=${name}_enable
+command=%%PREFIX%%/sbin/bacula-fd
+
+load_rc_config $name
+
+: ${bacula_fd_enable="NO"}
+: ${bacula_fd_flags=" -u root -g wheel -v -c %%PREFIX%%/etc/bacula-fd.conf"}
+: ${bacula_fd_pidfile="/var/run/bacula-fd.9102.pid"}
+
+pidfile="${bacula_fd_pidfile}"
+
+run_rc_command "$1"
diff --git a/sysutils/bacula2-server/files/bacula-sd.conf.in b/sysutils/bacula2-server/files/bacula-sd.conf.in
new file mode 100644
index 00000000000..9c3bbafc134
--- /dev/null
+++ b/sysutils/bacula2-server/files/bacula-sd.conf.in
@@ -0,0 +1,20 @@
+--- src/stored/bacula-sd.conf.in.org Tue Feb 13 18:56:09 2007
++++ src/stored/bacula-sd.conf.in Tue Feb 13 18:56:16 2007
+@@ -152,6 +152,7 @@
+ #Device {
+ # Name = "DVD-Writer"
+ # Media Type = DVD
++# Device Type = DVD
+ # Archive Device = /dev/hdc
+ # LabelMedia = yes; # lets Bacula label unlabeled media
+ # Random Access = Yes;
+@@ -162,7 +163,9 @@
+ # RequiresMount = yes;
+ # MountPoint = /mnt/cdrom;
+ # MountCommand = "/bin/mount -t iso9660 -o ro %a %m";
++# MountCommand = "/sbin/mount -t cd9660 -o ro %a %m"; # FreeBSD
+ # UnmountCommand = "/bin/umount %m";
++# UnmountCommand = "/sbin/umount %m"; # FreeBSD
+ # SpoolDirectory = /tmp/backup;
+ # WritePartCommand = "/etc/bacula/dvd-handler %a write %e %v"
+ # FreeSpaceCommand = "/etc/bacula/dvd-handler %a free"
diff --git a/sysutils/bacula2-server/files/bacula-sd.in b/sysutils/bacula2-server/files/bacula-sd.in
new file mode 100644
index 00000000000..6916dd5b898
--- /dev/null
+++ b/sysutils/bacula2-server/files/bacula-sd.in
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: bacula_sd
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# bacula_sd_enable (bool): Set to NO by default.
+# Set it to YES to enable bacula_sd.
+# bacula_sd_flags (params): Set params used to start bacula_sd.
+#
+
+. %%RC_SUBR%%
+
+name="bacula_sd"
+rcvar=`set_rcvar`
+command=%%PREFIX%%/sbin/bacula-sd
+
+load_rc_config $name
+
+: ${bacula_sd_enable="NO"}
+: ${bacula_sd_flags=" -u bacula -g bacula -v -c %%PREFIX%%/etc/bacula-sd.conf"}
+: ${bacula_sd_pidfile="/var/run/bacula-sd.9103.pid"}
+
+pidfile="${bacula_sd_pidfile}"
+
+run_rc_command "$1"
diff --git a/sysutils/bacula2-server/files/chio-bacula b/sysutils/bacula2-server/files/chio-bacula
new file mode 100644
index 00000000000..ca7ec493158
--- /dev/null
+++ b/sysutils/bacula2-server/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/bacula2-server/files/patch-scripts-Makefile.in b/sysutils/bacula2-server/files/patch-scripts-Makefile.in
new file mode 100644
index 00000000000..d05246bbbcd
--- /dev/null
+++ b/sysutils/bacula2-server/files/patch-scripts-Makefile.in
@@ -0,0 +1,11 @@
+--- scripts/Makefile.in.orig Tue Sep 12 12:03:08 2006
++++ scripts/Makefile.in Tue Sep 12 12:03:08 2006
+@@ -33,8 +33,6 @@
+ $(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
diff --git a/sysutils/bacula2-server/files/patch-src-console-Makefile.in b/sysutils/bacula2-server/files/patch-src-console-Makefile.in
new file mode 100644
index 00000000000..e31efc2e2a9
--- /dev/null
+++ b/sysutils/bacula2-server/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/bacula2-server/files/patch-src-qt-console-build-depkgs-qt-console b/sysutils/bacula2-server/files/patch-src-qt-console-build-depkgs-qt-console
new file mode 100644
index 00000000000..2e0a7e6d2d5
--- /dev/null
+++ b/sysutils/bacula2-server/files/patch-src-qt-console-build-depkgs-qt-console
@@ -0,0 +1,11 @@
+--- src/qt-console/build-depkgs-qt-console.orig Sat Sep 15 12:11:32 2007
++++ src/qt-console/build-depkgs-qt-console Sat Sep 15 12:11:32 2007
+@@ -147,7 +147,7 @@
+ echo " INSTALLBASE = ${TOP_DIR}/qwt" >>${TOP_DIR}/depkgs/qwt-5.0.2/qwtconfig.pri
+ echo "}" >>${TOP_DIR}/depkgs/qwt-5.0.2/qwtconfig.pri
+ cat ${TOP_DIR}/qwtconfig.pri >>${TOP_DIR}/depkgs/qwt-5.0.2/qwtconfig.pri
+- qmake >make.log
++ ${QMAKE} >make.log
+ do_make Makefile >>make.log
+ do_make Makefile install >>make.log
+ echo "In case of problems see: `pwd`/make.log"
diff --git a/sysutils/bacula2-server/files/patch-src-stored-acquire.c b/sysutils/bacula2-server/files/patch-src-stored-acquire.c
new file mode 100644
index 00000000000..1d644900cbf
--- /dev/null
+++ b/sysutils/bacula2-server/files/patch-src-stored-acquire.c
@@ -0,0 +1,23 @@
+Index: src/stored/acquire.c
+===================================================================
+--- src/stored/acquire.c (revision 8426)
++++ src/stored/acquire.c (working copy)
+@@ -1,7 +1,7 @@
+ /*
+ Bacula® - The Network Backup Solution
+
+- Copyright (C) 2002-2008 Free Software Foundation Europe e.V.
++ Copyright (C) 2002-2009 Free Software Foundation Europe e.V.
+
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+@@ -647,8 +647,8 @@
+
+ /* Detach this dcr only if attached */
+ if (dcr->attached_to_dev && dev) {
++ dev->dlock();
+ dcr->unreserve_device();
+- dev->dlock();
+ dcr->dev->attached_dcrs->remove(dcr); /* detach dcr from device */
+ dcr->attached_to_dev = false;
+ // remove_dcr_from_dcrs(dcr); /* remove dcr from jcr list */
diff --git a/sysutils/bacula2-server/files/patch-src-stored-reserve.c b/sysutils/bacula2-server/files/patch-src-stored-reserve.c
new file mode 100644
index 00000000000..589404f8427
--- /dev/null
+++ b/sysutils/bacula2-server/files/patch-src-stored-reserve.c
@@ -0,0 +1,28 @@
+Index: src/stored/reserve.c
+===================================================================
+--- src/stored/reserve.c (revision 8426)
++++ src/stored/reserve.c (working copy)
+@@ -1,7 +1,7 @@
+ /*
+ Bacula® - The Network Backup Solution
+
+- Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
++ Copyright (C) 2000-2009 Free Software Foundation Europe e.V.
+
+ The main author of Bacula is Kern Sibbald, with contributions from
+ many others, a complete list can be found in the file AUTHORS.
+@@ -498,7 +498,6 @@
+ void DCR::unreserve_device()
+ {
+ lock_volumes();
+- dev->dlock();
+ if (is_reserved()) {
+ clear_reserved();
+ reserved_volume = false;
+@@ -514,7 +513,6 @@
+ volume_unused(this);
+ }
+ }
+- dev->dunlock();
+ unlock_volumes();
+ }
diff --git a/sysutils/bacula2-server/files/pkg-message.client.in b/sysutils/bacula2-server/files/pkg-message.client.in
new file mode 100644
index 00000000000..8d64c04d701
--- /dev/null
+++ b/sysutils/bacula2-server/files/pkg-message.client.in
@@ -0,0 +1,15 @@
+################################################################################
+
+NOTE:
+Sample files are installed in ${PREFIX}/etc:
+bconsole.conf.sample, bacula-barcodes.sample, bacula-fd.conf.sample
+
+ Please read this file:
+
+ %%DOCSDIR%%/ReleaseNotes
+
+ as installed by docs port for the upgrade procedure.
+
+Read the ReleaseNotes for further information.
+
+################################################################################
diff --git a/sysutils/bacula2-server/files/pkg-message.server.in b/sysutils/bacula2-server/files/pkg-message.server.in
new file mode 100644
index 00000000000..44862d9a2b7
--- /dev/null
+++ b/sysutils/bacula2-server/files/pkg-message.server.in
@@ -0,0 +1,63 @@
+################################################################################
+NOTE:
+
+An auto-changer manipulation script based on FreeBSDs
+chio command is included and installed at
+
+ ${PREFIX}/sbin/chio-bacula
+
+Please have a look at it if you want to use an
+autochanger. You have to configure the usage in
+
+ ${PREFIX}/etc/bacula-dir.conf
+
+Take care of correct permissions for changer and
+tape device (e.g. /dev/ch0 and /dev/n[r]sa0) i.e.
+they must be accessible by user bacula.
+
+Due to lack of some features in the FreeBSD tape driver
+implementation you MUST add some OS dependent options to
+the bacula-sd.conf file:
+
+ Hardware End of Medium = no;
+ Backward Space Record = no;
+ Backward Space File = no;
+
+With 2 filemarks at EOT (see man mt):
+ Fast Forward Space File = no;
+ BSF at EOM = yes;
+ TWO EOF = yes;
+
+With 1 filemarks at EOT (see man mt):
+ Fast Forward Space File = yes;
+ BSF at EOM = no;
+ TWO EOF = no;
+
+NOTE: YOU CAN SWITCH EOT model ONLY when starting
+ from scratch with EMPTY tapes.
+
+It is also important that all the scripts accessed
+by RunBeforeJob and RunAfterJob will be executed by
+the user bacula. Check your permissions.
+
+For USB support read the bacula manual. It could be necessary
+to configure/compile a new kernel.
+
+Look at ${PREFIX}/share/bacula/update_bacula_tables for
+database update procedure. Details can be found in the
+ReleaseNotes
+
+ Please read this file:
+
+ %%DOCSDIR%%/ReleaseNotes
+
+ as installed by docs port for the upgrade procedure.
+
+IMPORTANT UPGRADE NOTES FOR THIS RELEASE:
+
+- bacula-client and bacula-server do not need to be simultaneously
+upgraded.
+
+Read the ReleaseNotes for further information.
+
+################################################################################
diff --git a/sysutils/bacula2-server/pkg-deinstall.client b/sysutils/bacula2-server/pkg-deinstall.client
new file mode 100644
index 00000000000..206ec9efca6
--- /dev/null
+++ b/sysutils/bacula2-server/pkg-deinstall.client
@@ -0,0 +1,31 @@
+#!/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 groupshow "${USER}" 2>/dev/null 1>&2; then
+ echo "To delete Bacula group permanently, use 'pw groupdel ${GROUP}'"
+ fi
+ ;;
+esac
diff --git a/sysutils/bacula2-server/pkg-deinstall.server b/sysutils/bacula2-server/pkg-deinstall.server
new file mode 100644
index 00000000000..3af06150918
--- /dev/null
+++ b/sysutils/bacula2-server/pkg-deinstall.server
@@ -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/bacula2-server/pkg-descr b/sysutils/bacula2-server/pkg-descr
new file mode 100644
index 00000000000..4167c26533d
--- /dev/null
+++ b/sysutils/bacula2-server/pkg-descr
@@ -0,0 +1,11 @@
+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.
+
+WWW: http://www.bacula.org/
diff --git a/sysutils/bacula2-server/pkg-install.client b/sysutils/bacula2-server/pkg-install.client
new file mode 100644
index 00000000000..656acca8373
--- /dev/null
+++ b/sysutils/bacula2-server/pkg-install.client
@@ -0,0 +1,43 @@
+#!/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
+PRE-INSTALL)
+ # Install UID/GID
+ USER=bacula
+ GROUP=${USER}
+ UID=910
+ GID=${UID}
+
+ if [ ! -d ${BACULA_DIR} ]; then
+ mkdir -p ${BACULA_DIR}
+ fi
+
+ 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
+
+ chgrp -R ${GROUP} ${BACULA_DIR}
+ ;;
+esac
diff --git a/sysutils/bacula2-server/pkg-install.server b/sysutils/bacula2-server/pkg-install.server
new file mode 100644
index 00000000000..1dc3d8613ad
--- /dev/null
+++ b/sysutils/bacula2-server/pkg-install.server
@@ -0,0 +1,62 @@
+#!/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
+PRE-INSTALL)
+ # Install UID/GID
+ USER=bacula
+ GROUP=${USER}
+ UID=910
+ GID=${UID}
+
+ if [ ! -d ${BACULA_DIR} ]; then
+ mkdir -p ${BACULA_DIR}
+ fi
+
+ 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/bacula2-server/pkg-plist b/sysutils/bacula2-server/pkg-plist
new file mode 100644
index 00000000000..8ba64eccb53
--- /dev/null
+++ b/sysutils/bacula2-server/pkg-plist
@@ -0,0 +1,45 @@
+sbin/bacula-dir
+sbin/bacula-sd
+sbin/bcopy
+sbin/bextract
+sbin/bls
+sbin/bregex
+sbin/bscan
+sbin/bsmtp
+sbin/btape
+sbin/btraceback
+sbin/bwild
+sbin/chio-bacula
+sbin/dbcheck
+%%DATADIR%%/bacula
+%%DATADIR%%/bacula-ctl-dir
+%%DATADIR%%/bacula-ctl-fd
+%%DATADIR%%/bacula-ctl-sd
+%%DATADIR%%/bconsole
+%%DATADIR%%/btraceback.gdb
+%%DATADIR%%/btraceback.dbx
+%%DATADIR%%/create_bacula_database
+%%DATADIR%%/create_%%DBTYPE%%_database
+%%DATADIR%%/delete_catalog_backup
+%%DATADIR%%/disk-changer
+%%DATADIR%%/drop_bacula_database
+%%DATADIR%%/drop_bacula_tables
+%%DATADIR%%/drop_%%DBTYPE%%_database
+%%DATADIR%%/drop_%%DBTYPE%%_tables
+%%DATADIR%%/dvd-handler
+%%DATADIR%%/gconsole
+%%DATADIR%%/grant_bacula_privileges
+%%DATADIR%%/grant_%%DBTYPE%%_privileges
+%%DATADIR%%/make_bacula_tables
+%%DATADIR%%/make_catalog_backup
+%%DATADIR%%/make_%%DBTYPE%%_tables
+%%DATADIR%%/mtx-changer
+%%DATADIR%%/query.sql
+%%DATADIR%%/update_bacula_tables
+%%DATADIR%%/update_%%DBTYPE%%_tables
+
+@dirrm %%DATADIR%%
+@unexec /usr/bin/killall bacula-sd > /dev/null 2>&1 || true
+@unexec /usr/bin/killall bacula-dir > /dev/null 2>&1 || true
+@exec mkdir -p %%BACULA_DIR%%
+@dirrmtry %%BACULA_DIR%%
diff --git a/sysutils/bacula2-server/pkg-plist.client b/sysutils/bacula2-server/pkg-plist.client
new file mode 100644
index 00000000000..8285b9a481f
--- /dev/null
+++ b/sysutils/bacula2-server/pkg-plist.client
@@ -0,0 +1,8 @@
+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%%
+@dirrmtry %%BACULA_DIR%%
+@dirrm share/bacula