diff options
Diffstat (limited to 'app-backup/bareos')
33 files changed, 1915 insertions, 831 deletions
diff --git a/app-backup/bareos/Manifest b/app-backup/bareos/Manifest index d0024070cfb3..8206ffaf50c5 100644 --- a/app-backup/bareos/Manifest +++ b/app-backup/bareos/Manifest @@ -1,3 +1,4 @@ -DIST bareos-17.2.10.tar.gz 4190783 BLAKE2B d2deb9368438b5281ea36768b80cc15840135a77a19952daa895c4e30ee6ad231d9ecf28a6d860bd372eb08c1c34f9f827843745c87f465d3a59ab048aecc001 SHA512 3e145627a08927790deb8f75e5167e6e69710733eb1866a93adb34617c274c2b51145a6b1253388784f67bc4886fec7fbb423893a36d377bb96334a2dc7768f2 -DIST bareos-18.2.9.tar.gz 10554581 BLAKE2B 1277956a87794e707050c119a0e2d6a879f47bd67bde7fa230796b6f9a8c0b6ca1cddf35f12b6e53d0841f6cfbb86c586157b9705d36c515adaf1021bb23edc1 SHA512 f40c0bc696f31ee4eb443cc7a76a5810620a2fbb5fa421afc580e047879ce86b1288de92679695e00074a3bfd5a5ac2a4cb4fb8f8acbb39e615df19ad9cf7934 -DIST bareos-19.2.8.tar.gz 12604929 BLAKE2B c3af2d0a62b861a4ad5ca5c115a2039356009b7524505e1beb9004636fd09dd2b6ca784a5aae8c1cec3db518fb047cde429c469b8298a6bb473b097012358302 SHA512 60bbbbd949a63f978cf1ed7d0cfc22c22f117d8c2700eb47531e15b2d91fc700c522519f0b816cd1040283f09b4c81f36910c66c8b6f4bf1ff22180e979bdeb5 +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-17.2.10.ebuild b/app-backup/bareos/bareos-17.2.10.ebuild deleted file mode 100644 index f4a2b487a99f..000000000000 --- a/app-backup/bareos/bareos-17.2.10.ebuild +++ /dev/null @@ -1,360 +0,0 @@ -# Copyright 1999-2020 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI="7" - -inherit desktop systemd - -DESCRIPTION="Featureful client/server network backup suite" -HOMEPAGE="http://www.bareos.org/" -SRC_URI="https://github.com/${PN}/${PN}/archive/Release/${PV}.tar.gz -> ${P}.tar.gz" -RESTRICT="mirror" - -LICENSE="AGPL-3" -SLOT="0" -KEYWORDS="~amd64 ~x86" -IUSE="X acl cephfs clientonly +director fastlz glusterfs gnutls ipv6 jansson lmdb libressl - logwatch mysql ndmp +postgres rados rados-striper readline scsi-crypto - sql-pooling sqlite ssl static +storage-daemon tcpd vim-syntax" -REQUIRED_USE="!clientonly? ( || ( mysql postgres sqlite ) )" - -DEPEND=" - !app-backup/bacula - acct-group/${PN} - cephfs? ( sys-cluster/ceph ) - rados? ( sys-cluster/ceph ) - rados-striper? ( >=sys-cluster/ceph-0.94.2 ) - glusterfs? ( sys-cluster/glusterfs ) - lmdb? ( dev-db/lmdb ) - dev-libs/gmp:0 - !clientonly? ( - acct-user/${PN} - postgres? ( dev-db/postgresql:*[threads] ) - mysql? ( dev-db/mysql-connector-c:0= ) - sqlite? ( dev-db/sqlite:3 ) - director? ( - virtual/mta - jansson? ( dev-libs/jansson ) - ) - ) - fastlz? ( dev-libs/bareos-fastlzlib ) - logwatch? ( sys-apps/logwatch ) - tcpd? ( sys-apps/tcp-wrappers ) - readline? ( sys-libs/readline:0 ) - static? ( - acl? ( virtual/acl[static-libs] ) - sys-libs/zlib[static-libs] - dev-libs/lzo[static-libs] - sys-libs/ncurses:=[static-libs] - ssl? ( - !gnutls? ( - !libressl? ( dev-libs/openssl:0=[static-libs] ) - libressl? ( dev-libs/libressl:0=[static-libs] ) - ) - gnutls? ( net-libs/gnutls[static-libs] ) - ) - ) - !static? ( - acl? ( virtual/acl ) - dev-libs/lzo - ssl? ( - !gnutls? ( - !libressl? ( dev-libs/openssl:0= ) - libressl? ( dev-libs/libressl:0= ) - ) - gnutls? ( net-libs/gnutls ) - ) - sys-libs/ncurses:= - sys-libs/zlib - ) - " -RDEPEND="${DEPEND} - !clientonly? ( - storage-daemon? ( - sys-block/mtx - app-arch/mt-st - ) - ) - vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" - -REQUIRED_USE="static? ( clientonly )" - -S=${WORKDIR}/${PN}-Release-${PV} - -pkg_setup() { - use mysql && export mydbtypes+="mysql" - use postgres && export mydbtypes+=" postgresql" - use sqlite && export mydbtypes+=" sqlite" -} - -src_prepare() { - # adjusts default configuration files for several binaries - # to /etc/bareos/<config> instead of ./<config> - pushd src >&/dev/null || die - for f in console/console.c dird/dird.c filed/filed.c \ - stored/bcopy.c stored/bextract.c stored/bls.c \ - stored/bscan.c stored/btape.c stored/stored.c; do - sed -i -e 's|^\(#define CONFIG_FILE "\)|\1/etc/bareos/|g' "${f}" \ - || die "sed on ${f} failed" - done - popd >&/dev/null || die - - # enables default database driver in catalog - pushd src/defaultconfigs/bareos-dir.d/catalog >&/dev/null || die - sed -i -e 's/#dbdriver/dbdriver/' -e '/XXX_REPLACE/d' MyCatalog.conf.in \ - || die "sed on MyCatalog.conf.in failed" - popd >&/dev/null || die - - # bug 466690 Use CXXFLAGS instead of CFLAGS - sed -i -e 's/@CFLAGS@/@CXXFLAGS@/' autoconf/Make.common.in || die - - # do not strip binaries - for d in filed console dird stored; do - sed -i -e "s/strip /# strip /" src/$d/Makefile.in || die - done - - eapply_user -} - -src_configure() { - local myconf='' - - addpredict /var/lib/logrotate.status - - if use clientonly; then - myconf="${myconf} \ - $(use_enable clientonly client-only) \ - $(use_enable !static libtool) \ - $(use_enable static static-cons) \ - $(use_enable static static-fd)" - fi - - myconf="${myconf} \ - $(use_with X x) \ - $(use_enable acl) \ - $(use_enable ipv6) \ - $(use_enable ndmp) \ - $(use_enable readline) \ - $(use_enable !readline conio) \ - $(use_enable scsi-crypto) \ - $(use_enable sql-pooling) \ - $(use_with fastlz) \ - $(use_with mysql) \ - $(use_with postgres postgresql) \ - $(use_with readline) \ - $(use_with sqlite sqlite3) \ - $(use sqlite || echo "--without-sqlite3") \ - $(use_with ssl openssl) \ - $(use_with tcpd tcp-wrappers) \ - $(use_enable lmdb) \ - $(use_with glusterfs) \ - $(use_with rados) \ - $(use_with rados-striper) \ - $(use_with cephfs) \ - $(use_with jansson) \ - " - - econf \ - --without-python \ - --with-pid-dir=/run/bareos \ - --with-subsys-dir=/run/lock/subsys \ - --with-working-dir=/var/lib/bareos \ - --with-logdir=/var/log/bareos \ - --with-scriptdir=/usr/libexec/bareos \ - --with-plugindir=/usr/$(get_libdir)/${PN}/plugin \ - --with-backenddir=/usr/$(get_libdir)/${PN}/backend \ - --with-dir-user=bareos \ - --with-dir-group=bareos \ - --with-sd-user=root \ - --with-sd-group=bareos \ - --with-fd-user=root \ - --with-fd-group=bareos \ - --with-sbin-perm=0755 \ - --with-systemd \ - --with-db-password=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1` \ - --enable-dynamic-cats-backends \ - --enable-dynamic-storage-backends \ - --enable-batch-insert \ - --disable-afs \ - --host=${CHOST} \ - ${myconf} -} - -src_compile() { - # Make build log verbose (bug #447806) - emake NO_ECHO="" -} - -src_install() { - emake DESTDIR="${D}" install - newicon src/images/bareos_logo_shadow.png bareos.png - - # 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/sbin/bareos - - # remove upstream init scripts - rm -f "${D}"/etc/init.d/bareos-* - - # 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}"/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}"/scripts/logwatch >&/dev/null || die - emake DESTDIR="${D}" install - 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 - use ndmp && dodoc README.NDMP - use scsi-crypto && dodoc README.scsicrypto - - # vim-files - if use vim-syntax; then - insinto /usr/share/vim/vimfiles/syntax - doins scripts/bareos.vim - insinto /usr/share/vim/vimfiles/ftdetect - newins scripts/filetype.vim bareos_ft.vim - fi - - # setup init scripts - myscripts="bareos-fd" - if ! use clientonly; then - if use director; then - myscripts="${myscripts} bareos-dir" - fi - if use storage-daemon; then - myscripts="${myscripts} bareos-sd" - 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-16 "${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}" - done - - # install systemd unit files - use director && systemd_dounit "${FILESDIR}"/bareos-dir.service - use storage-daemon && systemd_dounit "${FILESDIR}"/bareos-sd.service - systemd_dounit "${FILESDIR}"/bareos-fd.service - - # make sure the working directory exists - diropts -m0750 - keepdir /var/lib/bareos - - # make sure bareos group can execute bareos libexec scripts - fowners -R root:bareos /usr/libexec/bareos -} - -pkg_postinst() { - 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:" - 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 - 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 - einfo "It is strongly recommended to use either postgresql or mysql as" - einfo "catalog database backend." - einfo - fi -} diff --git a/app-backup/bareos/bareos-19.2.8.ebuild b/app-backup/bareos/bareos-21.1.8-r1.ebuild index beb2d8324673..c1553eece5eb 100644 --- a/app-backup/bareos/bareos-19.2.8.ebuild +++ b/app-backup/bareos/bareos-21.1.8-r1.ebuild @@ -1,25 +1,31 @@ -# Copyright 1999-2020 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_{6,7,8,9} ) +PYTHON_COMPAT=( python3_{9..12} ) CMAKE_WARN_UNUSED_CLI=no #CMAKE_REMOVE_MODULES=yes -inherit python-any-r1 systemd cmake +inherit python-any-r1 systemd cmake tmpfiles 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 libressl - logwatch mysql ndmp +postgres readline scsi-crypto - sqlite static +storage-daemon systemd tcpd vim-syntax 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,30 +39,28 @@ 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 ) + ndmp? ( net-libs/rpcsvc-proto ) tcpd? ( sys-apps/tcp-wrappers ) 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] + dev-libs/openssl:0=[static-libs] sys-libs/ncurses:=[static-libs] - !libressl? ( dev-libs/openssl:0=[static-libs] ) - libressl? ( dev-libs/libressl:0=[static-libs] ) + sys-libs/zlib[static-libs] ) !static? ( acl? ( virtual/acl ) + dev-libs/jansson:= dev-libs/lzo - !libressl? ( dev-libs/openssl:0= ) - libressl? ( dev-libs/libressl:0= ) + dev-libs/openssl:0= sys-libs/ncurses:= sys-libs/zlib ) @@ -70,52 +74,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} -src_prepare() { - use mysql && export mydbtypes+=( mysql ) - use postgres && export mydbtypes+=( postgresql ) - use sqlite && export mydbtypes+=( sqlite ) +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}" - # 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 gentoo platform support + 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" - # 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+=( @@ -126,20 +167,19 @@ src_configure() { fi for useflag in acl ipv6 ndmp scsi-crypto \ - systemd mysql lmdb; do + systemd lmdb; do mycmakeargs+=( -D$useflag=$(usex $useflag) ) done mycmakeargs+=( -DHAVE_PYTHON=0 - -DDEFAULT_DB_TYPE=${mydbtypes[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=yes + -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`" @@ -159,24 +199,25 @@ 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) ) + # 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 } @@ -184,11 +225,31 @@ 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 - rm -f "${D}"/etc/init.d/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 @@ -234,9 +295,6 @@ src_install() { rm -vf "${D}"/usr/share/man/man1/bareos-bwxconsole.1* if use clientonly || ! use director; then - if use systemd; then - rm -vf "${D}"/lib/systemd/system/bareos-dir.service - fi 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* @@ -252,9 +310,6 @@ src_install() { rm -vf "${D}"/usr/libexec/bareos/*_catalog_backup fi if use clientonly || ! use storage-daemon; then - if use systemd; then - rm -vf "${D}"/lib/systemd/system/bareos-sd.service - fi 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* @@ -296,32 +351,18 @@ 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 core/platforms/systemd/bareos-dir.service - use storage-daemon && systemd_dounit core/platforms/systemd/bareos-sd.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 core/platforms/systemd/bareos-fd.service + systemd_dounit "${FILESDIR}"/bareos-fd.service fi # make sure the working directory exists @@ -329,17 +370,21 @@ 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 - insinto /usr/lib/tmpfiles.d - newins "${FILESDIR}"/tmpfiles.d-bareos.conf bareos.conf + 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 @@ -349,37 +394,21 @@ 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 "Be aware that Bareos does not officially support SQLite database." - einfo "Best use it only for a client-only installation. See Bug #445540." + einfo "or run" einfo - einfo "It is strongly recommended to use either postgresql or mysql as" - einfo "catalog database backend." + 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-18.2.9.ebuild b/app-backup/bareos/bareos-22.1.2-r1.ebuild index cf1622b6e1ad..d61de65c0fc7 100644 --- a/app-backup/bareos/bareos-18.2.9.ebuild +++ b/app-backup/bareos/bareos-22.1.2-r1.ebuild @@ -1,75 +1,79 @@ -# Copyright 1999-2020 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_{9..12} ) CMAKE_WARN_UNUSED_CLI=no -#CMAKE_REMOVE_MODULES=yes -inherit desktop systemd cmake +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="http://www.bareos.org/" -SRC_URI="https://github.com/${PN}/${PN}/archive/Release/${PV}.tar.gz -> ${P}.tar.gz" -RESTRICT="mirror" +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" -KEYWORDS="~amd64 ~x86" -IUSE="X acl cephfs clientonly +director fastlz glusterfs gnutls ipv6 jansson lmdb libressl - logwatch mysql ndmp +postgres rados rados-striper readline scsi-crypto - sql-pooling sqlite ssl static +storage-daemon systemd tcpd vim-syntax" -REQUIRED_USE="!clientonly? ( || ( mysql postgres sqlite ) )" +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=" !app-backup/bacula acct-group/${PN} - cephfs? ( sys-cluster/ceph ) - rados? ( sys-cluster/ceph ) - rados-striper? ( >=sys-cluster/ceph-0.94.2 ) + !x86? ( + ceph? ( sys-cluster/ceph ) + ) glusterfs? ( sys-cluster/glusterfs ) lmdb? ( dev-db/lmdb ) 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 ) ) ) - fastlz? ( dev-libs/bareos-fastlzlib ) 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] ) - sys-libs/zlib[static-libs] + dev-libs/jansson:=[static-libs] dev-libs/lzo[static-libs] + dev-libs/openssl:0=[static-libs] sys-libs/ncurses:=[static-libs] - ssl? ( - !gnutls? ( - !libressl? ( dev-libs/openssl:0=[static-libs] ) - libressl? ( dev-libs/libressl:0=[static-libs] ) - ) - gnutls? ( net-libs/gnutls[static-libs] ) - ) + sys-libs/zlib[static-libs] ) !static? ( acl? ( virtual/acl ) + dev-libs/jansson:= dev-libs/lzo - ssl? ( - !gnutls? ( - !libressl? ( dev-libs/openssl:0= ) - libressl? ( dev-libs/libressl:0= ) - ) - gnutls? ( net-libs/gnutls ) - ) + dev-libs/openssl:0= sys-libs/ncurses:= sys-libs/zlib ) + X? ( + dev-qt/qtwidgets:5= + ) " RDEPEND="${DEPEND} !clientonly? ( @@ -78,132 +82,187 @@ RDEPEND="${DEPEND} app-arch/mt-st ) ) - vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" - -REQUIRED_USE="static? ( clientonly )" + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) ) + " -S=${WORKDIR}/${PN}-Release-${PV} +BDEPEND=" + ${PYTHON_DEPS} + test? ( + dev-cpp/gtest + dev-db/postgresql:*[server,threads(+)] + dev-db/mariadb:*[server] + ) +" + +REQUIRED_USE=" + static? ( clientonly ) + x86? ( !ceph ) +" + +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_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 - eapply -p0 "${FILESDIR}/bareos-cmake-rados.patch" + default + cmake_src_test - # fix gentoo version detection - eapply -p0 "${FILESDIR}/bareos-cmake-gentoo.patch" + pg_ctl -w -D "${T}"/pgsql stop || die + rm -rvf "${T}"/pgsql +} +src_prepare() { # fix missing DESTDIR in symlink creation - eapply -p2 "${FILESDIR}/bareos-cmake-symlink-default-db-backend.patch" - - # disable dird and stored plugins, because of - # py2 dependency - cd "${S}/core/src/plugins" - cmake_comment_add_subdirectory filed - cmake_comment_add_subdirectory dird - cmake_comment_add_subdirectory stored - cd - - - eapply_user + sed -i '/bareos-symlink-default-db-backend.cmake/d' "${S}/core/src/cats/CMakeLists.txt" - 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+=( - -Dclient-only=YES + -Dclient-only=ON -Dstatic-cons=$(usex static) -Dstatic-fd=$(usex static) ) fi - for useflag in acl ipv6 ndmp readline scsi-crypto sql-pooling \ - systemd fastlz mysql lmdb glusterfs rados \ - rados-striper cephfs jansson; do - + 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+=( - -DDEFAULT_DB_TYPE=${mydbtypes[0]} - -Dx=$(usex X) - -Dpostgresql=$(usex postgres) - -Dmysql=$(usex mysql) - -Dsqlite3=$(usex sqlite) - -Dopenssl=$(usex ssl) - -Dtcp-wrapper=$(usex tcpd) - -Dlibdir=/usr/$(get_libdir) - -Dsbindir=/usr/sbin - -Dmandir=/usr/share/man - -Ddocdir=/usr/share/doc/${PF} - -Dhtmldir=/usr/share/doc/${PF}/html + -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 - -Dpiddir=/run/bareos - -Dsysconfdir=/etc -Dconfdir=/etc/bareos - -Dsubsys-dir=/run/lock/subsys - -Dworkingdir=/var/lib/bareos - -Dlogdir=/var/log/bareos - -Dscriptdir=/usr/libexec/bareos - -Dplugindir=/usr/$(get_libdir)/${PN}/plugin - -Dbackenddir=/usr/$(get_libdir)/${PN}/backend - -Ddir-user=bareos - -Ddir-group=bareos - -Dsd-user=root - -Dsd-group=bareos - -Dfd-user=root - -Dfd-group=bareos - -Dsbin-perm=0755 + -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 - -Dbatch-insert=yes - -Dhost=${CHOST} - -Dcoverage=yes - -Dpython=no - -Dsmartalloc=yes - -Ddir-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" + -Dfd-group=bareos -Dfd-password="`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`" - -Dsd-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`" - -Dbasename="`hostname -s`" - -Dhostname="`hostname -s`" + -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) ) + # 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() { - #emake DESTDIR="${D}" install cmake_src_install - newicon core/src/images/bareos_logo_shadow.png bareos.png # 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 - rm -f "${D}"/etc/init.d/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 @@ -249,9 +308,6 @@ src_install() { rm -vf "${D}"/usr/share/man/man1/bareos-bwxconsole.1* if use clientonly || ! use director; then - if use systemd; then - rm -vf "${D}"/lib/systemd/system/bareos-dir.service - fi 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* @@ -267,9 +323,6 @@ src_install() { rm -vf "${D}"/usr/libexec/bareos/*_catalog_backup fi if use clientonly || ! use storage-daemon; then - if use systemd; then - rm -vf "${D}"/lib/systemd/system/bareos-sd.service - fi 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* @@ -311,32 +364,18 @@ 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 core/platforms/systemd/bareos-dir.service - use storage-daemon && systemd_dounit core/platforms/systemd/bareos-sd.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 core/platforms/systemd/bareos-fd.service + systemd_dounit "${FILESDIR}"/bareos-fd.service fi # make sure the working directory exists @@ -344,14 +383,21 @@ 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 + # 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 @@ -361,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 "Be aware that Bareos does not officially support SQLite database." - einfo "Best use it only for a client-only installation. See Bug #445540." + einfo "or run" einfo - einfo "It is strongly recommended to use either postgresql or mysql as" - einfo "catalog database backend." + 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-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-23.0.2.ebuild b/app-backup/bareos/bareos-23.0.2.ebuild new file mode 100644 index 000000000000..f88f46187fe6 --- /dev/null +++ b/app-backup/bareos/bareos-23.0.2.ebuild @@ -0,0 +1,435 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..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" +) + +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-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-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 - diff --git a/app-backup/bareos/metadata.xml b/app-backup/bareos/metadata.xml index bc44d44732b3..bc08ba42ba52 100644 --- a/app-backup/bareos/metadata.xml +++ b/app-backup/bareos/metadata.xml @@ -1,27 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> <pkgmetadata> <maintainer type="person"> <email>mschiff@gentoo.org</email> <name>Marc Schiffbauer</name> </maintainer> <use> - <flag name="cephfs">Enable cephfs storage backend</flag> - <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="fastlz">Enable support vor lz4, lz4hc and lzfast using dev-libs/bareos-fastlzlib</flag> - <flag name="glusterfs">Enable glusterfs storage backend</flag> - <flag name="gnutls">When ssl is enabled, use GnuTLS instead of OpenSSL</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="rados">Enable rados storage backend</flag> - <flag name="rados-striper">Enable use of rados-striper</flag> <flag name="scsi-crypto">Enable low level SCSI crypto support</flag> - <flag name="sql-pooling">Enable SQL pooling support</flag> <flag name="storage-daemon">Install storage daemon (bareos-sd)</flag> + <flag name="vmware">Enable bareos-fd VMware plugin</flag> </use> <upstream> <remote-id type="github">bareos/bareos</remote-id> |