summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-backup/bareos/files')
-rw-r--r--app-backup/bareos/files/bareos-21-cmake-gentoo.patch12
-rw-r--r--app-backup/bareos/files/bareos-21.1.2-no-automagic-ccache.patch25
-rw-r--r--app-backup/bareos/files/bareos-21.1.2-werror.patch23
-rw-r--r--app-backup/bareos/files/bareos-22.0.2-werror.patch23
-rw-r--r--app-backup/bareos/files/bareos-22.1.2-include-algorithm.patch41
-rw-r--r--app-backup/bareos/files/bareos-cmake-gentoo.patch11
-rw-r--r--app-backup/bareos/files/bareos-cmake-rados.patch21
-rw-r--r--app-backup/bareos/files/bareos-cmake-symlink-default-db-backend.patch9
-rw-r--r--app-backup/bareos/files/bareos-dir-21-r1.initd16
-rw-r--r--app-backup/bareos/files/bareos-dir-21.confd (renamed from app-backup/bareos/files/bareos-dir.confd)9
-rw-r--r--app-backup/bareos/files/bareos-dir-21.service32
-rw-r--r--app-backup/bareos/files/bareos-dir.confd-1617
-rw-r--r--app-backup/bareos/files/bareos-dir.initd21
-rw-r--r--app-backup/bareos/files/bareos-dir.service13
-rw-r--r--app-backup/bareos/files/bareos-fd-21-r1.initd12
-rw-r--r--app-backup/bareos/files/bareos-fd-21.confd (renamed from app-backup/bareos/files/bareos-fd.confd)2
-rw-r--r--app-backup/bareos/files/bareos-fd.confd-167
-rw-r--r--app-backup/bareos/files/bareos-fd.initd21
-rw-r--r--app-backup/bareos/files/bareos-fd.service32
-rw-r--r--app-backup/bareos/files/bareos-sd-21-r1.initd16
-rw-r--r--app-backup/bareos/files/bareos-sd-21.confd (renamed from app-backup/bareos/files/bareos-sd.confd)2
-rw-r--r--app-backup/bareos/files/bareos-sd.confd-1610
-rw-r--r--app-backup/bareos/files/bareos-sd.initd21
-rw-r--r--app-backup/bareos/files/bareos-sd.service37
-rw-r--r--app-backup/bareos/files/tmpfiles.d-bareos.conf2
25 files changed, 255 insertions, 180 deletions
diff --git a/app-backup/bareos/files/bareos-21-cmake-gentoo.patch b/app-backup/bareos/files/bareos-21-cmake-gentoo.patch
new file mode 100644
index 000000000000..e42bf91a91fd
--- /dev/null
+++ b/app-backup/bareos/files/bareos-21-cmake-gentoo.patch
@@ -0,0 +1,12 @@
+diff -ur bareos-Release-21.0.0.orig/core/platforms/CMakeLists.txt bareos-Release-21.0.0/core/platforms/CMakeLists.txt
+--- bareos-Release-21.0.0.orig/core/platforms/CMakeLists.txt 2021-12-21 01:00:49.000000000 -1000
++++ bareos-Release-21.0.0/core/platforms/CMakeLists.txt 2022-01-30 15:09:41.949529813 -1000
+@@ -30,6 +30,8 @@
+ message(STATUS "adding subdirectories debian and univention")
+ add_subdirectory(debian)
+ add_subdirectory(univention)
++ elseif(${PLATFORM} STREQUAL gentoo)
++ message(STATUS "PLATFORM: " ${PLATFORM})
+ elseif(${BAREOS_PLATFORM} STREQUAL hpux)
+ message(STATUS "BAREOS_PLATFORM: " ${BAREOS_PLATFORM})
+ elseif(${BAREOS_PLATFORM} STREQUAL archlinux)
diff --git a/app-backup/bareos/files/bareos-21.1.2-no-automagic-ccache.patch b/app-backup/bareos/files/bareos-21.1.2-no-automagic-ccache.patch
new file mode 100644
index 000000000000..22cdc2a41c36
--- /dev/null
+++ b/app-backup/bareos/files/bareos-21.1.2-no-automagic-ccache.patch
@@ -0,0 +1,25 @@
+--- a/core/CMakeLists.txt
++++ b/core/CMakeLists.txt
+@@ -44,12 +44,6 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME common)
+
+ include(GNUInstallDirs)
+
+-find_program(CCACHE_FOUND ccache)
+-if(CCACHE_FOUND)
+- set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
+- set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
+-endif(CCACHE_FOUND)
+-
+ # switch on CXX 17 Support
+ #
+ set(CMAKE_CXX_STANDARD 17)
+@@ -584,9 +578,6 @@ message(STATUS "CMAKE_SUPPRESS_REGENERATION: " ${CMAKE_SUPPRESS_REGENERATION})
+ # A simple way to get switches to the compiler is to use ADD_DEFINITIONS(). But
+ # there are also two variables exactly for this purpose:
+
+-# wheter or not
+-message(STATUS "CCACHE_FOUND: " ${CCACHE_FOUND})
+-
+ # Choose the type of build. Example: SET(CMAKE_BUILD_TYPE Debug)
+ message(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE})
+
diff --git a/app-backup/bareos/files/bareos-21.1.2-werror.patch b/app-backup/bareos/files/bareos-21.1.2-werror.patch
new file mode 100644
index 000000000000..10de9f1415b6
--- /dev/null
+++ b/app-backup/bareos/files/bareos-21.1.2-werror.patch
@@ -0,0 +1,23 @@
+https://bugs.gentoo.org/841734
+--- a/core/CMakeLists.txt
++++ b/core/CMakeLists.txt
+@@ -96,7 +96,7 @@ if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+ -Werror=format-security compiler_error_format_security
+ )
+ if(${compiler_error_format_security})
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=format-security")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat-security")
+ endif()
+ endif()
+
+@@ -353,8 +353,8 @@ if(developer)
+ add_definitions("-DDEVELOPER=1")
+ endif()
+
+-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall")
+-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall")
++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+
+ include(BareosSetVariableDefaults)
+ option(ENABLE_BCONSOLE "Build bconsole binary" ON)
diff --git a/app-backup/bareos/files/bareos-22.0.2-werror.patch b/app-backup/bareos/files/bareos-22.0.2-werror.patch
new file mode 100644
index 000000000000..43f2aa5ad7d9
--- /dev/null
+++ b/app-backup/bareos/files/bareos-22.0.2-werror.patch
@@ -0,0 +1,23 @@
+diff -urN bareos-Release-22.0.2.orig/core/CMakeLists.txt bareos-Release-22.0.2/core/CMakeLists.txt
+--- bareos-Release-22.0.2.orig/core/CMakeLists.txt 2023-02-07 15:30:01.000000000 +0530
++++ bareos-Release-22.0.2/core/CMakeLists.txt 2023-03-01 23:06:39.577048453 +0530
+@@ -104,7 +104,7 @@
+ -Werror=format-security compiler_error_format_security
+ )
+ if(${compiler_error_format_security})
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=format-security")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat-security")
+ endif()
+ endif()
+
+@@ -394,8 +394,8 @@
+ add_definitions("-DDEVELOPER=1")
+ endif()
+
+-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wall -Wextra")
+-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra")
++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
+
+ include(BareosSetVariableDefaults)
+ option(ENABLE_BCONSOLE "Build bconsole binary" ON)
diff --git a/app-backup/bareos/files/bareos-22.1.2-include-algorithm.patch b/app-backup/bareos/files/bareos-22.1.2-include-algorithm.patch
new file mode 100644
index 000000000000..5f71576bc001
--- /dev/null
+++ b/app-backup/bareos/files/bareos-22.1.2-include-algorithm.patch
@@ -0,0 +1,41 @@
+From https://github.com/bareos/bareos/pull/1687/commits/3907be7ff9700d0328198b47c58885f5ec56546c
+https://bugs.gentoo.org/920489
+
+diff --git a/core/src/cats/sql_get.cc b/core/src/cats/sql_get.cc
+index b5d921c..150ebfc 100644
+--- a/core/src/cats/sql_get.cc
++++ b/core/src/cats/sql_get.cc
+@@ -31,6 +31,7 @@
+ */
+
+ #include "include/bareos.h"
++#include <algorithm>
+
+ #if HAVE_SQLITE3 || HAVE_MYSQL || HAVE_POSTGRESQL || HAVE_INGRES || HAVE_DBI
+
+diff --git a/core/src/stored/append.cc b/core/src/stored/append.cc
+index 05f6784..32234d4 100644
+--- a/core/src/stored/append.cc
++++ b/core/src/stored/append.cc
+@@ -41,6 +41,8 @@
+ #include "lib/berrno.h"
+ #include "lib/berrno.h"
+
++#include <algorithm>
++
+ namespace storagedaemon {
+
+ /* Responses sent to the daemon */
+diff --git a/core/src/dird/ua_prune.cc b/core/src/dird/ua_prune.cc
+index 9a0770c..15a0a56 100644
+--- a/core/src/dird/ua_prune.cc
++++ b/core/src/dird/ua_prune.cc
+@@ -40,6 +40,8 @@
+ #include "lib/edit.h"
+ #include "lib/parse_conf.h"
+
++#include <algorithm>
++
+ namespace directordaemon {
+
+ /* Forward referenced functions */
diff --git a/app-backup/bareos/files/bareos-cmake-gentoo.patch b/app-backup/bareos/files/bareos-cmake-gentoo.patch
deleted file mode 100644
index 0f67a9e5d9de..000000000000
--- a/app-backup/bareos/files/bareos-cmake-gentoo.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- core/cmake/distname.sh.orig 2019-01-31 12:39:26.000000000 +0100
-+++ core/cmake/distname.sh 2019-02-05 10:26:43.258936535 +0100
-@@ -134,7 +134,7 @@
- elif test -f /etc/gentoo-release
- then
- DISTNAME=gentoo
-- DISTVER=`awk '/version / { print $5 }' < /etc/gentoo-release`
-+ DISTVER=`awk '/release / { print $5 }' < /etc/gentoo-release`
- elif test -f /etc/debian_version
- then
- if `test -f /etc/apt/sources.list && grep -q ubuntu /etc/apt/sources.list`; then
diff --git a/app-backup/bareos/files/bareos-cmake-rados.patch b/app-backup/bareos/files/bareos-cmake-rados.patch
deleted file mode 100644
index c9a0c176692e..000000000000
--- a/app-backup/bareos/files/bareos-cmake-rados.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- core/cmake/BareosCheckSymbols.cmake.orig 2018-12-05 23:39:37.307627387 +0100
-+++ core/cmake/BareosCheckSymbols.cmake 2018-12-05 23:40:00.999464771 +0100
-@@ -21,7 +21,7 @@
-
-
- CHECK_SYMBOL_EXISTS(__stub_lchmod features.h LCHMOD_IS_A_STUB1)
--CHECK_SYMBOL_EXISTS(__stub___lchmod features_h LCHMOD_IS_A_STUB2)
-+#CHECK_SYMBOL_EXISTS(__stub___lchmod features_h LCHMOD_IS_A_STUB2)
-
-
-
-@@ -43,7 +43,9 @@
-
- cmake_push_check_state()
- SET(CMAKE_REQUIRED_LIBRARIES ${RADOS_LIBRARIES})
-+if ("${HAVE_RADOS}")
- CHECK_SYMBOL_EXISTS(rados_ioctx_set_namespace rados/librados.h HAVE_RADOS_NAMESPACES)
- CHECK_SYMBOL_EXISTS(rados_nobjects_list_open rados/librados.h HAVE_RADOS_NOBJECTS_LIST)
-+endif()
- cmake_pop_check_state()
-
diff --git a/app-backup/bareos/files/bareos-cmake-symlink-default-db-backend.patch b/app-backup/bareos/files/bareos-cmake-symlink-default-db-backend.patch
deleted file mode 100644
index 8c46fdf0dc86..000000000000
--- a/app-backup/bareos/files/bareos-cmake-symlink-default-db-backend.patch
+++ /dev/null
@@ -1,9 +0,0 @@
---- work/bareos-Release-18.2.5/core/cmake/bareos-symlink-default-db-backend.cmake.orig 2019-01-31 12:39:26.000000000 +0100
-+++ work/bareos-Release-18.2.5/core/cmake/bareos-symlink-default-db-backend.cmake 2019-02-05 11:00:24.559983661 +0100
-@@ -19,5 +19,5 @@
- MESSAGE(STATUS "${CMAKE_COMMAND} -E create_symlink ${libdir}/libbareoscats${CMAKE_SHARED_LIBRARY_SUFFIX} ${backenddir}/libbareoscats-${default_db_backend}${CMAKE_SHARED_LIBRARY_SUFFIX}")
- execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
- ${backenddir}/libbareoscats-${default_db_backend}${CMAKE_SHARED_LIBRARY_SUFFIX}
-- ${libdir}/libbareoscats${CMAKE_SHARED_LIBRARY_SUFFIX}.${BAREOS_NUMERIC_VERSION}
-+ $ENV{DESTDIR}/${libdir}/libbareoscats${CMAKE_SHARED_LIBRARY_SUFFIX}.${BAREOS_NUMERIC_VERSION}
- )
diff --git a/app-backup/bareos/files/bareos-dir-21-r1.initd b/app-backup/bareos/files/bareos-dir-21-r1.initd
new file mode 100644
index 000000000000..1363833e8962
--- /dev/null
+++ b/app-backup/bareos/files/bareos-dir-21-r1.initd
@@ -0,0 +1,16 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ use dns
+}
+
+start_pre() {
+ checkpath --directory --owner root:root --mode 00755 /run/bareos
+}
+
+command="/usr/sbin/bareos-dir"
+command_args="-f ${DIR_OPTIONS}"
+command_background="true"
+pidfile="/run/bareos/bareos-dir.9101.pid"
diff --git a/app-backup/bareos/files/bareos-dir.confd b/app-backup/bareos/files/bareos-dir-21.confd
index 6d755bf93344..4e2ee55d8924 100644
--- a/app-backup/bareos/files/bareos-dir.confd
+++ b/app-backup/bareos/files/bareos-dir-21.confd
@@ -1,15 +1,8 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Config file for /etc/init.d/bareos-dir
-# Bareos can use more than one catalog database and each one can
-# be of any supported type.
-# If a database server where you store a bareos catalog
-# is on a different machine, you might want to remove the corresponding
-# type from the rc_need variable.
-rc_need="%databasetypes%"
-
# Options for the director daemon.
# The director can be run as a non-root user, however
# please ensure that this user has proper permissions to
diff --git a/app-backup/bareos/files/bareos-dir-21.service b/app-backup/bareos/files/bareos-dir-21.service
new file mode 100644
index 000000000000..2f156cf8aecc
--- /dev/null
+++ b/app-backup/bareos/files/bareos-dir-21.service
@@ -0,0 +1,32 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# Bareos Director Daemon
+#
+[Unit]
+Description=Bareos Director Daemon
+Documentation=man:bareos-dir(8)
+Requires=nss-lookup.target network.target remote-fs.target time-sync.target
+After=nss-lookup.target network.target remote-fs.target time-sync.target postgresql.service
+ConditionPathIsDirectory=/var/lib/bareos
+
+[Service]
+# see bug #631598
+#Type=forking
+Type=simple
+User=bareos
+Group=bareos
+WorkingDirectory=/var/lib/bareos
+#PIDFile=/run/bareos/bareos-dir.9101.pid
+StandardError=journal
+ExecStartPre=/usr/sbin/bareos-dir -t -f
+#ExecStart=/usr/sbin/bareos-dir
+ExecStart=/usr/sbin/bareos-dir -f
+SuccessExitStatus=0 1 15
+ExecReload=/usr/sbin/bareos-dir -t -f
+ExecReload=/bin/kill -HUP $MAINPID
+#Restart=on-failure
+
+[Install]
+Alias=bareos-director.service
+WantedBy=multi-user.target
diff --git a/app-backup/bareos/files/bareos-dir.confd-16 b/app-backup/bareos/files/bareos-dir.confd-16
deleted file mode 100644
index a11eba90a755..000000000000
--- a/app-backup/bareos/files/bareos-dir.confd-16
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# Config file for /etc/init.d/bareos-dir
-
-# Bareos can use more than one catalog database and each one can
-# be of any supported type.
-# If a database server where you store a bareos catalog
-# is on a different machine, you might want to remove the corresponding
-# type from the rc_need variable.
-rc_need="%databasetypes%"
-
-# Options for the director daemon.
-# The director can be run as a non-root user, however
-# please ensure that this user has proper permissions to
-# access your backup devices.
-DIR_OPTIONS="-u root -g bareos"
diff --git a/app-backup/bareos/files/bareos-dir.initd b/app-backup/bareos/files/bareos-dir.initd
deleted file mode 100644
index 826d27a829c9..000000000000
--- a/app-backup/bareos/files/bareos-dir.initd
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-depend() {
- use dns bareos-fd bareos-sd
-}
-
-start() {
- ebegin "Starting bareos director"
- checkpath -d -m 0750 -o bareos:bareos /run/bareos
- start-stop-daemon --start --quiet --exec /usr/sbin/bareos-dir \
- -- ${DIR_OPTIONS}
- eend $?
-}
-
-stop() {
- ebegin "Stopping bareos director"
- start-stop-daemon --stop --quiet --pidfile /run/bareos/bareos-dir.*.pid
- eend $?
-}
diff --git a/app-backup/bareos/files/bareos-dir.service b/app-backup/bareos/files/bareos-dir.service
deleted file mode 100644
index 440d3c3be98d..000000000000
--- a/app-backup/bareos/files/bareos-dir.service
+++ /dev/null
@@ -1,13 +0,0 @@
-[Unit]
- Description=Bareos Director
- After=syslog.target network.target
- Requires=bareos-sd.service bareos-fd.service
-
-[Install]
- WantedBy=multi-user.target
-
-[Service]
- Type=forking
- User=root
- ExecStartPre=-/bin/mkdir /run/bareos
- ExecStart=/usr/sbin/bareos-dir
diff --git a/app-backup/bareos/files/bareos-fd-21-r1.initd b/app-backup/bareos/files/bareos-fd-21-r1.initd
new file mode 100644
index 000000000000..2b752085c764
--- /dev/null
+++ b/app-backup/bareos/files/bareos-fd-21-r1.initd
@@ -0,0 +1,12 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ use dns
+}
+
+command="/usr/sbin/bareos-fd"
+command_args="-f ${DIR_OPTIONS}"
+command_background="true"
+pidfile="/run/bareos/bareos-fd.9102.pid"
diff --git a/app-backup/bareos/files/bareos-fd.confd b/app-backup/bareos/files/bareos-fd-21.confd
index 5e429a6bd31c..407f2a8828eb 100644
--- a/app-backup/bareos/files/bareos-fd.confd
+++ b/app-backup/bareos/files/bareos-fd-21.confd
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Config file for /etc/init.d/bareos-fd
diff --git a/app-backup/bareos/files/bareos-fd.confd-16 b/app-backup/bareos/files/bareos-fd.confd-16
deleted file mode 100644
index e3b8a1f576fd..000000000000
--- a/app-backup/bareos/files/bareos-fd.confd-16
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# Config file for /etc/init.d/bareos-fd
-
-# Options for the file daemon.
-FD_OPTIONS="-u root -g bareos"
diff --git a/app-backup/bareos/files/bareos-fd.initd b/app-backup/bareos/files/bareos-fd.initd
deleted file mode 100644
index e272daa88ecd..000000000000
--- a/app-backup/bareos/files/bareos-fd.initd
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-depend() {
- use dns
-}
-
-start() {
- ebegin "Starting bareos file daemon"
- checkpath -d -m 0750 /run/bareos
- start-stop-daemon --start --quiet --exec /usr/sbin/bareos-fd \
- -- ${FD_OPTIONS}
- eend $?
-}
-
-stop() {
- ebegin "Stopping bareos file daemon"
- start-stop-daemon --stop --quiet --pidfile /run/bareos/bareos-fd.*.pid
- eend $?
-}
diff --git a/app-backup/bareos/files/bareos-fd.service b/app-backup/bareos/files/bareos-fd.service
index 103286094250..e9b4b832afb1 100644
--- a/app-backup/bareos/files/bareos-fd.service
+++ b/app-backup/bareos/files/bareos-fd.service
@@ -1,12 +1,26 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# Bareos File Daemon
+#
[Unit]
- Description=Bareos File Daemon
- After=syslog.target network.target
-
-[Install]
- WantedBy=multi-user.target
+Description=Bareos File Daemon
+Documentation=man:bareos-fd(8)
+Requires=nss-lookup.target network.target remote-fs.target time-sync.target
+After=nss-lookup.target network.target remote-fs.target time-sync.target
[Service]
- Type=forking
- User=root
- ExecStartPre=-/bin/mkdir /run/bareos
- ExecStart=/usr/sbin/bareos-fd
+Type=forking
+User=root
+Group=bareos
+WorkingDirectory=/var/lib/bareos
+PIDFile=/run/bareos/bareos-fd.9102.pid
+StandardError=journal
+ExecStartPre=/usr/sbin/bareos-fd -f -t
+ExecStart=/usr/sbin/bareos-fd
+SuccessExitStatus=0 15
+#Restart=on-failure
+
+[Install]
+Alias=bareos-filedaemon.service
+WantedBy=multi-user.target
diff --git a/app-backup/bareos/files/bareos-sd-21-r1.initd b/app-backup/bareos/files/bareos-sd-21-r1.initd
new file mode 100644
index 000000000000..d6a5765a74a4
--- /dev/null
+++ b/app-backup/bareos/files/bareos-sd-21-r1.initd
@@ -0,0 +1,16 @@
+#!/sbin/openrc-run
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ use dns
+}
+
+start_pre() {
+ checkpath --directory --owner root:root --mode 00755 /run/bareos
+}
+
+command="/usr/sbin/bareos-sd"
+command_args="-f ${DIR_OPTIONS}"
+command_background="true"
+pidfile="/run/bareos/bareos-sd.9103.pid"
diff --git a/app-backup/bareos/files/bareos-sd.confd b/app-backup/bareos/files/bareos-sd-21.confd
index d0153b2b30b5..2a67ae2b5523 100644
--- a/app-backup/bareos/files/bareos-sd.confd
+++ b/app-backup/bareos/files/bareos-sd-21.confd
@@ -1,4 +1,4 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Config file for /etc/init.d/bareos-sd
diff --git a/app-backup/bareos/files/bareos-sd.confd-16 b/app-backup/bareos/files/bareos-sd.confd-16
deleted file mode 100644
index 5d377b978dd5..000000000000
--- a/app-backup/bareos/files/bareos-sd.confd-16
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# Config file for /etc/init.d/bareos-sd
-
-# Options for the storage daemon.
-# The storage daemon can be run as a non-root user, however
-# please ensure that this user has proper permissions to
-# access your backup devices.
-SD_OPTIONS="-u root -g bareos"
diff --git a/app-backup/bareos/files/bareos-sd.initd b/app-backup/bareos/files/bareos-sd.initd
deleted file mode 100644
index f20be4ecf56e..000000000000
--- a/app-backup/bareos/files/bareos-sd.initd
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/sbin/openrc-run
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-depend() {
- use dns
-}
-
-start() {
- ebegin "Starting bareos storage daemon"
- checkpath -d -m 0750 -o bareos:bareos /run/bareos
- start-stop-daemon --start --quiet --exec /usr/sbin/bareos-sd \
- -- ${SD_OPTIONS}
- eend $?
-}
-
-stop() {
- ebegin "Stopping bareos storage daemon"
- start-stop-daemon --stop --quiet --pidfile /run/bareos/bareos-sd.*.pid
- eend $?
-}
diff --git a/app-backup/bareos/files/bareos-sd.service b/app-backup/bareos/files/bareos-sd.service
index 6c617ec6a37f..acf8cb0156e1 100644
--- a/app-backup/bareos/files/bareos-sd.service
+++ b/app-backup/bareos/files/bareos-sd.service
@@ -1,12 +1,31 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+#
+# Bareos Storage Daemon
+#
[Unit]
- Description=Bareos Storage Daemon
- After=syslog.target network-online.target
-
-[Install]
- WantedBy=multi-user.target
+Description=Bareos Storage Daemon
+Documentation=man:bareos-sd(8)
+Requires=nss-lookup.target network.target remote-fs.target time-sync.target
+After=nss-lookup.target network.target remote-fs.target time-sync.target
[Service]
- Type=forking
- User=root
- ExecStartPre=-/bin/mkdir /run/bareos
- ExecStart=/usr/sbin/bareos-sd
+# see bug #631598
+#Type=forking
+Type=simple
+User=root
+Group=bareos
+WorkingDirectory=/var/lib/bareos
+#PIDFile=/run/bareos/bareos-sd.9103.pid
+StandardError=journal
+ExecStartPre=/usr/sbin/bareos-sd -t -f
+#ExecStart=/usr/sbin/bareos-sd
+ExecStart=/usr/sbin/bareos-sd -f
+# enable this for scsicrypto-sd
+# CapabilityBoundingSet=cap_sys_rawio+ep
+SuccessExitStatus=0 15
+#Restart=on-failure
+
+[Install]
+Alias=bareos-storage.service
+WantedBy=multi-user.target
diff --git a/app-backup/bareos/files/tmpfiles.d-bareos.conf b/app-backup/bareos/files/tmpfiles.d-bareos.conf
index 6e2dacc41ad3..81c57569c455 100644
--- a/app-backup/bareos/files/tmpfiles.d-bareos.conf
+++ b/app-backup/bareos/files/tmpfiles.d-bareos.conf
@@ -1 +1 @@
-d /run/bareos 0770 bareos bareos -
+d /run/bareos 0750 root bareos -