git: 51d12f23414c - main - sysutils/bareos-*: Copy to bareos20-* ports

From: Jose Alonso Cardenas Marquez <acm_at_FreeBSD.org>
Date: Sun, 16 Jan 2022 22:15:31 UTC
The branch main has been updated by acm:

URL: https://cgit.FreeBSD.org/ports/commit/?id=51d12f23414ca5b380dbd9dce8b01ddbfb44c3b3

commit 51d12f23414ca5b380dbd9dce8b01ddbfb44c3b3
Author:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
AuthorDate: 2022-01-16 22:13:15 +0000
Commit:     Jose Alonso Cardenas Marquez <acm@FreeBSD.org>
CommitDate: 2022-01-16 22:15:22 +0000

    sysutils/bareos-*: Copy to bareos20-* ports
    
    bareos-* ports will be updated to 21.0.0
---
 sysutils/bareos20-client/Makefile                  |   22 +
 sysutils/bareos20-server/Makefile                  |  242 +++
 sysutils/bareos20-server/Makefile.common           |   36 +
 sysutils/bareos20-server/distinfo                  |    3 +
 sysutils/bareos20-server/files/bareos-barcodes     |   51 +
 sysutils/bareos20-server/files/bareos-dir.in       |   55 +
 sysutils/bareos20-server/files/bareos-fd.in        |   46 +
 sysutils/bareos20-server/files/bareos-sd.in        |   37 +
 sysutils/bareos20-server/files/chio-bareos         |  190 ++
 .../files/patch-core-CMakeLists.txt                |   43 +
 .../patch-core-cmake_BareosCheckIncludes.cmake     |   39 +
 .../patch-core-cmake_BareosFindAllLibraries.cmake  |  108 ++
 ...patch-core-cmake_BareosInstallConfigFiles.cmake |  112 ++
 ...atch-core-cmake_BareosSetVariableDefaults.cmake |   15 +
 .../files/patch-core-manpages_CMakeLists.txt       |   14 +
 .../files/patch-core-scripts_CMakeLists.txt        |   59 +
 .../patch-core-src-dird-dbcopy_CMakeLists.txt      |   12 +
 .../files/patch-core-src-dird_CMakeLists.txt       |   21 +
 .../files/patch-core-src-include_baconfig.h        |   25 +
 .../patch-core-src-plugins-filed_CMakeLists.txt    |   13 +
 .../patch-core-src-plugins-stored_CMakeLists.txt   |   13 +
 .../files/patch-core-src-stored_CMakeLists.txt     |   32 +
 .../files/patch-core-src_CMakeLists.txt            |   38 +
 ...e_cmake_bareos-symlink-default-db-backend.cmake |   36 +
 .../bareos20-server/files/pkg-deinstall.client.in  |   30 +
 .../bareos20-server/files/pkg-install.client.in    |   13 +
 .../bareos20-server/files/pkg-message.client.in    |   17 +
 .../bareos20-server/files/pkg-message.server.in    |   74 +
 sysutils/bareos20-server/pkg-descr                 |    6 +
 sysutils/bareos20-server/pkg-plist                 |  176 ++
 sysutils/bareos20-server/pkg-plist.client          |   82 +
 sysutils/bareos20-traymonitor/Makefile             |   26 +
 sysutils/bareos20-traymonitor/pkg-descr            |    8 +
 sysutils/bareos20-traymonitor/pkg-plist            |    7 +
 www/bareos20-webui/Makefile                        |   65 +
 www/bareos20-webui/distinfo                        |    3 +
 www/bareos20-webui/files/pkg-message.in            |   19 +
 www/bareos20-webui/pkg-descr                       |   10 +
 www/bareos20-webui/pkg-plist                       | 1985 ++++++++++++++++++++
 39 files changed, 3783 insertions(+)

