diff options
Diffstat (limited to 'app-backup/bareos')
24 files changed, 1314 insertions, 460 deletions
diff --git a/app-backup/bareos/Manifest b/app-backup/bareos/Manifest index e99c04adabdc..8206ffaf50c5 100644 --- a/app-backup/bareos/Manifest +++ b/app-backup/bareos/Manifest @@ -1,3 +1,4 @@ -DIST bareos-19.2.12.tar.gz 12931615 BLAKE2B 258d826e8b0e7d9d7f5ebc0d5b701ea0c34e82674f14080ec0c758eb888cf845430dab870dbae85190957d570b8b9c551db00b08a002740a7c062f7741cf7338 SHA512 6a5d85bf1131cb4a97879410ad8d4d3069715d8fb070e45137bb80666c9907c6db0c65ff5aa3b50ae2f44f0a2f402bf79c6b3817e3d5fa25d1e7088b495aed74 -DIST bareos-20.0.6.tar.gz 13373519 BLAKE2B 5f75078cc9b82384e06ad2e4545ab26c045208829cb8cd001e6425961486d709b75979f2484e5a648e104f60973552916a49c271ce4024e5e152da13a9a9e72f SHA512 ec83fba412f22725ed440168e62d2876e18c6ddb2ca1837c6169fb0b690118a3380d4f6cf7f9d8e1a8b9601b320ce552a7b7cf74066afb906a09fc1c26208729 -DIST bareos-21.1.2.tar.gz 11582588 BLAKE2B e7e02b3897d7e377cc79d9d0880da821f1b81d1f54891d89e704e78f51471cdf94b5a02ffe2f4ed54dec38bf37ccc757bf1641c3b678a04e401f48484ed3c941 SHA512 acdc787ff828add93c81b2b7d293dec90f2aa22aa3aee3002662bd30e88dc0dc58b753bb63ca7c111fac6c7eeea888938236c1169f92ed6cec27941036c7b6b1 +DIST bareos-21.1.8.tar.gz 11663322 BLAKE2B 5f8c66d44c702b187f56434925417f3eff5f9f515f52d5707d5dce2edfcf566474bae52518adab1d6f87d479fd05cc906f48350eec4f21b858720a607f9b4311 SHA512 643561d4bd92989e0b9356dab500083073daa2717159b5b061f5680ab96e8532c13753e94480419239bcad9938818c203d43dc72b690404ae5a143fdd3cd0738 +DIST bareos-22.1.2.tar.gz 14746158 BLAKE2B 5d8c9c098f61bd35b11f907a3e215a7c08b504c3e529c67a4c8c5cbbf24775158966800e63efca260b4cc513417332cdf43a158d21684f09be3d89dd93258880 SHA512 76d53425b2a28f4f7887b323a70bf9b37df44302e0e25aff7156c1b3ee26ffa60bbfb45ed29a0f2fe763d5c38b8f7135ac2a3e405d8e2b10717f4893baf9c327 +DIST bareos-23.0.1.tar.gz 14728566 BLAKE2B e5fe93f0e412fcc4b4cb31f3e7d7dbcd44b3c0f76c387f17685d97880af88949998faae502531e937201c1622350d226c2cc9f432b0dfda7893a3fb03e905b5f SHA512 5e3902c33c08dedbdd8dc7c74c5a1258da22288a728ada283b541316a7bff2f7773d1875b11f8fe12368afda3fd1bb2780242ff57441ef8fd596f71ea1af1e75 +DIST bareos-23.0.2.tar.gz 14724410 BLAKE2B 0fe86c10d62ad322dfbcd5ac972aec27d6f0ad31e156d359398739b2bfd784a02ce89b26b6bdfcf279265114a4e6e13efe21edab8b87cff15f1f9f3ad055c64b SHA512 a8d8270c8060480fe87da9252de86a75eea1cc427db63536f848d19a2c23c499ca294a9656d9a6aac73a756f84c96a2d72f13d1cede7948e18bf93efc2ecfc29 diff --git a/app-backup/bareos/bareos-21.1.2.ebuild b/app-backup/bareos/bareos-21.1.8-r1.ebuild index 0b224ba4eae8..c1553eece5eb 100644 --- a/app-backup/bareos/bareos-21.1.2.ebuild +++ b/app-backup/bareos/bareos-21.1.8-r1.ebuild @@ -1,9 +1,9 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8..10} ) +PYTHON_COMPAT=( python3_{9..12} ) CMAKE_WARN_UNUSED_CLI=no #CMAKE_REMOVE_MODULES=yes @@ -24,7 +24,7 @@ LICENSE="AGPL-3" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="X acl ceph clientonly +director glusterfs ipv6 lmdb - logwatch ndmp readline scsi-crypto + logwatch ndmp readline scsi-crypto split-usr static +storage-daemon systemd tcpd test vim-syntax vmware xattr" # get cmake variables from core/cmake/BareosSetVariableDefaults.cmake @@ -39,7 +39,7 @@ DEPEND=" dev-libs/gmp:0 !clientonly? ( acct-user/${PN} - dev-db/postgresql:*[threads] + dev-db/postgresql:*[threads(+)] director? ( virtual/mta ) @@ -79,7 +79,7 @@ BDEPEND=" ${PYTHON_DEPS} test? ( dev-cpp/gtest - dev-db/postgresql:*[server,threads] + dev-db/postgresql:*[server,threads(+)] dev-db/mariadb:*[server] ) " @@ -145,6 +145,7 @@ src_prepare() { eapply -p1 "${FILESDIR}/${PN}-21-cmake-gentoo.patch" eapply "${FILESDIR}/${PN}-21.1.2-werror.patch" eapply "${FILESDIR}/${PN}-21.1.2-no-automagic-ccache.patch" + eapply "${FILESDIR}/${PN}-21.1.8-gcc14-fixes.patch" # fix missing DESTDIR in symlink creation sed -i '/bareos-symlink-default-db-backend.cmake/d' "${S}/core/src/cats/CMakeLists.txt" @@ -234,6 +235,15 @@ src_install() { rm -f "${D}"/etc/bareos/bareos-regress.conf rm -f "${D}"/etc/logrotate.d/bareos-dir + # remove duplicate binaries being installed in /usr/sbin and replace + # them by symlinks to not break systems that still use split-usr + if use split-usr; then + for f in bwild bregex bsmtp bconsole; do + rm -f "${D}/usr/sbin/$f" || die + ln -s "../bin/$f" "${D}/usr/sbin/$f" || die + done + fi + # get rid of py2 stuff rm -rf "$D"/usr/lib64/python2.7 || die rm -f "$D"/usr/lib64/bareos/plugin/python-fd.so || die @@ -342,14 +352,14 @@ src_install() { fi for script in ${myscripts}; do # install init script and config - newinitd "${FILESDIR}/${script}-21".initd "${script}" + newinitd "${FILESDIR}/${script}-21-r1".initd "${script}" newconfd "${FILESDIR}/${script}-21".confd "${script}" done # install systemd unit files if use systemd; then if ! use clientonly; then - use director && systemd_dounit "${FILESDIR}"/bareos-dir.service + use director && systemd_newunit "${FILESDIR}"/bareos-dir-21.service bareos-dir.service use storage-daemon && systemd_dounit "${FILESDIR}"/bareos-sd.service fi systemd_dounit "${FILESDIR}"/bareos-fd.service @@ -360,7 +370,10 @@ src_install() { keepdir /var/lib/bareos keepdir /var/lib/bareos/storage - diropts -m0755 + # set log directory ownership + if ! use clientonly; then + diropts -m0755 -o bareos -g bareos + fi keepdir /var/log/bareos newtmpfiles "${FILESDIR}"/tmpfiles.d-bareos.conf bareos.conf @@ -382,9 +395,20 @@ pkg_postinst() { einfo einfo "If this is a new install, you must create the database:" einfo - einfo " su postgres -c '/usr/libexec/bareos/create_bareos_database postgresql'" - einfo " su postgres -c '/usr/libexec/bareos/make_bareos_tables postgresql'" - einfo " su postgres -c '/usr/libexec/bareos/grant_bareos_privileges postgresql'" + einfo " su postgres -c '/usr/libexec/bareos/create_bareos_database'" + einfo " su postgres -c '/usr/libexec/bareos/make_bareos_tables'" + einfo " su postgres -c '/usr/libexec/bareos/grant_bareos_privileges'" einfo + einfo "or run" + einfo + einfo " emerge --config app-backup/bareos" + einfo + einfo "to do this" fi } + +pkg_config() { + su postgres -c '/usr/libexec/bareos/create_bareos_database' || die "could not create bareos database" + su postgres -c '/usr/libexec/bareos/make_bareos_tables' || die "could not create bareos database tables" + su postgres -c '/usr/libexec/bareos/grant_bareos_privileges' || die "could not grant bareos database privileges" +} diff --git a/app-backup/bareos/bareos-20.0.6.ebuild b/app-backup/bareos/bareos-22.1.2-r1.ebuild index a678aef69a5f..d61de65c0fc7 100644 --- a/app-backup/bareos/bareos-20.0.6.ebuild +++ b/app-backup/bareos/bareos-22.1.2-r1.ebuild @@ -1,25 +1,38 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8..10} ) +PYTHON_COMPAT=( python3_{9..12} ) CMAKE_WARN_UNUSED_CLI=no -#CMAKE_REMOVE_MODULES=yes inherit python-any-r1 systemd cmake tmpfiles +if [[ ${PV} == *9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/${PN}/${PN}.git" +else + SRC_URI="https://github.com/${PN}/${PN}/archive/Release/${PV}.tar.gz -> ${P}.tar.gz" + + KEYWORDS="~amd64 ~x86" + S=${WORKDIR}/${PN}-Release-${PV} +fi + DESCRIPTION="Featureful client/server network backup suite" HOMEPAGE="https://www.bareos.org/" -SRC_URI="https://github.com/${PN}/${PN}/archive/Release/${PV}.tar.gz -> ${P}.tar.gz" -RESTRICT="mirror" + +# some tests still fail propably due to missing bits in src_test -> TODO +RESTRICT="mirror test" +#RESTRICT=" +# mirror +# !test? ( test ) +#" LICENSE="AGPL-3" SLOT="0" -KEYWORDS="~amd64 ~x86" -IUSE="X acl ceph clientonly +director glusterfs ipv6 jansson lmdb - logwatch mysql ndmp +postgres readline scsi-crypto - sqlite static +storage-daemon systemd tcpd vim-syntax vmware xattr" +IUSE="X acl ceph clientonly +director glusterfs ipv6 lmdb + logwatch ndmp readline scsi-crypto split-usr + static +storage-daemon systemd tcpd test vim-syntax vmware xattr" # get cmake variables from core/cmake/BareosSetVariableDefaults.cmake DEPEND=" @@ -33,12 +46,9 @@ DEPEND=" dev-libs/gmp:0 !clientonly? ( acct-user/${PN} - postgres? ( dev-db/postgresql:*[threads] ) - mysql? ( virtual/mysql ) - sqlite? ( dev-db/sqlite:3 ) + dev-db/postgresql:*[threads(+)] director? ( virtual/mta - jansson? ( dev-libs/jansson:= ) ) ) logwatch? ( sys-apps/logwatch ) @@ -47,18 +57,23 @@ DEPEND=" readline? ( sys-libs/readline:0 ) static? ( acl? ( virtual/acl[static-libs] ) - sys-libs/zlib[static-libs] + dev-libs/jansson:=[static-libs] dev-libs/lzo[static-libs] - sys-libs/ncurses:=[static-libs] dev-libs/openssl:0=[static-libs] + sys-libs/ncurses:=[static-libs] + sys-libs/zlib[static-libs] ) !static? ( acl? ( virtual/acl ) + dev-libs/jansson:= dev-libs/lzo dev-libs/openssl:0= sys-libs/ncurses:= sys-libs/zlib ) + X? ( + dev-qt/qtwidgets:5= + ) " RDEPEND="${DEPEND} !clientonly? ( @@ -69,52 +84,89 @@ RDEPEND="${DEPEND} ) vim-syntax? ( || ( app-editors/vim app-editors/gvim ) ) " -BDEPEND="${PYTHON_DEPS}" + +BDEPEND=" + ${PYTHON_DEPS} + test? ( + dev-cpp/gtest + dev-db/postgresql:*[server,threads(+)] + dev-db/mariadb:*[server] + ) +" REQUIRED_USE=" - !clientonly? ( || ( mysql postgres sqlite ) ) static? ( clientonly ) x86? ( !ceph ) " -S=${WORKDIR}/${PN}-Release-${PV} +PATCHES=( + # fix gentoo platform support + "${FILESDIR}/${PN}-21-cmake-gentoo.patch" + "${FILESDIR}/${PN}-22.0.2-werror.patch" + "${FILESDIR}/${PN}-21.1.2-no-automagic-ccache.patch" + "${FILESDIR}/${PN}-22.1.2-include-algorithm.patch" +) + +pkg_pretend() { + local active_removed_backend="" + if has_version "<app-backup/bareos-21[director,mysql]"; then + if grep -qhriE "dbdriver.*=.*mysql" /etc/bareos/; then + active_removed_backend=MySQL + fi + elif has_version "<app-backup/bareos-21[director,sqlite]"; then + if grep -qhriE "dbdriver.*=.*sqlite" /etc/bareos/; then + active_removed_backend=SQLite + fi + fi + if [[ -n $active_removed_backend ]]; then + ewarn + ewarn "You are currently using bareos with the $active_removed_backend" + ewarn "catalog backend." + ewarn + ewarn "THIS IS NOT SUPPORTED ANYMORE" + ewarn + ewarn "Beginning with version 21.0.0 bareos has dropped support for" + ewarn "MySQL and SQLite catalog backends." + ewarn + ewarn "To upgrade to bareos >=21.0.0 you need to migrate to PostgreSQL" + ewarn "catalog backend using the 'bareos-dbcopy' tool of your current" + ewarn "installation first." + ewarn + die "current catalog backend not supported anymore" + fi +} + +src_test() { + # initialze catalog test database + initdb -D "${T}"/pgsql || die + pg_ctl -w -D "${T}"/pgsql start \ + -o "-h '' -k '${T}'" || die + createuser -h "${T}" bareos || die + createdb -h "${T}" --owner bareos bareos || die + export PGHOST="${T}" -src_prepare() { - use mysql && export mydbtypes+=( mysql ) - use postgres && export mydbtypes+=( postgresql ) - use sqlite && export mydbtypes+=( sqlite ) + # initiale mariadb database for backup tests + # $USER must be set and != root + export USER=portage - # enables default database driver in catalog - pushd core/src/defaultconfigs >&/dev/null || die - sed -i -e 's/#dbdriver/dbdriver/' -e '/XXX_REPLACE_WITH_DATABASE_DRIVER_XXX/d' $(grep -rl XXX_REPLACE_WITH_DATABASE_DRIVER_XXX) \ - || die "sed on MyCatalog.conf.in failed" - popd >&/dev/null || die + default + cmake_src_test - # fix gentoo platform support - eapply -p1 "${FILESDIR}/${PN}-20.0.2-cmake-gentoo.patch" + pg_ctl -w -D "${T}"/pgsql stop || die + rm -rvf "${T}"/pgsql +} +src_prepare() { # fix missing DESTDIR in symlink creation sed -i '/bareos-symlink-default-db-backend.cmake/d' "${S}/core/src/cats/CMakeLists.txt" - # disable dird and stored plugins, because of - # py2 dependency - cd "${S}/core/src/plugins" - cmake_comment_add_subdirectory dird - cmake_comment_add_subdirectory stored - cd - - - CMAKE_USE_DIR="$S/core" cmake_src_prepare } src_configure() { local mycmakeargs=() - CMAKE_USE_DIR="$S/core" - - pushd core/platforms >&/dev/null || die - cmake_comment_add_subdirectory '${DISTNAME}' - popd >&/dev/null || die + cmake_comment_add_subdirectory webui if use clientonly; then mycmakeargs+=( @@ -125,13 +177,15 @@ src_configure() { fi for useflag in acl ipv6 ndmp scsi-crypto \ - systemd mysql lmdb; do + systemd lmdb; do mycmakeargs+=( -D$useflag=$(usex $useflag) ) done + if use X; then + mycmakeargs+=( -Dtraymonitor=yes ) + fi mycmakeargs+=( -DHAVE_PYTHON=0 - -DDEFAULT_DB_TYPE=${mydbtypes[0]} -Darchivedir=/var/lib/bareos/storage -Dbackenddir=/usr/$(get_libdir)/${PN}/backend -Dbasename="`hostname -s`" @@ -158,18 +212,15 @@ src_configure() { -Dmon-dir-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" -Dmon-fd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" -Dmon-sd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" - -Dmysql=$(usex mysql) -Dopenssl=yes -Dpiddir=/run/bareos -Dplugindir=/usr/$(get_libdir)/${PN}/plugin - -Dpostgresql=$(usex postgres) -Dsbin-perm=0755 -Dsbindir=/usr/sbin -Dscriptdir=/usr/libexec/bareos -Dsd-group=bareos -Dsd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" -Dsd-user=root - -Dsqlite3=$(usex sqlite) -Dsubsysdir=/run/lock/subsys -Dsysconfdir=/etc -Dworkingdir=/var/lib/bareos @@ -187,7 +238,7 @@ src_install() { cmake_src_install # remove some scripts we don't need at all - rm -f "${D}"/usr/libexec/bareos/{bareos,bareos-ctl-dir,bareos-ctl-fd,bareos-ctl-sd,startmysql,stopmysql} + rm -f "${D}"/usr/libexec/bareos/{bareos,bareos-ctl-dir,bareos-ctl-fd,bareos-ctl-sd} rm -f "${D}"/usr/sbin/bareos # remove upstream init scripts and systemd units @@ -197,9 +248,18 @@ src_install() { rm -f "${D}"/etc/bareos/bareos-regress.conf rm -f "${D}"/etc/logrotate.d/bareos-dir + # remove duplicate binaries being installed in /usr/sbin and replace + # them by symlinks to not break systems that still use split-usr + if use split-usr; then + for f in bwild bregex bsmtp bconsole; do + rm -f "${D}/usr/sbin/$f" || die + ln -s "../bin/$f" "${D}/usr/sbin/$f" || die + done + fi + # get rid of py2 stuff - rm -rf "$D"/usr/lib64/python2.7 - rm -f "$D"/usr/lib64/bareos/plugin/python-fd.so + rm -rf "$D"/usr/lib64/python2.7 || die + rm -f "$D"/usr/lib64/bareos/plugin/python-fd.so || die if ! use vmware; then rm -f "$D"/usr/lib64/bareos/plugin/{BareosFdPluginVMware.py,bareos-fd-vmware.py} fi @@ -304,29 +364,15 @@ src_install() { fi fi for script in ${myscripts}; do - # copy over init script and config to a temporary location - # so we can modify them as needed - cp "${FILESDIR}/${script}".confd "${T}/${script}".confd || die "failed to copy ${script}.confd" - cp "${FILESDIR}/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd" - - # now set the database dependency for the director init script - case "${script}" in - bareos-dir) - sed -i -e "s:%databasetypes%:${mydbtypes[*]}:" "${T}/${script}".confd || die - ;; - *) - ;; - esac - # install init script and config - newinitd "${T}/${script}".initd "${script}" - newconfd "${T}/${script}".confd "${script}" + newinitd "${FILESDIR}/${script}-21-r1".initd "${script}" + newconfd "${FILESDIR}/${script}-21".confd "${script}" done # install systemd unit files if use systemd; then if ! use clientonly; then - use director && systemd_dounit "${FILESDIR}"/bareos-dir.service + use director && systemd_newunit "${FILESDIR}"/bareos-dir-21.service bareos-dir.service use storage-daemon && systemd_dounit "${FILESDIR}"/bareos-sd.service fi systemd_dounit "${FILESDIR}"/bareos-fd.service @@ -337,7 +383,10 @@ src_install() { keepdir /var/lib/bareos keepdir /var/lib/bareos/storage - diropts -m0755 + # set log directory ownership + if ! use clientonly; then + diropts -m0755 -o bareos -g bareos + fi keepdir /var/log/bareos newtmpfiles "${FILESDIR}"/tmpfiles.d-bareos.conf bareos.conf @@ -358,37 +407,29 @@ pkg_postinst() { if ! use clientonly && use director; then einfo einfo "If this is a new install, you must create the database:" - if use postgres; then - einfo - einfo "For postgresql:" - einfo " su postgres -c '/usr/libexec/bareos/create_bareos_database postgresql'" - einfo " su postgres -c '/usr/libexec/bareos/make_bareos_tables postgresql'" - einfo " su postgres -c '/usr/libexec/bareos/grant_bareos_privileges postgresql'" - fi - if use mysql; then - einfo - einfo "For mysql:" - einfo - einfo " Make sure root has direct access to your mysql server. You may want to" - einfo " create a /root/.my.cnf file with" - einfo " [client]" - einfo " user=root" - einfo " password=YourPasswordForAccessingMysqlAsRoot" - einfo " before running:" - einfo " /usr/libexec/bareos/create_bareos_database mysql" - einfo " /usr/libexec/bareos/make_bareos_tables mysql" - einfo " /usr/libexec/bareos/grant_bareos_privileges mysql" - fi einfo - fi - - if use sqlite; then + einfo " su postgres -c '/usr/libexec/bareos/create_bareos_database'" + einfo " su postgres -c '/usr/libexec/bareos/make_bareos_tables'" + einfo " su postgres -c '/usr/libexec/bareos/grant_bareos_privileges'" + einfo + einfo "or run" einfo - einfo "Be aware that Bareos does not officially support SQLite database." - einfo "Best use it only for a client-only installation. See Bug #445540." + einfo " emerge --config app-backup/bareos" einfo - einfo "It is strongly recommended to use either postgresql or mysql as" - einfo "catalog database backend." + einfo "to do this" + einfo + einfo "For major upgrades you may need to run:" + einfo + einfo " su postgres -c '/usr/libexec/bareos/update_bareos_tables'" + einfo + einfo "Please see release notes for details." + einfo "( https://docs.bareos.org/Appendix/ReleaseNotes.html )" einfo fi } + +pkg_config() { + su postgres -c '/usr/libexec/bareos/create_bareos_database' || die "could not create bareos database" + su postgres -c '/usr/libexec/bareos/make_bareos_tables' || die "could not create bareos database tables" + su postgres -c '/usr/libexec/bareos/grant_bareos_privileges' || die "could not grant bareos database privileges" +} diff --git a/app-backup/bareos/bareos-23.0.1.ebuild b/app-backup/bareos/bareos-23.0.1.ebuild new file mode 100644 index 000000000000..24b7a4409e94 --- /dev/null +++ b/app-backup/bareos/bareos-23.0.1.ebuild @@ -0,0 +1,436 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{9..12} ) +CMAKE_WARN_UNUSED_CLI=no + +inherit python-any-r1 systemd cmake tmpfiles flag-o-matic + +if [[ ${PV} == *9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/${PN}/${PN}.git" +else + SRC_URI="https://github.com/${PN}/${PN}/archive/Release/${PV}.tar.gz -> ${P}.tar.gz" + + KEYWORDS="~amd64 ~x86" + S=${WORKDIR}/${PN}-Release-${PV} +fi + +DESCRIPTION="Featureful client/server network backup suite" +HOMEPAGE="https://www.bareos.org/" + +# some tests still fail propably due to missing bits in src_test -> TODO +RESTRICT="mirror test" +#RESTRICT=" +# mirror +# !test? ( test ) +#" + +LICENSE="AGPL-3" +SLOT="0" +IUSE="X acl ceph clientonly cpu_flags_x86_avx +director glusterfs ipv6 lmdb + logwatch ndmp readline scsi-crypto split-usr + static +storage-daemon systemd tcpd test vim-syntax vmware xattr" + +# get cmake variables from core/cmake/BareosSetVariableDefaults.cmake +DEPEND=" + !app-backup/bacula + acct-group/${PN} + !x86? ( + ceph? ( sys-cluster/ceph ) + ) + glusterfs? ( sys-cluster/glusterfs ) + lmdb? ( dev-db/lmdb ) + dev-libs/gmp:0 + !clientonly? ( + acct-user/${PN} + dev-db/postgresql:*[threads(+)] + director? ( + virtual/mta + ) + ) + logwatch? ( sys-apps/logwatch ) + ndmp? ( net-libs/rpcsvc-proto ) + tcpd? ( sys-apps/tcp-wrappers ) + readline? ( sys-libs/readline:0 ) + static? ( + acl? ( virtual/acl[static-libs] ) + dev-libs/jansson:=[static-libs] + dev-libs/lzo[static-libs] + dev-libs/openssl:0=[static-libs] + sys-libs/ncurses:=[static-libs] + sys-libs/zlib[static-libs] + ) + !static? ( + acl? ( virtual/acl ) + dev-libs/jansson:= + dev-libs/lzo + dev-libs/openssl:0= + sys-libs/ncurses:= + sys-libs/zlib + ) + X? ( + dev-qt/qtwidgets:5= + ) + " +RDEPEND="${DEPEND} + !clientonly? ( + storage-daemon? ( + sys-block/mtx + app-arch/mt-st + ) + ) + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) ) + " + +BDEPEND=" + ${PYTHON_DEPS} + test? ( + dev-cpp/gtest + dev-db/postgresql:*[server,threads(+)] + dev-db/mariadb:*[server] + ) +" + +REQUIRED_USE=" + static? ( clientonly ) + x86? ( !ceph ) +" + +PATCHES=( + "${FILESDIR}/${PN}-21-cmake-gentoo.patch" + "${FILESDIR}/${PN}-22.0.2-werror.patch" + "${FILESDIR}/${PN}-21.1.2-no-automagic-ccache.patch" + "${FILESDIR}/${PN}-22.1.2-include-algorithm.patch" +) + +pkg_pretend() { + local active_removed_backend="" + if has_version "<app-backup/bareos-21[director,mysql]"; then + if grep -qhriE "dbdriver.*=.*mysql" /etc/bareos/; then + active_removed_backend=MySQL + fi + elif has_version "<app-backup/bareos-21[director,sqlite]"; then + if grep -qhriE "dbdriver.*=.*sqlite" /etc/bareos/; then + active_removed_backend=SQLite + fi + fi + if [[ -n $active_removed_backend ]]; then + ewarn + ewarn "You are currently using bareos with the $active_removed_backend" + ewarn "catalog backend." + ewarn + ewarn "THIS IS NOT SUPPORTED ANYMORE" + ewarn + ewarn "Beginning with version 21.0.0 bareos has dropped support for" + ewarn "MySQL and SQLite catalog backends." + ewarn + ewarn "To upgrade to bareos >=21.0.0 you need to migrate to PostgreSQL" + ewarn "catalog backend using the 'bareos-dbcopy' tool of your current" + ewarn "installation first." + ewarn + die "current catalog backend not supported anymore" + fi +} + +src_test() { + # initialze catalog test database + initdb -D "${T}"/pgsql || die + pg_ctl -w -D "${T}"/pgsql start \ + -o "-h '' -k '${T}'" || die + createuser -h "${T}" bareos || die + createdb -h "${T}" --owner bareos bareos || die + export PGHOST="${T}" + + # initiale mariadb database for backup tests + # $USER must be set and != root + export USER=portage + + default + cmake_src_test + + pg_ctl -w -D "${T}"/pgsql stop || die + rm -rvf "${T}"/pgsql +} + +src_prepare() { + # fix missing DESTDIR in symlink creation + sed -i '/bareos-symlink-default-db-backend.cmake/d' "${S}/core/src/cats/CMakeLists.txt" + + cmake_src_prepare +} + +src_configure() { + local mycmakeargs=() + + cmake_comment_add_subdirectory webui + + if use clientonly; then + mycmakeargs+=( + -Dclient-only=ON + -Dstatic-cons=$(usex static) + -Dstatic-fd=$(usex static) + ) + fi + + for useflag in acl ipv6 ndmp scsi-crypto \ + systemd lmdb; do + mycmakeargs+=( -D$useflag=$(usex $useflag) ) + done + if use X; then + mycmakeargs+=( -Dtraymonitor=yes ) + fi + + mycmakeargs+=( + -DHAVE_PYTHON=0 + -Darchivedir=/var/lib/bareos/storage + -Dbackenddir=/usr/$(get_libdir)/${PN}/backend + -Dbasename="`hostname -s`" + -Dbatch-insert=yes + -Dbsrdir=/var/lib/bareos/bsr + -Dconfdir=/etc/bareos + -Dcoverage=no + -Ddb_password=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1` + -Ddir-group=bareos + -Ddir-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Ddir-user=bareos + -Ddocdir=/usr/share/doc/${PF} + -Ddynamic-cats-backends=yes + -Ddynamic-storage-backends=yes + -Dfd-group=bareos + -Dfd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Dfd-user=root + -Dhost=${CHOST} + -Dhostname="`hostname -s`" + -Dhtmldir=/usr/share/doc/${PF}/html + -Dlibdir=/usr/$(get_libdir) + -Dlogdir=/var/log/bareos + -Dmandir=/usr/share/man + -Dmon-dir-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Dmon-fd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Dmon-sd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Dopenssl=yes + -Dpiddir=/run/bareos + -Dplugindir=/usr/$(get_libdir)/${PN}/plugin + -Dsbin-perm=0755 + -Dsbindir=/usr/sbin + -Dscriptdir=/usr/libexec/bareos + -Dsd-group=bareos + -Dsd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Dsd-user=root + -Dsubsysdir=/run/lock/subsys + -Dsysconfdir=/etc + -Dworkingdir=/var/lib/bareos + -Dx=$(usex X) + ) + + use cpu_flags_x86_avx && append-flags "-DXXH_X86DISPATCH_ALLOW_AVX" + + # disable droplet support for now as it does not build with gcc 10 + # ... and this is a bundled lib, which should have its own package + cd core && cmake_comment_add_subdirectory "src/droplet" + + cmake_src_configure +} + +src_install() { + cmake_src_install + + # remove some scripts we don't need at all + rm -f "${D}"/usr/libexec/bareos/{bareos,bareos-ctl-dir,bareos-ctl-fd,bareos-ctl-sd} + rm -f "${D}"/usr/sbin/bareos + + # remove upstream init scripts and systemd units + rm -f "${D}"/etc/init.d/bareos-* "${D}"/lib/systemd/system/bareos-*.service + + # remove misc stuff we do not need in production + rm -f "${D}"/etc/bareos/bareos-regress.conf + rm -f "${D}"/etc/logrotate.d/bareos-dir + + # remove duplicate binaries being installed in /usr/sbin and replace + # them by symlinks to not break systems that still use split-usr + if use split-usr; then + for f in bwild bregex bsmtp bconsole; do + rm -f "${D}/usr/sbin/$f" || die + ln -s "../bin/$f" "${D}/usr/sbin/$f" || die + done + fi + + # get rid of py2 stuff + rm -rf "$D"/usr/lib64/python2.7 || die + rm -f "$D"/usr/lib64/bareos/plugin/python-fd.so || die + if ! use vmware; then + rm -f "$D"/usr/lib64/bareos/plugin/{BareosFdPluginVMware.py,bareos-fd-vmware.py} + fi + + # rename statically linked apps + if use clientonly && use static ; then + pushd "${D}"/usr/sbin || die + mv static-bareos-fd bareos-fd || die + mv static-bconsole bconsole || die + popd || die + fi + + # extra files which 'make install' doesn't cover + if ! use clientonly; then + # the logrotate configuration + # (now unconditional wrt bug #258187) + diropts -m0755 + insinto /etc/logrotate.d + insopts -m0644 + newins "${S}"/core/scripts/logrotate bareos + + # the logwatch scripts + if use logwatch; then + diropts -m0750 + dodir /etc/log.d/scripts/services + dodir /etc/log.d/scripts/shared + dodir /etc/log.d/conf/logfiles + dodir /etc/log.d/conf/services + pushd "${S}"/core/scripts/logwatch >&/dev/null || die + + into /etc/log.d/scripts/services + dobin bareos + + into /etc/log.d/scripts/shared + dobin applybareosdate + + insinto /etc/log.d/conf/logfiles + newins logfile.bareos.conf bareos.conf + + insinto /etc/log.d/conf/services + newins services.bareos.conf bareos.conf + + popd >&/dev/null || die + fi + fi + + rm -vf "${D}"/usr/share/man/man1/bareos-bwxconsole.1* + if use clientonly || ! use director; then + rm -vf "${D}"/usr/share/man/man8/bareos-dir.8* + rm -vf "${D}"/usr/share/man/man8/bareos-dbcheck.8* + rm -vf "${D}"/usr/share/man/man1/bsmtp.1* + rm -vf "${D}"/usr/share/man/man8/bwild.8* + rm -vf "${D}"/usr/share/man/man8/bregex.8* + rm -vf "${D}"/usr/share/man/man8/bpluginfo.8* + rm -vf "${D}"/usr/libexec/bareos/create_*_database + rm -vf "${D}"/usr/libexec/bareos/drop_*_database + rm -vf "${D}"/usr/libexec/bareos/make_*_tables + rm -vf "${D}"/usr/libexec/bareos/update_*_tables + rm -vf "${D}"/usr/libexec/bareos/drop_*_tables + rm -vf "${D}"/usr/libexec/bareos/grant_*_privileges + rm -vf "${D}"/usr/libexec/bareos/*_catalog_backup + fi + if use clientonly || ! use storage-daemon; then + rm -vf "${D}"/usr/share/man/man8/bareos-sd.8* + rm -vf "${D}"/usr/share/man/man8/bcopy.8* + rm -vf "${D}"/usr/share/man/man8/bextract.8* + rm -vf "${D}"/usr/share/man/man8/bls.8* + rm -vf "${D}"/usr/share/man/man8/bscan.8* + rm -vf "${D}"/usr/share/man/man8/btape.8* + rm -vf "${D}"/usr/libexec/bareos/disk-changer + rm -vf "${D}"/usr/libexec/bareos/mtx-changer + rm -vf "${D}"/usr/libexec/bareos/dvd-handler + rm -vf "${D}"/etc/bareos/mtx-changer.conf + fi + if ! use scsi-crypto; then + rm -vf "${D}"/usr/share/man/man8/bscrypto.8* + fi + + # documentation + dodoc README.md + dodoc core/README.configsubdirectories + use glusterfs dodoc core/README.glusterfs + use ndmp && dodoc core/README.NDMP + use scsi-crypto && dodoc core/README.scsicrypto + + # vim-files + if use vim-syntax; then + insinto /usr/share/vim/vimfiles/syntax + doins core/scripts/bareos.vim + insinto /usr/share/vim/vimfiles/ftdetect + newins core/scripts/filetype.vim bareos_ft.vim + fi + + # setup init scripts + myscripts="bareos-fd" + if ! use clientonly; then + if use director; then + myscripts+=" bareos-dir" + fi + if use storage-daemon; then + myscripts+=" bareos-sd" + fi + fi + for script in ${myscripts}; do + # install init script and config + newinitd "${FILESDIR}/${script}-21-r1".initd "${script}" + newconfd "${FILESDIR}/${script}-21".confd "${script}" + done + + # install systemd unit files + if use systemd; then + if ! use clientonly; then + use director && systemd_newunit "${FILESDIR}"/bareos-dir-21.service bareos-dir.service + use storage-daemon && systemd_dounit "${FILESDIR}"/bareos-sd.service + fi + systemd_dounit "${FILESDIR}"/bareos-fd.service + fi + + # make sure the working directory exists + diropts -m0750 + keepdir /var/lib/bareos + keepdir /var/lib/bareos/storage + + # set log directory ownership + if ! use clientonly; then + diropts -m0755 -o bareos -g bareos + fi + keepdir /var/log/bareos + + newtmpfiles "${FILESDIR}"/tmpfiles.d-bareos.conf bareos.conf + + # make sure bareos group can execute bareos libexec scripts + fowners -R root:bareos /usr/libexec/bareos +} + +pkg_postinst() { + tmpfiles_process bareos.conf + + if use clientonly; then + fowners root:bareos /var/lib/bareos + else + fowners bareos:bareos /var/lib/bareos + fi + + if ! use clientonly && use director; then + einfo + einfo "If this is a new install, you must create the database:" + einfo + einfo " su postgres -c '/usr/libexec/bareos/create_bareos_database'" + einfo " su postgres -c '/usr/libexec/bareos/make_bareos_tables'" + einfo " su postgres -c '/usr/libexec/bareos/grant_bareos_privileges'" + einfo + einfo "or run" + einfo + einfo " emerge --config app-backup/bareos" + einfo + einfo "to do this" + einfo + einfo "For major upgrades you may need to run:" + einfo + einfo " su postgres -c '/usr/libexec/bareos/update_bareos_tables'" + einfo + einfo "Please see release notes for details." + einfo "( https://docs.bareos.org/Appendix/ReleaseNotes.html )" + einfo + fi +} + +pkg_config() { + su postgres -c '/usr/libexec/bareos/create_bareos_database' || die "could not create bareos database" + su postgres -c '/usr/libexec/bareos/make_bareos_tables' || die "could not create bareos database tables" + su postgres -c '/usr/libexec/bareos/grant_bareos_privileges' || die "could not grant bareos database privileges" +} diff --git a/app-backup/bareos/bareos-19.2.12.ebuild b/app-backup/bareos/bareos-23.0.2.ebuild index d722ad0369d4..f88f46187fe6 100644 --- a/app-backup/bareos/bareos-19.2.12.ebuild +++ b/app-backup/bareos/bareos-23.0.2.ebuild @@ -1,25 +1,38 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -PYTHON_COMPAT=( python3_{8..10} ) +PYTHON_COMPAT=( python3_{10..12} ) CMAKE_WARN_UNUSED_CLI=no -#CMAKE_REMOVE_MODULES=yes -inherit python-any-r1 systemd cmake tmpfiles +inherit python-any-r1 systemd cmake tmpfiles flag-o-matic + +if [[ ${PV} == *9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/${PN}/${PN}.git" +else + SRC_URI="https://github.com/${PN}/${PN}/archive/Release/${PV}.tar.gz -> ${P}.tar.gz" + + KEYWORDS="~amd64 ~x86" + S=${WORKDIR}/${PN}-Release-${PV} +fi DESCRIPTION="Featureful client/server network backup suite" HOMEPAGE="https://www.bareos.org/" -SRC_URI="https://github.com/${PN}/${PN}/archive/Release/${PV}.tar.gz -> ${P}.tar.gz" -RESTRICT="mirror" + +# some tests still fail propably due to missing bits in src_test -> TODO +RESTRICT="mirror test" +#RESTRICT=" +# mirror +# !test? ( test ) +#" LICENSE="AGPL-3" SLOT="0" -KEYWORDS="~amd64 ~x86" -IUSE="X acl ceph clientonly +director glusterfs ipv6 jansson lmdb - logwatch mysql ndmp +postgres readline scsi-crypto - sqlite static +storage-daemon systemd tcpd vim-syntax xattr" +IUSE="X acl ceph clientonly cpu_flags_x86_avx +director glusterfs ipv6 lmdb + logwatch ndmp readline scsi-crypto split-usr + static +storage-daemon systemd tcpd test vim-syntax vmware xattr" # get cmake variables from core/cmake/BareosSetVariableDefaults.cmake DEPEND=" @@ -33,12 +46,9 @@ DEPEND=" dev-libs/gmp:0 !clientonly? ( acct-user/${PN} - postgres? ( dev-db/postgresql:*[threads] ) - mysql? ( virtual/mysql ) - sqlite? ( dev-db/sqlite:3 ) + dev-db/postgresql:*[threads(+)] director? ( virtual/mta - jansson? ( dev-libs/jansson:= ) ) ) logwatch? ( sys-apps/logwatch ) @@ -47,18 +57,23 @@ DEPEND=" readline? ( sys-libs/readline:0 ) static? ( acl? ( virtual/acl[static-libs] ) - sys-libs/zlib[static-libs] + dev-libs/jansson:=[static-libs] dev-libs/lzo[static-libs] - sys-libs/ncurses:=[static-libs] dev-libs/openssl:0=[static-libs] + sys-libs/ncurses:=[static-libs] + sys-libs/zlib[static-libs] ) !static? ( acl? ( virtual/acl ) + dev-libs/jansson:= dev-libs/lzo dev-libs/openssl:0= sys-libs/ncurses:= sys-libs/zlib ) + X? ( + dev-qt/qtwidgets:5= + ) " RDEPEND="${DEPEND} !clientonly? ( @@ -69,52 +84,87 @@ RDEPEND="${DEPEND} ) vim-syntax? ( || ( app-editors/vim app-editors/gvim ) ) " -BDEPEND="${PYTHON_DEPS}" + +BDEPEND=" + ${PYTHON_DEPS} + test? ( + dev-cpp/gtest + dev-db/postgresql:*[server,threads(+)] + dev-db/mariadb:*[server] + ) +" REQUIRED_USE=" - !clientonly? ( || ( mysql postgres sqlite ) ) static? ( clientonly ) x86? ( !ceph ) " -S=${WORKDIR}/${PN}-Release-${PV} +PATCHES=( + "${FILESDIR}/${PN}-21-cmake-gentoo.patch" + "${FILESDIR}/${PN}-22.0.2-werror.patch" + "${FILESDIR}/${PN}-21.1.2-no-automagic-ccache.patch" +) + +pkg_pretend() { + local active_removed_backend="" + if has_version "<app-backup/bareos-21[director,mysql]"; then + if grep -qhriE "dbdriver.*=.*mysql" /etc/bareos/; then + active_removed_backend=MySQL + fi + elif has_version "<app-backup/bareos-21[director,sqlite]"; then + if grep -qhriE "dbdriver.*=.*sqlite" /etc/bareos/; then + active_removed_backend=SQLite + fi + fi + if [[ -n $active_removed_backend ]]; then + ewarn + ewarn "You are currently using bareos with the $active_removed_backend" + ewarn "catalog backend." + ewarn + ewarn "THIS IS NOT SUPPORTED ANYMORE" + ewarn + ewarn "Beginning with version 21.0.0 bareos has dropped support for" + ewarn "MySQL and SQLite catalog backends." + ewarn + ewarn "To upgrade to bareos >=21.0.0 you need to migrate to PostgreSQL" + ewarn "catalog backend using the 'bareos-dbcopy' tool of your current" + ewarn "installation first." + ewarn + die "current catalog backend not supported anymore" + fi +} -src_prepare() { - use mysql && export mydbtypes+=( mysql ) - use postgres && export mydbtypes+=( postgresql ) - use sqlite && export mydbtypes+=( sqlite ) +src_test() { + # initialze catalog test database + initdb -D "${T}"/pgsql || die + pg_ctl -w -D "${T}"/pgsql start \ + -o "-h '' -k '${T}'" || die + createuser -h "${T}" bareos || die + createdb -h "${T}" --owner bareos bareos || die + export PGHOST="${T}" - # enables default database driver in catalog - pushd core/src/defaultconfigs >&/dev/null || die - sed -i -e 's/#dbdriver/dbdriver/' -e '/XXX_REPLACE_WITH_DATABASE_DRIVER_XXX/d' $(grep -rl XXX_REPLACE_WITH_DATABASE_DRIVER_XXX) \ - || die "sed on MyCatalog.conf.in failed" - popd >&/dev/null || die + # initiale mariadb database for backup tests + # $USER must be set and != root + export USER=portage - # fix gentoo version detection - eapply -p0 "${FILESDIR}/${PN}-cmake-gentoo.patch" + default + cmake_src_test + pg_ctl -w -D "${T}"/pgsql stop || die + rm -rvf "${T}"/pgsql +} + +src_prepare() { # fix missing DESTDIR in symlink creation sed -i '/bareos-symlink-default-db-backend.cmake/d' "${S}/core/src/cats/CMakeLists.txt" - # disable dird and stored plugins, because of - # py2 dependency - cd "${S}/core/src/plugins" - cmake_comment_add_subdirectory dird - cmake_comment_add_subdirectory stored - cd - - - CMAKE_USE_DIR="$S/core" cmake_src_prepare } src_configure() { local mycmakeargs=() - CMAKE_USE_DIR="$S/core" - - pushd core/platforms >&/dev/null || die - cmake_comment_add_subdirectory '${DISTNAME}' - popd >&/dev/null || die + cmake_comment_add_subdirectory webui if use clientonly; then mycmakeargs+=( @@ -125,13 +175,15 @@ src_configure() { fi for useflag in acl ipv6 ndmp scsi-crypto \ - systemd mysql lmdb; do + systemd lmdb; do mycmakeargs+=( -D$useflag=$(usex $useflag) ) done + if use X; then + mycmakeargs+=( -Dtraymonitor=yes ) + fi mycmakeargs+=( -DHAVE_PYTHON=0 - -DDEFAULT_DB_TYPE=${mydbtypes[0]} -Darchivedir=/var/lib/bareos/storage -Dbackenddir=/usr/$(get_libdir)/${PN}/backend -Dbasename="`hostname -s`" @@ -158,24 +210,27 @@ src_configure() { -Dmon-dir-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" -Dmon-fd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" -Dmon-sd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" - -Dmysql=$(usex mysql) -Dopenssl=yes -Dpiddir=/run/bareos -Dplugindir=/usr/$(get_libdir)/${PN}/plugin - -Dpostgresql=$(usex postgres) -Dsbin-perm=0755 -Dsbindir=/usr/sbin -Dscriptdir=/usr/libexec/bareos -Dsd-group=bareos -Dsd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" -Dsd-user=root - -Dsqlite3=$(usex sqlite) -Dsubsysdir=/run/lock/subsys -Dsysconfdir=/etc -Dworkingdir=/var/lib/bareos -Dx=$(usex X) ) + use cpu_flags_x86_avx && append-flags "-DXXH_X86DISPATCH_ALLOW_AVX" + + # disable droplet support for now as it does not build with gcc 10 + # ... and this is a bundled lib, which should have its own package + cd core && cmake_comment_add_subdirectory "src/droplet" + cmake_src_configure } @@ -183,15 +238,32 @@ src_install() { cmake_src_install # remove some scripts we don't need at all - rm -f "${D}"/usr/libexec/bareos/{bareos,bareos-ctl-dir,bareos-ctl-fd,bareos-ctl-sd,startmysql,stopmysql} + rm -f "${D}"/usr/libexec/bareos/{bareos,bareos-ctl-dir,bareos-ctl-fd,bareos-ctl-sd} rm -f "${D}"/usr/sbin/bareos - # remove timelimit to fix #778557 - rm -f "${D}"/usr/{,s}bin/timelimit - # remove upstream init scripts and systemd units rm -f "${D}"/etc/init.d/bareos-* "${D}"/lib/systemd/system/bareos-*.service + # remove misc stuff we do not need in production + rm -f "${D}"/etc/bareos/bareos-regress.conf + rm -f "${D}"/etc/logrotate.d/bareos-dir + + # remove duplicate binaries being installed in /usr/sbin and replace + # them by symlinks to not break systems that still use split-usr + if use split-usr; then + for f in bwild bregex bsmtp bconsole; do + rm -f "${D}/usr/sbin/$f" || die + ln -s "../bin/$f" "${D}/usr/sbin/$f" || die + done + fi + + # get rid of py2 stuff + rm -rf "$D"/usr/lib64/python2.7 || die + rm -f "$D"/usr/lib64/bareos/plugin/python-fd.so || die + if ! use vmware; then + rm -f "$D"/usr/lib64/bareos/plugin/{BareosFdPluginVMware.py,bareos-fd-vmware.py} + fi + # rename statically linked apps if use clientonly && use static ; then pushd "${D}"/usr/sbin || die @@ -292,29 +364,15 @@ src_install() { fi fi for script in ${myscripts}; do - # copy over init script and config to a temporary location - # so we can modify them as needed - cp "${FILESDIR}/${script}".confd "${T}/${script}".confd || die "failed to copy ${script}.confd" - cp "${FILESDIR}/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd" - - # now set the database dependency for the director init script - case "${script}" in - bareos-dir) - sed -i -e "s:%databasetypes%:${mydbtypes[*]}:" "${T}/${script}".confd || die - ;; - *) - ;; - esac - # install init script and config - newinitd "${T}/${script}".initd "${script}" - newconfd "${T}/${script}".confd "${script}" + newinitd "${FILESDIR}/${script}-21-r1".initd "${script}" + newconfd "${FILESDIR}/${script}-21".confd "${script}" done # install systemd unit files if use systemd; then if ! use clientonly; then - use director && systemd_dounit "${FILESDIR}"/bareos-dir.service + use director && systemd_newunit "${FILESDIR}"/bareos-dir-21.service bareos-dir.service use storage-daemon && systemd_dounit "${FILESDIR}"/bareos-sd.service fi systemd_dounit "${FILESDIR}"/bareos-fd.service @@ -325,7 +383,10 @@ src_install() { keepdir /var/lib/bareos keepdir /var/lib/bareos/storage - diropts -m0755 + # set log directory ownership + if ! use clientonly; then + diropts -m0755 -o bareos -g bareos + fi keepdir /var/log/bareos newtmpfiles "${FILESDIR}"/tmpfiles.d-bareos.conf bareos.conf @@ -346,37 +407,29 @@ pkg_postinst() { if ! use clientonly && use director; then einfo einfo "If this is a new install, you must create the database:" - if use postgres; then - einfo - einfo "For postgresql:" - einfo " su postgres -c '/usr/libexec/bareos/create_bareos_database postgresql'" - einfo " su postgres -c '/usr/libexec/bareos/make_bareos_tables postgresql'" - einfo " su postgres -c '/usr/libexec/bareos/grant_bareos_privileges postgresql'" - fi - if use mysql; then - einfo - einfo "For mysql:" - einfo - einfo " Make sure root has direct access to your mysql server. You may want to" - einfo " create a /root/.my.cnf file with" - einfo " [client]" - einfo " user=root" - einfo " password=YourPasswordForAccessingMysqlAsRoot" - einfo " before running:" - einfo " /usr/libexec/bareos/create_bareos_database mysql" - einfo " /usr/libexec/bareos/make_bareos_tables mysql" - einfo " /usr/libexec/bareos/grant_bareos_privileges mysql" - fi einfo - fi - - if use sqlite; then + einfo " su postgres -c '/usr/libexec/bareos/create_bareos_database'" + einfo " su postgres -c '/usr/libexec/bareos/make_bareos_tables'" + einfo " su postgres -c '/usr/libexec/bareos/grant_bareos_privileges'" + einfo + einfo "or run" einfo - einfo "Be aware that Bareos does not officially support SQLite database." - einfo "Best use it only for a client-only installation. See Bug #445540." + einfo " emerge --config app-backup/bareos" einfo - einfo "It is strongly recommended to use either postgresql or mysql as" - einfo "catalog database backend." + einfo "to do this" + einfo + einfo "For major upgrades you may need to run:" + einfo + einfo " su postgres -c '/usr/libexec/bareos/update_bareos_tables'" + einfo + einfo "Please see release notes for details." + einfo "( https://docs.bareos.org/Appendix/ReleaseNotes.html )" einfo fi } + +pkg_config() { + su postgres -c '/usr/libexec/bareos/create_bareos_database' || die "could not create bareos database" + su postgres -c '/usr/libexec/bareos/make_bareos_tables' || die "could not create bareos database tables" + su postgres -c '/usr/libexec/bareos/grant_bareos_privileges' || die "could not grant bareos database privileges" +} diff --git a/app-backup/bareos/bareos-9999.ebuild b/app-backup/bareos/bareos-9999.ebuild new file mode 100644 index 000000000000..24b7a4409e94 --- /dev/null +++ b/app-backup/bareos/bareos-9999.ebuild @@ -0,0 +1,436 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{9..12} ) +CMAKE_WARN_UNUSED_CLI=no + +inherit python-any-r1 systemd cmake tmpfiles flag-o-matic + +if [[ ${PV} == *9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/${PN}/${PN}.git" +else + SRC_URI="https://github.com/${PN}/${PN}/archive/Release/${PV}.tar.gz -> ${P}.tar.gz" + + KEYWORDS="~amd64 ~x86" + S=${WORKDIR}/${PN}-Release-${PV} +fi + +DESCRIPTION="Featureful client/server network backup suite" +HOMEPAGE="https://www.bareos.org/" + +# some tests still fail propably due to missing bits in src_test -> TODO +RESTRICT="mirror test" +#RESTRICT=" +# mirror +# !test? ( test ) +#" + +LICENSE="AGPL-3" +SLOT="0" +IUSE="X acl ceph clientonly cpu_flags_x86_avx +director glusterfs ipv6 lmdb + logwatch ndmp readline scsi-crypto split-usr + static +storage-daemon systemd tcpd test vim-syntax vmware xattr" + +# get cmake variables from core/cmake/BareosSetVariableDefaults.cmake +DEPEND=" + !app-backup/bacula + acct-group/${PN} + !x86? ( + ceph? ( sys-cluster/ceph ) + ) + glusterfs? ( sys-cluster/glusterfs ) + lmdb? ( dev-db/lmdb ) + dev-libs/gmp:0 + !clientonly? ( + acct-user/${PN} + dev-db/postgresql:*[threads(+)] + director? ( + virtual/mta + ) + ) + logwatch? ( sys-apps/logwatch ) + ndmp? ( net-libs/rpcsvc-proto ) + tcpd? ( sys-apps/tcp-wrappers ) + readline? ( sys-libs/readline:0 ) + static? ( + acl? ( virtual/acl[static-libs] ) + dev-libs/jansson:=[static-libs] + dev-libs/lzo[static-libs] + dev-libs/openssl:0=[static-libs] + sys-libs/ncurses:=[static-libs] + sys-libs/zlib[static-libs] + ) + !static? ( + acl? ( virtual/acl ) + dev-libs/jansson:= + dev-libs/lzo + dev-libs/openssl:0= + sys-libs/ncurses:= + sys-libs/zlib + ) + X? ( + dev-qt/qtwidgets:5= + ) + " +RDEPEND="${DEPEND} + !clientonly? ( + storage-daemon? ( + sys-block/mtx + app-arch/mt-st + ) + ) + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) ) + " + +BDEPEND=" + ${PYTHON_DEPS} + test? ( + dev-cpp/gtest + dev-db/postgresql:*[server,threads(+)] + dev-db/mariadb:*[server] + ) +" + +REQUIRED_USE=" + static? ( clientonly ) + x86? ( !ceph ) +" + +PATCHES=( + "${FILESDIR}/${PN}-21-cmake-gentoo.patch" + "${FILESDIR}/${PN}-22.0.2-werror.patch" + "${FILESDIR}/${PN}-21.1.2-no-automagic-ccache.patch" + "${FILESDIR}/${PN}-22.1.2-include-algorithm.patch" +) + +pkg_pretend() { + local active_removed_backend="" + if has_version "<app-backup/bareos-21[director,mysql]"; then + if grep -qhriE "dbdriver.*=.*mysql" /etc/bareos/; then + active_removed_backend=MySQL + fi + elif has_version "<app-backup/bareos-21[director,sqlite]"; then + if grep -qhriE "dbdriver.*=.*sqlite" /etc/bareos/; then + active_removed_backend=SQLite + fi + fi + if [[ -n $active_removed_backend ]]; then + ewarn + ewarn "You are currently using bareos with the $active_removed_backend" + ewarn "catalog backend." + ewarn + ewarn "THIS IS NOT SUPPORTED ANYMORE" + ewarn + ewarn "Beginning with version 21.0.0 bareos has dropped support for" + ewarn "MySQL and SQLite catalog backends." + ewarn + ewarn "To upgrade to bareos >=21.0.0 you need to migrate to PostgreSQL" + ewarn "catalog backend using the 'bareos-dbcopy' tool of your current" + ewarn "installation first." + ewarn + die "current catalog backend not supported anymore" + fi +} + +src_test() { + # initialze catalog test database + initdb -D "${T}"/pgsql || die + pg_ctl -w -D "${T}"/pgsql start \ + -o "-h '' -k '${T}'" || die + createuser -h "${T}" bareos || die + createdb -h "${T}" --owner bareos bareos || die + export PGHOST="${T}" + + # initiale mariadb database for backup tests + # $USER must be set and != root + export USER=portage + + default + cmake_src_test + + pg_ctl -w -D "${T}"/pgsql stop || die + rm -rvf "${T}"/pgsql +} + +src_prepare() { + # fix missing DESTDIR in symlink creation + sed -i '/bareos-symlink-default-db-backend.cmake/d' "${S}/core/src/cats/CMakeLists.txt" + + cmake_src_prepare +} + +src_configure() { + local mycmakeargs=() + + cmake_comment_add_subdirectory webui + + if use clientonly; then + mycmakeargs+=( + -Dclient-only=ON + -Dstatic-cons=$(usex static) + -Dstatic-fd=$(usex static) + ) + fi + + for useflag in acl ipv6 ndmp scsi-crypto \ + systemd lmdb; do + mycmakeargs+=( -D$useflag=$(usex $useflag) ) + done + if use X; then + mycmakeargs+=( -Dtraymonitor=yes ) + fi + + mycmakeargs+=( + -DHAVE_PYTHON=0 + -Darchivedir=/var/lib/bareos/storage + -Dbackenddir=/usr/$(get_libdir)/${PN}/backend + -Dbasename="`hostname -s`" + -Dbatch-insert=yes + -Dbsrdir=/var/lib/bareos/bsr + -Dconfdir=/etc/bareos + -Dcoverage=no + -Ddb_password=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1` + -Ddir-group=bareos + -Ddir-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Ddir-user=bareos + -Ddocdir=/usr/share/doc/${PF} + -Ddynamic-cats-backends=yes + -Ddynamic-storage-backends=yes + -Dfd-group=bareos + -Dfd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Dfd-user=root + -Dhost=${CHOST} + -Dhostname="`hostname -s`" + -Dhtmldir=/usr/share/doc/${PF}/html + -Dlibdir=/usr/$(get_libdir) + -Dlogdir=/var/log/bareos + -Dmandir=/usr/share/man + -Dmon-dir-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Dmon-fd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Dmon-sd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Dopenssl=yes + -Dpiddir=/run/bareos + -Dplugindir=/usr/$(get_libdir)/${PN}/plugin + -Dsbin-perm=0755 + -Dsbindir=/usr/sbin + -Dscriptdir=/usr/libexec/bareos + -Dsd-group=bareos + -Dsd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Dsd-user=root + -Dsubsysdir=/run/lock/subsys + -Dsysconfdir=/etc + -Dworkingdir=/var/lib/bareos + -Dx=$(usex X) + ) + + use cpu_flags_x86_avx && append-flags "-DXXH_X86DISPATCH_ALLOW_AVX" + + # disable droplet support for now as it does not build with gcc 10 + # ... and this is a bundled lib, which should have its own package + cd core && cmake_comment_add_subdirectory "src/droplet" + + cmake_src_configure +} + +src_install() { + cmake_src_install + + # remove some scripts we don't need at all + rm -f "${D}"/usr/libexec/bareos/{bareos,bareos-ctl-dir,bareos-ctl-fd,bareos-ctl-sd} + rm -f "${D}"/usr/sbin/bareos + + # remove upstream init scripts and systemd units + rm -f "${D}"/etc/init.d/bareos-* "${D}"/lib/systemd/system/bareos-*.service + + # remove misc stuff we do not need in production + rm -f "${D}"/etc/bareos/bareos-regress.conf + rm -f "${D}"/etc/logrotate.d/bareos-dir + + # remove duplicate binaries being installed in /usr/sbin and replace + # them by symlinks to not break systems that still use split-usr + if use split-usr; then + for f in bwild bregex bsmtp bconsole; do + rm -f "${D}/usr/sbin/$f" || die + ln -s "../bin/$f" "${D}/usr/sbin/$f" || die + done + fi + + # get rid of py2 stuff + rm -rf "$D"/usr/lib64/python2.7 || die + rm -f "$D"/usr/lib64/bareos/plugin/python-fd.so || die + if ! use vmware; then + rm -f "$D"/usr/lib64/bareos/plugin/{BareosFdPluginVMware.py,bareos-fd-vmware.py} + fi + + # rename statically linked apps + if use clientonly && use static ; then + pushd "${D}"/usr/sbin || die + mv static-bareos-fd bareos-fd || die + mv static-bconsole bconsole || die + popd || die + fi + + # extra files which 'make install' doesn't cover + if ! use clientonly; then + # the logrotate configuration + # (now unconditional wrt bug #258187) + diropts -m0755 + insinto /etc/logrotate.d + insopts -m0644 + newins "${S}"/core/scripts/logrotate bareos + + # the logwatch scripts + if use logwatch; then + diropts -m0750 + dodir /etc/log.d/scripts/services + dodir /etc/log.d/scripts/shared + dodir /etc/log.d/conf/logfiles + dodir /etc/log.d/conf/services + pushd "${S}"/core/scripts/logwatch >&/dev/null || die + + into /etc/log.d/scripts/services + dobin bareos + + into /etc/log.d/scripts/shared + dobin applybareosdate + + insinto /etc/log.d/conf/logfiles + newins logfile.bareos.conf bareos.conf + + insinto /etc/log.d/conf/services + newins services.bareos.conf bareos.conf + + popd >&/dev/null || die + fi + fi + + rm -vf "${D}"/usr/share/man/man1/bareos-bwxconsole.1* + if use clientonly || ! use director; then + rm -vf "${D}"/usr/share/man/man8/bareos-dir.8* + rm -vf "${D}"/usr/share/man/man8/bareos-dbcheck.8* + rm -vf "${D}"/usr/share/man/man1/bsmtp.1* + rm -vf "${D}"/usr/share/man/man8/bwild.8* + rm -vf "${D}"/usr/share/man/man8/bregex.8* + rm -vf "${D}"/usr/share/man/man8/bpluginfo.8* + rm -vf "${D}"/usr/libexec/bareos/create_*_database + rm -vf "${D}"/usr/libexec/bareos/drop_*_database + rm -vf "${D}"/usr/libexec/bareos/make_*_tables + rm -vf "${D}"/usr/libexec/bareos/update_*_tables + rm -vf "${D}"/usr/libexec/bareos/drop_*_tables + rm -vf "${D}"/usr/libexec/bareos/grant_*_privileges + rm -vf "${D}"/usr/libexec/bareos/*_catalog_backup + fi + if use clientonly || ! use storage-daemon; then + rm -vf "${D}"/usr/share/man/man8/bareos-sd.8* + rm -vf "${D}"/usr/share/man/man8/bcopy.8* + rm -vf "${D}"/usr/share/man/man8/bextract.8* + rm -vf "${D}"/usr/share/man/man8/bls.8* + rm -vf "${D}"/usr/share/man/man8/bscan.8* + rm -vf "${D}"/usr/share/man/man8/btape.8* + rm -vf "${D}"/usr/libexec/bareos/disk-changer + rm -vf "${D}"/usr/libexec/bareos/mtx-changer + rm -vf "${D}"/usr/libexec/bareos/dvd-handler + rm -vf "${D}"/etc/bareos/mtx-changer.conf + fi + if ! use scsi-crypto; then + rm -vf "${D}"/usr/share/man/man8/bscrypto.8* + fi + + # documentation + dodoc README.md + dodoc core/README.configsubdirectories + use glusterfs dodoc core/README.glusterfs + use ndmp && dodoc core/README.NDMP + use scsi-crypto && dodoc core/README.scsicrypto + + # vim-files + if use vim-syntax; then + insinto /usr/share/vim/vimfiles/syntax + doins core/scripts/bareos.vim + insinto /usr/share/vim/vimfiles/ftdetect + newins core/scripts/filetype.vim bareos_ft.vim + fi + + # setup init scripts + myscripts="bareos-fd" + if ! use clientonly; then + if use director; then + myscripts+=" bareos-dir" + fi + if use storage-daemon; then + myscripts+=" bareos-sd" + fi + fi + for script in ${myscripts}; do + # install init script and config + newinitd "${FILESDIR}/${script}-21-r1".initd "${script}" + newconfd "${FILESDIR}/${script}-21".confd "${script}" + done + + # install systemd unit files + if use systemd; then + if ! use clientonly; then + use director && systemd_newunit "${FILESDIR}"/bareos-dir-21.service bareos-dir.service + use storage-daemon && systemd_dounit "${FILESDIR}"/bareos-sd.service + fi + systemd_dounit "${FILESDIR}"/bareos-fd.service + fi + + # make sure the working directory exists + diropts -m0750 + keepdir /var/lib/bareos + keepdir /var/lib/bareos/storage + + # set log directory ownership + if ! use clientonly; then + diropts -m0755 -o bareos -g bareos + fi + keepdir /var/log/bareos + + newtmpfiles "${FILESDIR}"/tmpfiles.d-bareos.conf bareos.conf + + # make sure bareos group can execute bareos libexec scripts + fowners -R root:bareos /usr/libexec/bareos +} + +pkg_postinst() { + tmpfiles_process bareos.conf + + if use clientonly; then + fowners root:bareos /var/lib/bareos + else + fowners bareos:bareos /var/lib/bareos + fi + + if ! use clientonly && use director; then + einfo + einfo "If this is a new install, you must create the database:" + einfo + einfo " su postgres -c '/usr/libexec/bareos/create_bareos_database'" + einfo " su postgres -c '/usr/libexec/bareos/make_bareos_tables'" + einfo " su postgres -c '/usr/libexec/bareos/grant_bareos_privileges'" + einfo + einfo "or run" + einfo + einfo " emerge --config app-backup/bareos" + einfo + einfo "to do this" + einfo + einfo "For major upgrades you may need to run:" + einfo + einfo " su postgres -c '/usr/libexec/bareos/update_bareos_tables'" + einfo + einfo "Please see release notes for details." + einfo "( https://docs.bareos.org/Appendix/ReleaseNotes.html )" + einfo + fi +} + +pkg_config() { + su postgres -c '/usr/libexec/bareos/create_bareos_database' || die "could not create bareos database" + su postgres -c '/usr/libexec/bareos/make_bareos_tables' || die "could not create bareos database tables" + su postgres -c '/usr/libexec/bareos/grant_bareos_privileges' || die "could not grant bareos database privileges" +} diff --git a/app-backup/bareos/files/bareos-20.0.2-cmake-gentoo.patch b/app-backup/bareos/files/bareos-20.0.2-cmake-gentoo.patch deleted file mode 100644 index 9d3cf8092e1c..000000000000 --- a/app-backup/bareos/files/bareos-20.0.2-cmake-gentoo.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -urw bareos-Release-20.0.2.orig/core/cmake/distname.sh bareos-Release-20.0.2/core/cmake/distname.sh ---- bareos-Release-20.0.2.orig/core/cmake/distname.sh 2021-06-10 06:07:18.000000000 -0930 -+++ bareos-Release-20.0.2/core/cmake/distname.sh 2021-08-15 17:07:37.168216517 -0930 -@@ -153,7 +153,7 @@ - elif test -f /etc/gentoo-release - then - PLATFORM=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 -urw bareos-Release-20.0.2.orig/core/platforms/CMakeLists.txt bareos-Release-20.0.2/core/platforms/CMakeLists.txt ---- bareos-Release-20.0.2.orig/core/platforms/CMakeLists.txt 2021-06-10 06:07:18.000000000 -0930 -+++ bareos-Release-20.0.2/core/platforms/CMakeLists.txt 2021-08-15 17:07:37.549226558 -0930 -@@ -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(${PLATFORM} STREQUAL hpux) - message(STATUS "PLATFORM: " ${PLATFORM}) - elseif(${PLATFORM} STREQUAL archlinux) 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-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-21.initd b/app-backup/bareos/files/bareos-dir-21.initd deleted file mode 100644 index 916ee13b36ce..000000000000 --- a/app-backup/bareos/files/bareos-dir-21.initd +++ /dev/null @@ -1,22 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -depend() { - need postgresql - use dns bareos-fd bareos-sd -} - -start() { - ebegin "Starting bareos director" - checkpath -d -m 0750 -o root:bareos /run/bareos - start-stop-daemon --start --quiet --exec /usr/sbin/bareos-dir \ - -- -p /run/bareos/bareos-dir.9101.pid ${DIR_OPTIONS} - eend $? -} - -stop() { - ebegin "Stopping bareos director" - start-stop-daemon --stop --quiet --pidfile /run/bareos/bareos-dir.9101.pid - eend $? -} diff --git a/app-backup/bareos/files/bareos-dir.confd b/app-backup/bareos/files/bareos-dir.confd deleted file mode 100644 index 6d755bf93344..000000000000 --- a/app-backup/bareos/files/bareos-dir.confd +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 1999-2019 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 -# access your backup devices. -DIR_OPTIONS="-u bareos -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 462ff07843a2..000000000000 --- a/app-backup/bareos/files/bareos-dir.initd +++ /dev/null @@ -1,30 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -depend() { - use dns bareos-fd bareos-sd -} - -start() { - ebegin "Starting bareos director" - # g+w until #631598 is resolved - checkpath -d -m 0770 -o root:bareos /run/bareos - start-stop-daemon --start --quiet --exec /usr/sbin/bareos-dir \ - -- ${DIR_OPTIONS} - # harden pid file until #631598 is resolved - ewaitfile 10 /run/bareos/bareos-dir.9101.pid - chown root:bareos /run/bareos/bareos-dir.9101.pid - eend $? -} - -stop() { - ebegin "Stopping bareos director" - # check pid file until #631598 is resolved - if [[ $(stat -c %U /run/bareos/bareos-dir.9101.pid) != "root" ]]; then - eerror "SECURITY ALERT: pid file is not root owned anymore?! (see #631598)" - else - start-stop-daemon --stop --quiet --pidfile /run/bareos/bareos-dir.9101.pid - fi - eend $? -} diff --git a/app-backup/bareos/files/bareos-dir.service b/app-backup/bareos/files/bareos-dir.service deleted file mode 100644 index f0a611715487..000000000000 --- a/app-backup/bareos/files/bareos-dir.service +++ /dev/null @@ -1,30 +0,0 @@ -# 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 mysql.service mariadb.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 -#Restart=on-failure - -[Install] -Alias=bareos-director.service -WantedBy=multi-user.target 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-21.initd b/app-backup/bareos/files/bareos-fd-21.initd deleted file mode 100644 index f0632261a0c5..000000000000 --- a/app-backup/bareos/files/bareos-fd-21.initd +++ /dev/null @@ -1,21 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -depend() { - use dns -} - -start() { - ebegin "Starting bareos file daemon" - checkpath -d -m 0750 -o root:bareos /run/bareos - start-stop-daemon --start --quiet --exec /usr/sbin/bareos-fd \ - -- -p /run/bareos/bareos-fd.9102.pid ${FD_OPTIONS} - eend $? -} - -stop() { - ebegin "Stopping bareos file daemon" - start-stop-daemon --stop --quiet --pidfile /run/bareos/bareos-fd.9102.pid - eend $? -} diff --git a/app-backup/bareos/files/bareos-fd.confd b/app-backup/bareos/files/bareos-fd.confd deleted file mode 100644 index 5e429a6bd31c..000000000000 --- a/app-backup/bareos/files/bareos-fd.confd +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright 1999-2019 Gentoo Authors -# 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 e65e6c80f32b..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 -o root:bareos /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-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-21.initd b/app-backup/bareos/files/bareos-sd-21.initd deleted file mode 100644 index 07091dbd74c5..000000000000 --- a/app-backup/bareos/files/bareos-sd-21.initd +++ /dev/null @@ -1,21 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2022 Gentoo Authors -# 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 root:bareos /run/bareos - start-stop-daemon --start --quiet --exec /usr/sbin/bareos-sd \ - -- -p /run/bareos/bareos-sd.9103.pid ${SD_OPTIONS} - eend $? -} - -stop() { - ebegin "Stopping bareos storage daemon" - start-stop-daemon --stop --quiet --pidfile /run/bareos/bareos-sd.9103.pid - eend $? -} diff --git a/app-backup/bareos/files/bareos-sd.confd b/app-backup/bareos/files/bareos-sd.confd deleted file mode 100644 index d0153b2b30b5..000000000000 --- a/app-backup/bareos/files/bareos-sd.confd +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 1999-2019 Gentoo Authors -# 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 bareos -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 97b9ccdc92f1..000000000000 --- a/app-backup/bareos/files/bareos-sd.initd +++ /dev/null @@ -1,30 +0,0 @@ -#!/sbin/openrc-run -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -depend() { - use dns -} - -start() { - ebegin "Starting bareos storage daemon" - # g+w until #631598 is resolved - checkpath -d -m 0770 -o root:bareos /run/bareos - start-stop-daemon --start --quiet --exec /usr/sbin/bareos-sd \ - -- ${SD_OPTIONS} - # harden pid file until #631598 is resolved - ewaitfile 10 /run/bareos/bareos-sd.9103.pid - chown root:bareos /run/bareos/bareos-sd.9103.pid - eend $? -} - -stop() { - ebegin "Stopping bareos storage daemon" - # check pid file until #631598 is resolved - if [[ $(stat -c %U /run/bareos/bareos-sd.9103.pid) != "root" ]]; then - eerror "SECURITY ALERT: pid file is not root owned anymore?! (see #631598)" - else - start-stop-daemon --stop --quiet --pidfile /run/bareos/bareos-sd.9103.pid - fi - eend $? -} diff --git a/app-backup/bareos/metadata.xml b/app-backup/bareos/metadata.xml index 74fcd0331c3a..bc08ba42ba52 100644 --- a/app-backup/bareos/metadata.xml +++ b/app-backup/bareos/metadata.xml @@ -6,13 +6,12 @@ <name>Marc Schiffbauer</name> </maintainer> <use> - <flag name="ceph">Enable ceph support</flag> + <flag name="ceph">Enable <pkg>sys-cluster/ceph</pkg> support</flag> <flag name="clientonly">Only install file-daemon (client)</flag> <flag name="director">Install director</flag> - <flag name="glusterfs">Enable glusterfs storage backend</flag> - <flag name="jansson">JSON API support using JANSSON for director</flag> - <flag name="lmdb">enable build of LMDB support for faster accurate backup</flag> - <flag name="logwatch">Install support files for logwatch</flag> + <flag name="glusterfs">Enable <pkg>sys-cluster/glusterfs</pkg> storage backend</flag> + <flag name="lmdb">enable build of <pkg>dev-db/lmdb</pkg> support for faster accurate backup</flag> + <flag name="logwatch">Install support files for <pkg>sys-apps/logwatch</pkg></flag> <flag name="ndmp">Enable support for NDMP (Network Data Management Protocol)</flag> <flag name="scsi-crypto">Enable low level SCSI crypto support</flag> <flag name="storage-daemon">Install storage daemon (bareos-sd)</flag> |