diff --git a/sysutils/bareos20-client/Makefile b/sysutils/bareos20-client/Makefile
new file mode 100644
index 000000000000..c49c27dc3688
--- /dev/null
+++ b/sysutils/bareos20-client/Makefile
@@ -0,0 +1,22 @@
+PORTNAME=	bareos
+PKGNAMESUFFIX=	-client
+
+COMMENT=	Backup archiving recovery open sourced (client)
+
+CONFLICTS=	bareos19-client bareos18-client bareos17-client
+
+WITH_CLIENT_ONLY=yes
+USE_RC_SUBR=	bareos-fd
+
+PLIST=		${PKGDIR}/pkg-plist.client
+MASTERDIR=	${.CURDIR}/../../sysutils/bareos-server
+
+OPTIONS_GROUP=	PLUGINS
+OPTIONS_GROUP_PLUGINS=	CEPHFS GFAPI RADOS
+OPTIONS_DEFINE=	NLS PYTHON SCSICRYPTO
+
+CEPHFS_DESC=	CEPHFS fd plugin support
+GFAPI_DESC=	GFAPI fd plugin support
+RADOS_DESC=	RADOS fd plugin support
+
+.include "${MASTERDIR}/Makefile"
diff --git a/sysutils/bareos20-server/Makefile b/sysutils/bareos20-server/Makefile
new file mode 100644
index 000000000000..21133a0d58fb
--- /dev/null
+++ b/sysutils/bareos20-server/Makefile
@@ -0,0 +1,242 @@
+PORTNAME=	bareos
+DISTVERSIONPREFIX=	Release/
+DISTVERSION=	20.0.3
+PORTREVISION?=	0
+CATEGORIES?=	sysutils
+PKGNAMEPREFIX?=	#
+PKGNAMESUFFIX?=	-server
+
+MAINTAINER=	acm@FreeBSD.org
+COMMENT?=	Backup archiving recovery open sourced (server)
+
+LICENSE=	AGPLv3 LGPL3
+LICENSE_COMB=	multi
+
+CONFLICTS?=	bareos19-server bareos18-server bareos17-server
+
+LIB_DEPENDS+=	liblzo2.so:archivers/lzo2 \
+		libjansson.so:devel/jansson
+
+USES+=		cmake compiler:c++11-lang cpe localbase perl5 pkgconfig readline \
+		shebangfix
+USE_GITHUB=	yes
+USE_PERL5=	run
+
+USERS=		bareos
+GROUPS=		${USERS}
+
+PLIST_SUB+=	LIB_VERSION=${PORTVERSION}
+
+USE_LDCONFIG=	yes
+SHEBANG_LANG=	perl
+SHEBANG_FILES=	${WRKSRC}/core/src/cats/make_catalog_backup.pl.in
+
+CPPFLAGS+=	-I${LOCALBASE}/readline -I${LOCALBASE}/include
+LDFLAGS+=	-L${LOCALBASE}/lib
+
+OPTIONS_DEFAULT=	OPENSSL
+OPTIONS_SINGLE=		CRYPTO
+OPTIONS_SINGLE_CRYPTO=	OPENSSL GNUTLS
+OPTIONS_SUB=		yes
+CRYPTO_DESC=		Cryptographic library
+MTX_DESC=		Install mtx for control of autochanger devices
+NDMP_DESC=		Enable build of NDMP support
+SCSICRYPTO_DESC=	Build LTO AME crypto plugin
+
+.if ${PKGNAMESUFFIX} == "-server"
+OPTIONS_GROUP=	BACKENDS
+OPTIONS_GROUP_BACKENDS=	CEPHFS GFAPI RADOS
+OPTIONS_DEFINE=		MTX PYTHON LMDB NDMP NLS SCSICRYPTO
+OPTIONS_DEFAULT+=	LMDB PGSQL SCSICRYPTO
+OPTIONS_SINGLE_DATABASE=	SQLITE3 MYSQL PGSQL
+OPTIONS_SINGLE+=		DATABASE
+BACKENDS_DESC=		Storage backends
+DATABASE_DESC=		Database support
+CEPHFS_DESC=	CEPHFS backend support
+GFAPI_DESC=	GFAPI backend support
+LMDB_DESC=	Enable faster accurate backup support
+RADOS_DESC=	RADOS backend support
+
+NDMP_CMAKE_ON=	-Dndmp=ON
+NDMP_CMAKE_OFF=	-Dndmp=OFF
+.endif
+
+GNUTLS_CONFIGURE_WITH=	gnutls=${LOCALBASE}
+GNUTLS_LIB_DEPENDS=	libgnutls.so:security/gnutls
+
+OPENSSL_USES=		ssl
+OPENSSL_CMAKE_ON=	-Dopenssl=ON
+OPENSSL_CMAKE_OFF=	-Dopenssl=OFF
+
+SCSICRYPTO_CMAKE_ON=	-Dscsi-crypto=ON
+SCSICRYPTO_CMAKE_OFF=	-Dscsi-crypto=OFF
+
+.if ${PKGNAMESUFFIX} == "-client" || ${PKGNAMESUFFIX} == "-server"  #Till end of the file
+PYTHON_USES=		python
+PYTHON_CMAKE_ON=	-Dpython=ON
+PYTHON_CMAKE_OFF=	-Dpython=OFF
+PYTHON_PLUGIN=		yes
+
+.if !defined(WITH_CLIENT_ONLY)
+LIB_DEPENDS+=	libbareos.so:sysutils/bareos-client
+USE_RC_SUBR?=	bareos-dir bareos-sd
+.endif
+
+.if defined(WITH_CLIENT_ONLY)
+SUB_FILES+=	pkg-install.client pkg-deinstall.client pkg-message.client
+.else
+SUB_FILES+=	pkg-message.server
+.endif
+
+CMAKE_ARGS+=	-Dtcp-wrappers=ON \
+		-Dsmartalloc=ON \
+		-Dsysconfdir=${PREFIX}/etc \
+		-Darchivedir=${BAREOS_DIR}/storage \
+		-Dworkingdir=${BAREOS_DIR} \
+		-Dconfdir=${PREFIX}/etc/bareos \
+		-Dlibdir=${PREFIX}/lib \
+		-Dlogdir=/var/log/bareos \
+		-Dincludedir=${PREFIX}/include/bareos \
+		-Dreadline=ON \
+		-Ddisable-conio=ON \
+		-Dbatch-insert=ON \
+		-Dhave_plugins=ON \
+		-Dplugindir=${PREFIX}/lib/bareos/plugins \
+		-Dscriptdir=${PREFIX}/lib/bareos/scripts \
+		-Dbackenddir=${PREFIX}/lib/bareos/backends \
+		-Ddump_email=root@localhost \
+		-Djob_email=root@localhost \
+		-Ddb_name=bareos \
+		-Dsbin-perm=755 \
+		-Ddb_user=bareos \
+		-Dbaseport=9101 \
+		-Dpiddir=/var/run/bareos
+
+.if defined(WITH_CLIENT_ONLY)
+CFLAGS+=	-DMDB_DSYNC=O_SYNC -DMDB_USE_POSIX_SEM=1
+
+CMAKE_ARGS+=	-Dfd-user=root \
+		-Dfd-group=wheel \
+		-Dlmdb=ON
+.else
+LMDB_CMAKE_ON=	-Dlmdb=ON
+LMDB_CMAKE_OFF=	-Dlmdb=OFF
+LMDB_CFLAGS+=	-DMDB_DSYNC=O_SYNC -DMDB_USE_POSIX_SEM=1
+
+CMAKE_ARGS+=	-Ddir-user=${BAREOS_USER} \
+		-Ddir-group=${BAREOS_GROUP} \
+		-Dsd-user=${BAREOS_USER} \
+		-Dsd-group=operator
+.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
+#
+BAREOS_USER?=	bareos
+BAREOS_GROUP?=	${BAREOS_USER}
+BAREOS_UID?=	997
+BAREOS_GID?=	${BAREOS_UID}
+BAREOS_DIR?=	/var/db/bareos
+
+PLIST_SUB+=	BAREOS_DIR=${BAREOS_DIR}
+
+SUB_LIST=	BAREOS_USER=${BAREOS_USER} \
+		BAREOS_GROUP=${BAREOS_GROUP} \
+		BAREOS_UID=${BAREOS_UID} \
+		BAREOS_GID=${BAREOS_GID} \
+		BAREOS_DIR=${BAREOS_DIR}
+
+NLS_USES=		gettext
+NLS_CMAKE_ON=		-Dnls=ON
+CEPHFS_CMAKE_ON=	-Dcephfs=ON
+CEPHFS_LIB_DEPENDS=	libcephfs.so:net/ceph14
+GFAPI_CMAKE_ON=		-Dgfapi=ON
+GFAPI_LIB_DEPENDS=	libglusterfs.so:net/glusterfs
+RADOS_CMAKE_ON=		-Drados=ON -Dcephfs=ON
+RADOS_LIB_DEPENDS=	librados.so:net/ceph14
+
+# Client only or full server version
+.if defined(WITH_CLIENT_ONLY)
+CONFFILES=	fd
+CMAKE_ARGS+=	-Dclient-only=ON
+
+PKGDEINSTALL=	${FILESDIR}/pkg-deinstall.client
+PKGINSTALL=	${FILESDIR}/pkg-install.client
+.else
+# Server only Options
+CONFFILES=		sd dir
+CMAKE_ARGS+=	-Dbuild-dird=ON \
+		-Dbuild-stored=ON \
+		-Dbuild_client_only=OFF
+# Server default database
+
+MYSQL_CMAKE_ON=		-Dmysql=ON
+MYSQL_USES=	mysql
+SQLITE3_CMAKE_ON=	-Dsqlite3=ON
+SQLITE3_LIB_DEPENDS=	libsqlite3.so:databases/sqlite3
+PGSQL_CMAKE_ON=		-Dpostgresql=ON
+PGSQL_USES=	pgsql
+
+MTX_RUN_DEPENDS=	${LOCALBASE}/sbin/mtx:misc/mtx
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MMYSQL}
+DBTYPE=			mysql
+SUB_LIST+=		REQ_MYSQL=mysql REQ_PGSQL=""
+.elif ${PORT_OPTIONS:MSQLITE3}
+DBTYPE=			sqlite3
+.else
+DBTYPE=			postgresql
+SUB_LIST+=		REQ_MYSQL="" REQ_PGSQL=postgresql
+.endif
+PLIST_SUB+=		DBTYPE=${DBTYPE}
+
+.endif
+
+.if defined(WITH_CLIENT_ONLY)
+MP1+=	bconsole.1
+MP8+=	bareos-fd.8
+.else
+MP8+=	bareos.8 bareos-dir.8 bareos-sd.8 bcopy.8 bextract.8 bls.8 bscan.8 \
+	btape.8 btraceback.8 bareos-dbcheck.8
+MP1+=	bsmtp.1 bregex.1 bwild.1 bareos-tray-monitor.1
+.endif
+
+MAKE_ENV+=	MAN8="${MP8}" MAN1="${MP1}"
+
+post-patch:
+	@${REINPLACE_CMD}  '76,79d' ${WRKSRC}/CMakeLists.txt
+.if ${PKGNAMESUFFIX} == "-server"
+	@${REINPLACE_CMD}  '45d' ${WRKSRC}/core/src/CMakeLists.txt
+	@${REINPLACE_CMD}  '51d' ${WRKSRC}/core/src/plugins/CMakeLists.txt
+.endif
+
+post-extract:
+.if defined(WITH_CLIENT_ONLY)
+.	if defined(PYTHON_PLUGIN)
+		@${MKDIR} ${STAGEDIR}${ETCDIR}/python-ldap-conf.d/bareos-dir.d/fileset
+		@${MKDIR} ${STAGEDIR}${ETCDIR}/python-ldap-conf.d/bareos-dir.d/job
+.	endif
+.endif
+	@${MV} ${WRKSRC}/core/src/defaultconfigs/bareos-dir.d/fileset/'Windows All Drives.conf' \
+		${WRKSRC}/core/src/defaultconfigs/bareos-dir.d/fileset/'WindowsAllDrives.conf'
+
+.if !target(post-install)
+post-install:
+.if defined(WITH_CLIENT_ONLY)
+	${MKDIR} ${STAGEDIR}${ETCDIR}/bconsole.d/
+	${MV} ${STAGEDIR}${ETCDIR}/bconsole.conf ${STAGEDIR}${ETCDIR}/bconsole.d/bconsole.conf.sample
+.else
+	${INSTALL_SCRIPT} ${FILESDIR}/chio-bareos ${STAGEDIR}${PREFIX}/sbin
+	${INSTALL_DATA} ${FILESDIR}/bareos-barcodes ${STAGEDIR}${ETCDIR}/bareos-barcodes.sample
+	${CHMOD} o+x ${STAGEDIR}${PREFIX}/bin/bsmtp
+	${MV} ${STAGEDIR}${ETCDIR}/mtx-changer.conf ${STAGEDIR}${ETCDIR}/mtx-changer.conf.sample
+	${MV} ${STAGEDIR}${ETCDIR}/bareos-regress.conf ${STAGEDIR}${ETCDIR}//bareos-regress.conf.sample
+.endif
+	@${MKDIR} ${STAGEDIR}/var/run/bareos
+.endif
+.else
+.include "${MASTERDIR}/Makefile.common"
+.endif # -client and -server are defined
+.include <bsd.port.mk>
diff --git a/sysutils/bareos20-server/Makefile.common b/sysutils/bareos20-server/Makefile.common
new file mode 100644
index 000000000000..7bad4fc0eb8d
--- /dev/null
+++ b/sysutils/bareos20-server/Makefile.common
@@ -0,0 +1,36 @@
+# Created by: Alonso Cardenas <acm@FreeBSD.org>
+post-patch:
+	@${REINPLACE_CMD}  '76,79d' ${WRKSRC}/CMakeLists.txt
+
+post-build:
+.if ${PKGNAMEPREFIX} == "nagios-check_"
+	${MAKE_CMD} -C ${WRKSRC}/examples/nagios/check_bareos
+.endif
+
+pre-install:
+.if ${PKGNAMESUFFIX} == "-traymonitor"
+.	for d in client director monitor storage
+		${MKDIR} ${STAGEDIR}${ETCDIR}/tray-monitor.d/${d}
+		${FIND} ${WRKSRC}/core/src/defaultconfigs/tray-monitor.d/${d} -type f -name '*.conf' -exec ${MV} -v {} {}.sample \;
+.	endfor
+.endif
+
+do-install:
+.if ${PKGNAMEPREFIX} == "nagios-check_"
+	@${MKDIR} ${STAGEDIR}${PREFIX}/libexec/nagios
+	${INSTALL_PROGRAM} ${WRKSRC}/examples/nagios/check_bareos/check_bareos \
+	${STAGEDIR}${PREFIX}/libexec/nagios
+.endif
+.if ${PKGNAMESUFFIX} == "-client-static"
+	${INSTALL_PROGRAM} ${WRKSRC}/src/filed/static-bareos-fd ${STAGEDIR}${PREFIX}/sbin/bareos-fd-static
+	${INSTALL_PROGRAM} ${WRKSRC}/src/console/static-bconsole ${STAGEDIR}${PREFIX}/sbin/bconsole-static
+.endif
+.if ${PKGNAMESUFFIX} == "-traymonitor"
+# Install config files and preserve existing ones
+.for d in client director monitor storage
+	${INSTALL_SCRIPT} ${WRKSRC}/core/src/defaultconfigs/tray-monitor.d/${d}/*.sample ${STAGEDIR}${ETCDIR}/tray-monitor.d/${d}/
+.endfor
+	${INSTALL_PROGRAM} ${CONFIGURE_WRKSRC}/core/src/qt-tray-monitor/bareos-tray-monitor ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_DATA} ${WRKSRC}/core/src/images/bareos_1.png ${STAGEDIR}${PREFIX}/share/pixmaps/bareos-tray-monitor.png
+	${INSTALL_DATA} ${WRKSRC}/core/src/qt-tray-monitor/bareos-tray-monitor.desktop ${STAGEDIR}${DESKTOPDIR}
+.endif
diff --git a/sysutils/bareos20-server/distinfo b/sysutils/bareos20-server/distinfo
new file mode 100644
index 000000000000..0347ca40d29d
--- /dev/null
+++ b/sysutils/bareos20-server/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1636154330
+SHA256 (bareos-bareos-Release-20.0.3_GH0.tar.gz) = 261be0f4b2843ccdf7593b627a479673a51cd3e8c7484c74ea963548f5f1b696
+SIZE (bareos-bareos-Release-20.0.3_GH0.tar.gz) = 13335390
diff --git a/sysutils/bareos20-server/files/bareos-barcodes b/sysutils/bareos20-server/files/bareos-barcodes
new file mode 100644
index 000000000000..f42cb7f7aeea
--- /dev/null
+++ b/sysutils/bareos20-server/files/bareos-barcodes
@@ -0,0 +1,51 @@
+#
+# Bacula barcode simulation file
+# used by ${PREFIX}/sbin/chio-bareos (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/bareos20-server/files/bareos-dir.in b/sysutils/bareos20-server/files/bareos-dir.in
new file mode 100644
index 000000000000..86b62370cbb7
--- /dev/null
+++ b/sysutils/bareos20-server/files/bareos-dir.in
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# PROVIDE: bareos_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:
+#
+# bareos_dir_enable  (bool):   Set to NO by default.
+#                Set it to YES to enable bareos_dir.
+# bareos_dir_flags (params):   Set params used to start bareos_dir.
+# bareos_dir_config (params):  Path to the config file/directory
+#
+
+. /etc/rc.subr
+
+name="bareos_dir"
+rcvar=${name}_enable
+
+load_rc_config $name
+
+: ${bareos_dir_enable="NO"}
+: ${bareos_dir_flags="-u bareos -g bareos -v"}
+: ${bareos_dir_config="%%PREFIX%%/etc/bareos/"}
+: ${bareos_dir_pidfile="/var/run/bareos/bareos-dir.9101.pid"}
+
+command=%%PREFIX%%/sbin/bareos-dir
+command_args="-c ${bareos_dir_config}"
+pidfile="${bareos_dir_pidfile}"
+bconsole_command=/usr/local/bin/bconsole
+start_precmd="bareos_start_precmd"
+restart_precmd="bareos_dir_configtest"
+reload_precmd="bareos_dir_configtest"
+reload_cmd="bareos_dir_reload"
+configtest_cmd="bareos_dir_configtest"
+
+bareos_start_precmd() {
+	[ -d "${pidfile%/*}" ] || install -d -o bareos -g bareos ${pidfile%/*}
+	bareos_dir_configtest
+}
+
+bareos_dir_configtest() {
+	echo "Performing sanity check on ${bareos_dir_config} configuration:"
+	eval ${command} -t
+}
+
+bareos_dir_reload() {
+	echo "Performing a graceful reload"
+	# bconsole always exits with 0, so we can't check the return status for success.
+	echo "reload" | ${bconsole_command}
+}
+
+extra_commands="reload configtest"
+run_rc_command "$1"
diff --git a/sysutils/bareos20-server/files/bareos-fd.in b/sysutils/bareos20-server/files/bareos-fd.in
new file mode 100644
index 000000000000..54647786b12c
--- /dev/null
+++ b/sysutils/bareos20-server/files/bareos-fd.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# PROVIDE: bareos_fd
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# bareos_fd_enable  (bool):  Set to NO by default.
+#               Set it to YES to enable bareos_fd.
+# bareos_fd_flags (params):  Set params used to start bareos_fd.
+# bareos_fd_config (params):  Path to the config file/directory
+#
+
+. /etc/rc.subr
+
+name="bareos_fd"
+rcvar=${name}_enable
+
+load_rc_config $name
+
+: ${bareos_fd_enable="NO"}
+: ${bareos_fd_flags="-u root -g wheel -v"}
+: ${bareos_fd_config="%%PREFIX%%/etc/bareos/"}
+: ${bareos_fd_pidfile="/var/run/bareos/bareos-fd.9102.pid"}
+
+command=%%PREFIX%%/sbin/bareos-fd
+command_args="-c ${bareos_fd_config}"
+pidfile="${bareos_fd_pidfile}"
+start_precmd="bareos_start_precmd"
+
+bareos_start_precmd() {
+	[ -d "${pidfile%/*}" ] || {
+		getent passwd bareos > /dev/null 2&>1
+		if [ $? -eq 0] ; then
+			# user bareos exists
+			install -d -o bareos -g bareos ${pidfile%/*}
+		else
+			# bareos_fd as solitair service
+			install -d -o root -g wheel ${pidfile%/*}
+		fi
+	}
+}
+
+run_rc_command "$1"
diff --git a/sysutils/bareos20-server/files/bareos-sd.in b/sysutils/bareos20-server/files/bareos-sd.in
new file mode 100644
index 000000000000..a5efe78e80f7
--- /dev/null
+++ b/sysutils/bareos20-server/files/bareos-sd.in
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# PROVIDE: bareos_sd
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# bareos_sd_enable  (bool):  Set to NO by default.
+#               Set it to YES to enable bareos_sd.
+# bareos_sd_flags (params):  Set params used to start bareos_sd.
+# bareos_sd_config (params): Path to the config file/directory
+#
+
+. /etc/rc.subr
+
+name="bareos_sd"
+rcvar=${name}_enable
+
+load_rc_config $name
+
+: ${bareos_sd_enable="NO"}
+: ${bareos_sd_flags="-u bareos -g bareos -v"}
+: ${bareos_sd_config="%%PREFIX%%/etc/bareos/"}
+: ${bareos_sd_pidfile="/var/run/bareos/bareos-sd.9103.pid"}
+
+command=%%PREFIX%%/sbin/bareos-sd
+command_args="-c ${bareos_sd_config}"
+pidfile="${bareos_sd_pidfile}"
+start_precmd="bareos_start_precmd"
+
+bareos_start_precmd() {
+	[ -d "${pidfile%/*}" ] || install -d -o bareos -g bareos ${pidfile%/*}
+}
+
+run_rc_command "$1"
diff --git a/sysutils/bareos20-server/files/chio-bareos b/sysutils/bareos20-server/files/chio-bareos
new file mode 100644
index 000000000000..f006ef78e6ce
--- /dev/null
+++ b/sysutils/bareos20-server/files/chio-bareos
@@ -0,0 +1,190 @@
+#!/bin/sh
+#
+# BAREOS interface to tape libraries and autoloaders for FreeBSD
+# (by Rudolf Cejka <cej...@fit.vutbr.cz>, v1.2, 2012/11/14)
+#
+# If you set in your Device resource
+#   Changer Command = "path-to-this-script/chio-changer %c %o %S %a %d"
+# you will have the following input to this script:
+#   chio-changer "changer-device" "command" "slot" "tape-device" "drive-index"
+#                       $1           $2       $3         $4            $5
+# for example (on a FreeBSD system):
+#   chio-changer /dev/ch0 load 1 /dev/nsa0 0
+#
+# If you change the script, take care to return either the chio exit
+# code or a 0. If the script exits with a non-zero exit code, BAREOS
+# will assume the request failed.
+#
+
+PROGNAME=`basename $0`
+
+# Uncomment the following line, if you want to log debug output.
+#DEBUG=/var/run/bareos/${PROGNAME}.log
+
+# Uncomment the following line, if you need to eject a tape before moving
+# it from the drive.
+#OFFLINE=yes
+
+# Uncomment one or more of the following lines, if you need to wait for
+# some time (in seconds) after unloading, loading or transferring a tape.
+#OFFLINE_SLEEP=10
+#LOAD_SLEEP=10
+#MOVE_SLEEP=10
+
+# Uncomment the following line, if you do not have a changer with volume
+# reader.
+#FAKE_BARCODES=/usr/local/etc/bareos-barcodes
+
+usage()
+{
+  cat <<EOF
+Usage: ${PROGNAME} <changer-device> <cmd> [slot] [tape-device] [drive-index]
+
+Commands (<cmd>):
+  unload          Unload a tape into the slot from where it was loaded
+  load <slot>     Load a tape from the slot <slot> (1-based)
+  transfer <slot> <slotdst> Transfer a tape from the slot <slot> to
+                  the slot <slotdst> (1-based)
+  list            List full storage slots
+  listall         List all storage slots and drives with source information
+  loaded          Give slot from where the tape was loaded (0 = empty drive)
+  slots           Give number of available slots
+
+Example:
+  ${PROGNAME} /dev/ch0 load 1        Load a tape from the slot 1
+
+EOF
+  exit 1
+}
+
+# Default settings
+CHANGER=/dev/ch0
+TAPE=/dev/nsa0
+DRIVE=0
+
+CHIO=/bin/chio
+MT=/usr/bin/mt
+
+if [ -n "${DEBUG}" ]; then
+  MSG=$0
+  for PAR; do MSG="${MSG} \"${PAR}\""; done
+  echo `date +"%Y/%m/%d %H:%M:%S"` ${MSG} >> ${DEBUG}
+fi
+
+if [ -n "$1" ]; then
+  CHANGER=$1;
+fi
+COMMAND=$2
+SLOT=$3
+SLOTDST=$4
+if [ -n "$4" ]; then
+  TAPE=$4
+fi
+if [ -n "$5" ]; then
+  DRIVE=$5
+fi
+
+case ${COMMAND} in
+unload)
+  if [ "${OFFLINE}" = yes ]; then
+    ${MT} -f ${TAPE} offline
+    if [ $? = 0 -a -n "${OFFLINE_SLEEP}" ]; then
+      sleep ${OFFLINE_SLEEP}
+    fi
+  fi
+  if [ -z "${SLOT}" ]; then
+    ${CHIO} -f ${CHANGER} return drive ${DRIVE}
+  else
+    ${CHIO} -f ${CHANGER} move drive ${DRIVE} slot $((${SLOT} - 1))
+  fi
+  if [ $? -ne 0 ]; then
+    # In case of an error, try to unload the cartridge to the first free slot
+    FREE=`${CHIO} -f ${CHANGER} status slot | \
+      sed -ne '/FULL/d;s/^slot *\([0-9]*\):.*/\1/p' | \
+      awk 'BEGIN { n = 0 } { n = $1 + 1; exit } END { print n }'`
+    if [ ${FREE} -gt 0 ]; then
+      ${CHIO} -f ${CHANGER} move drive ${DRIVE} slot $((${FREE} - 1))
+    else
+      exit 1
+    fi
+  fi
+  ;;
+load)
+  if [ -z "${SLOT}" ]; then
+    usage
+  fi
+  ${CHIO} -f ${CHANGER} move slot $((${SLOT} - 1)) drive ${DRIVE}
+  if [ $? -ne 0 ]; then
+    exit 1
+  fi
+  if [ -n "${LOAD_SLEEP}" ]; then
+    sleep ${LOAD_SLEEP}
+  fi
+  ;;
+transfer)
+  if [ -z "${SLOT}" -o -z "${SLOTDST}" ]; then
+    usage
+  fi
+  ${CHIO} -f ${CHANGER} move slot $((${SLOT} - 1)) slot $((${SLOTDST} - 1))
+  if [ $? -ne 0 ]; then
+    exit 1
+  fi
+  if [ -n "${MOVE_SLEEP}" ]; then
+    sleep ${MOVE_SLEEP}
+  fi
+  ;;
+list)
+  if [ -z "${FAKE_BARCODES}" ]; then
+    ${CHIO} -f ${CHANGER} status -v slot | \
+      sed -ne 's/^slot *\([0-9]*\):.*FULL.*voltag.*<\([^:]*\):.*/\1:\2/p' | \
+      awk -F: '{ print $1 + 1 ":" $2 }'
+  else
+    if [ -f "${FAKE_BARCODES}" ]; then
+      grep -v -e "^#" -e "^$" < ${FAKE_BARCODES}
+    else
+      echo "${PROGNAME}: Barcode file ${FAKE_BARCODES} is missing"
+      exit 1
+    fi
+  fi
+  ;;
+listall)
+  if [ -z "${FAKE_BARCODES}" ]; then
+    ${CHIO} -f ${CHANGER} status -vS | \
+      sed -ne '
+      s/^slot *\([0-9]*\):.*ENAB.*FULL.*voltag.*<\([^:]*\):.*/I:\1:F:\2/p;t
+      s/^slot *\([0-9]*\):.*FULL.*voltag.*<\([^:]*\):.*/S:\1:F:\2/p;t
+      s/^drive *\([0-9]*\):.*FULL.*voltag.*<\([^:]*\):.*source.*<[^0-9]*\([0-9]*\)>.*/D:\1:F:\3:\2/p;t
+      s/^slot *\([0-9]*\):.*ENAB.*voltag.*<\([^:]*\):.*/I:\1:E/p;t
+      s/^slot *\([0-9]*\):.*voltag.*<\([^:]*\):.*/S:\1:E/p;t
+      s/^drive *\([0-9]*\):.*voltag.*<\([^:]*\):.*/D:\1:E/p' | \
+      awk -F: '{ for (n = 1; n <= NF; n++) printf "%s%s",
+      (n == ($1 == "D" ? 4 : 2)) ? ($n == "" ? 0 : $n + 1) : $n,
+      (n == NF) ? "\n" : ":" }'
+  else
+    if [ -f "${FAKE_BARCODES}" ]; then
+      grep -v -e "^#" -e "^$" < ${FAKE_BARCODES} | \
+        awk -F: '{ print "S:" $1 (match($2, "^ *$") ? ":E" : ":F:" $2) }'
+    else
+      echo "${PROGNAME}: Barcode file ${FAKE_BARCODES} is missing"
+      exit 1
+    fi
+  fi
+  ;;
+loaded)
+  # If a tape is loaded, but the source slot is unknown (for example,
+  # after library reboot), try to report the first free slot
+  FREE=`${CHIO} -f ${CHANGER} status slot | \
+    sed -ne '/FULL/d;s/^slot *\([0-9]*\):.*/\1/p' | \
+    awk 'BEGIN { n = 0 } { n = $1 + 1; exit } END { print n }'`
+  ${CHIO} -f ${CHANGER} status -S drive | \
+    sed -ne 's/^drive *'${DRIVE}':.*FULL.*source.*<[^0-9]*\([0-9]*\)>.*/\1/p' \
+    | awk 'BEGIN { n = 0 } { n = ($1 == "") ? '${FREE}' : $1 + 1 } \
+    END { print n }'
+  ;;
+slots)
+  ${CHIO} -f ${CHANGER} status | grep -c "^slot "
+  ;;
+*)
+  usage
+  ;;
+esac
diff --git a/sysutils/bareos20-server/files/patch-core-CMakeLists.txt b/sysutils/bareos20-server/files/patch-core-CMakeLists.txt
new file mode 100644
index 000000000000..7adbdb29fefa
--- /dev/null
+++ b/sysutils/bareos20-server/files/patch-core-CMakeLists.txt
@@ -0,0 +1,43 @@
+--- core/CMakeLists.txt	2020-12-16 02:46:16.000000000 -0500
++++ core/CMakeLists.txt	2020-12-26 21:28:44.141734000 -0500
+@@ -256,7 +256,9 @@
+   set(PSCMD "ps -ax -o pid,command")
+   include_directories(/usr/local/include)
+   link_directories(/usr/local/lib)
+-  link_libraries(intl)
++  IF(nls)
++    link_libraries(intl)
++  ENDIF()
+ endif()
+ 
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+@@ -323,8 +325,11 @@
+   add_definitions("-D_FILE_OFFSET_BITS=64")
+ endif()
+ 
+-include(FindIntl)
+ 
++IF(nls)
++  INCLUDE(FindIntl)
++ENDIF()
++
+ if(developer)
+   add_definitions("-DDEVELOPER=1")
+ endif()
+@@ -347,7 +352,7 @@
+ if(NOT client-only)
+   # droplet does not build on solaris because of sys/cdefs.h: No such file or
+   # directory
+-  if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
++  if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS|FreeBSD")
+     if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/droplet/CMakeLists.txt)
+       message(
+         FATAL_ERROR
+@@ -771,7 +776,6 @@
+ 
+ add_subdirectory(scripts)
+ add_subdirectory(manpages)
+-add_subdirectory(platforms)
+ add_subdirectory(src)
+ 
+ include(BareosLocalBuildDefinitions OPTIONAL
diff --git a/sysutils/bareos20-server/files/patch-core-cmake_BareosCheckIncludes.cmake b/sysutils/bareos20-server/files/patch-core-cmake_BareosCheckIncludes.cmake
new file mode 100644
index 000000000000..e439a0254191
--- /dev/null
+++ b/sysutils/bareos20-server/files/patch-core-cmake_BareosCheckIncludes.cmake
@@ -0,0 +1,39 @@
+--- core/cmake/BareosCheckIncludes.cmake	2020-12-16 02:46:16.000000000 -0500
++++ core/cmake/BareosCheckIncludes.cmake	2020-12-23 22:25:00.323963000 -0500
+@@ -60,19 +60,25 @@
+ check_include_files(sys/proplist.h HAVE_SYS_PROPLIST_H)
+ check_include_files(sys/xattr.h HAVE_SYS_XATTR_H)
+ 
+-include(CheckSymbolExists)
+-include(CMakePushCheckState)
+-cmake_push_check_state()
+-set(CMAKE_REQUIRED_LIBRARIES cephfs)
+-check_symbol_exists(ceph_statx "sys/stat.h;cephfs/libcephfs.h" HAVE_CEPH_STATX)
+-cmake_pop_check_state()
++if(cephfs)
++  include(CheckSymbolExists)
++  include(CMakePushCheckState)
++  cmake_push_check_state()
++  set(CMAKE_REQUIRED_LIBRARIES cephfs)
++  check_include_files("sys/stat.h;cephfs/ceph_ll_client.h" HAVE_CEPH_STATX)
++  cmake_pop_check_state()
++endif()
+ 
+-check_include_files(rados/librados.h HAVE_RADOS_LIBRADOS_H)
+-check_include_files(
+-  radosstriper/libradosstriper.h HAVE_RADOSSTRIPER_LIBRADOSSTRIPER_H
+-)
++if(rados)
++  check_include_files(rados/librados.h HAVE_RADOS_LIBRADOS_H)
++  check_include_files(
++    radosstriper/libradosstriper.h HAVE_RADOSSTRIPER_LIBRADOSSTRIPER_H
++  )
++endif()
+ 
+-check_include_files(glusterfs/api/glfs.h HAVE_GLUSTERFS_API_GLFS_H)
++if(gfapi)
++  check_include_files(glusterfs/api/glfs.h HAVE_GLUSTERFS_API_GLFS_H)
++endif()
+ 
+ check_include_files(sys/prctl.h HAVE_SYS_PRCTL_H)
+ 
diff --git a/sysutils/bareos20-server/files/patch-core-cmake_BareosFindAllLibraries.cmake b/sysutils/bareos20-server/files/patch-core-cmake_BareosFindAllLibraries.cmake
new file mode 100644
index 000000000000..2106acc618aa
--- /dev/null
+++ b/sysutils/bareos20-server/files/patch-core-cmake_BareosFindAllLibraries.cmake
@@ -0,0 +1,108 @@
+--- core/cmake/BareosFindAllLibraries.cmake	2021-06-10 10:37:18.000000000 -0500
++++ core/cmake/BareosFindAllLibraries.cmake	2021-07-09 21:07:45.799522000 -0500
+@@ -37,55 +37,39 @@
+   set(Python3_FOUND 0)
+ 
+ else()
+-  find_package(Python2 COMPONENTS Interpreter Development)
+-  find_package(Python3 COMPONENTS Interpreter Development)
++  if(python)
++    find_package(Python3 COMPONENTS Interpreter Development)
+ 
+-  set(Python3_VERSION_MAJOR
+-      ${Python3_VERSION_MAJOR}
+-      PARENT_SCOPE
+-  )
+-
+-  set(Python3_VERSION_MINOR
+-      ${Python3_VERSION_MINOR}
+-      PARENT_SCOPE
+-  )
+-
+-  if(${Python2_FOUND} OR ${Python3_FOUND})
+-    set(HAVE_PYTHON 1)
+-  endif()
+-
+-  if(${Python2_FOUND})
+-    set(PYTHON_EXECUTABLE
+-        ${Python2_EXECUTABLE}
++    set(Python3_VERSION_MAJOR
++        ${Python3_VERSION_MAJOR}
+         PARENT_SCOPE
+     )
+-    set(Python2_EXECUTABLE
+-        ${Python2_EXECUTABLE}
+-        PARENT_SCOPE
+-    )
+-    execute_process(
+-      COMMAND ${Python2_EXECUTABLE}
+-              ${CMAKE_CURRENT_SOURCE_DIR}/cmake/get_python_compile_settings.py
+-      OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/py2settings.cmake
+-    )
+-    include(${CMAKE_CURRENT_BINARY_DIR}/py2settings.cmake)
+-  endif()
+ 
+-  if(${Python3_FOUND})
+-    set(PYTHON_EXECUTABLE
+-        ${Python3_EXECUTABLE}
++    set(Python3_VERSION_MINOR
++        ${Python3_VERSION_MINOR}
+         PARENT_SCOPE
+     )
+-    set(Python3_EXECUTABLE
+-        ${Python3_EXECUTABLE}
+-        PARENT_SCOPE
+-    )
+-    execute_process(
+-      COMMAND ${Python3_EXECUTABLE}
+-              ${CMAKE_CURRENT_SOURCE_DIR}/cmake/get_python_compile_settings.py
+-      OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/py3settings.cmake
+-    )
+-    include(${CMAKE_CURRENT_BINARY_DIR}/py3settings.cmake)
++
++    if(${Python3_FOUND})
++      set(HAVE_PYTHON 1)
++    endif()
++
++    if(${Python3_FOUND})
++      set(PYTHON_EXECUTABLE
++          ${Python3_EXECUTABLE}
++          PARENT_SCOPE
++      )
++      set(Python3_EXECUTABLE
++          ${Python3_EXECUTABLE}
++          PARENT_SCOPE
++      )
++      execute_process(
++        COMMAND ${Python3_EXECUTABLE}
++                ${CMAKE_CURRENT_SOURCE_DIR}/cmake/get_python_compile_settings.py
++        OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/py3settings.cmake
++      )
++      include(${CMAKE_CURRENT_BINARY_DIR}/py3settings.cmake)
++    endif()
+   endif()
+ endif()
+ 
+@@ -164,12 +148,18 @@
+ endif()
+ 
+ bareosfindlibraryandheaders("jansson" "jansson.h" "")
+-bareosfindlibraryandheaders("rados" "rados/librados.h" "")
+-bareosfindlibraryandheaders("radosstriper" "radosstriper/libradosstriper.h" "")
+-bareosfindlibraryandheaders("cephfs" "cephfs/libcephfs.h" "")
++if(rados)
++  bareosfindlibraryandheaders("rados" "rados/librados.h" "")
++  bareosfindlibraryandheaders("radosstriper" "radosstriper/libradosstriper.h" "")
++endif()
*** 3085 LINES SKIPPED ***