diff options
author | Marc Schiffbauer <mschiff@gentoo.org> | 2022-02-01 00:01:53 -1000 |
---|---|---|
committer | Marc Schiffbauer <mschiff@gentoo.org> | 2022-02-01 00:02:18 -1000 |
commit | bb4196df66ab885e344a752b394142c11ae7ea67 (patch) | |
tree | 56ec29cd170f9f2bb2bf29035acba12671442a1a /app-backup/bareos | |
parent | dev-ml/parmap: 1.2.4 bump (diff) | |
download | gentoo-bb4196df66ab885e344a752b394142c11ae7ea67.tar.gz gentoo-bb4196df66ab885e344a752b394142c11ae7ea67.tar.bz2 gentoo-bb4196df66ab885e344a752b394142c11ae7ea67.zip |
app-backup/bareos: add 21.0.0
Closes: https://bugs.gentoo.org/830682
Signed-off-by: Marc Schiffbauer <mschiff@gentoo.org>
Diffstat (limited to 'app-backup/bareos')
-rw-r--r-- | app-backup/bareos/Manifest | 1 | ||||
-rw-r--r-- | app-backup/bareos/bareos-21.0.0.ebuild | 358 | ||||
-rw-r--r-- | app-backup/bareos/files/bareos-21-cmake-gentoo.patch | 12 | ||||
-rw-r--r-- | app-backup/bareos/files/bareos-dir-21.confd | 10 | ||||
-rw-r--r-- | app-backup/bareos/files/bareos-dir-21.initd | 31 | ||||
-rw-r--r-- | app-backup/bareos/files/bareos-dir-21.service | 32 |
6 files changed, 444 insertions, 0 deletions
diff --git a/app-backup/bareos/Manifest b/app-backup/bareos/Manifest index 406a45ba107a..b10d1c65a297 100644 --- a/app-backup/bareos/Manifest +++ b/app-backup/bareos/Manifest @@ -1,3 +1,4 @@ DIST bareos-18.2.12.tar.gz 10566403 BLAKE2B 765a5430c495b21edc0c22d6903e23d312b1dc2b94e0d2a4227c10a38be8fe638636cf32a58e8aaf83b389581bf1348b4d27be6886f61180c20496acbd0eb015 SHA512 1d308d3021e8277832ce933fbafdf514bc194a1a2a2d761e66fb26ec2af419d19ae38894a7cb56e036c5af003bf640117b5a11954d478b35e13a02007f99f4de DIST bareos-19.2.11.tar.gz 12890679 BLAKE2B 2872e4eed8186f024211faeefcb5b38448f38d90a2c7c73ef8fa1e51d3a917344a7acbe09a01d0205ad312ec136161eb1b0aa28dcceabbf71d78206a724602b0 SHA512 46769f6e26068669c2656ed8afc73dbd6f07a88d65cf557193684c130bdb93567f3ab06374484be499e5edb7bdd32013edecb05ff19843d3d806a38ca1892749 DIST bareos-20.0.3.tar.gz 13335390 BLAKE2B c35ab9fd290377fc56ae8ff87f54b1cde5d1b7caa89b9c97e259da48da4e07fa85cba38c5a4d461b7ce170f9b14a69f78ad217584abb77ee15d3e85080cbe49b SHA512 3f9bf020e0d519da75221ebd200634713c791e2fdc90a13482ffb3294912d5e2ee28f8338dbef06ba6c98727bae447f6f8bb8d4a06520001f7cefa3614769082 +DIST bareos-21.0.0.tar.gz 11306618 BLAKE2B 0363465c40a8053bb5ec772c18ac0dc852f379979e3afc45dd29c79f8187238363c1f07e2f39d25613404b1b6e253700b33b274389ca2dc4655d201bc4888166 SHA512 0a57bccca0589f3ce8a5664afbeb1eb1b17ec7142722e2d0bb2a0bbd9007688725b39c6db59646c180ce096e55451c09934e6479a2b4deeb4d3ee738ab2c32cd diff --git a/app-backup/bareos/bareos-21.0.0.ebuild b/app-backup/bareos/bareos-21.0.0.ebuild new file mode 100644 index 000000000000..3a2b763a61dd --- /dev/null +++ b/app-backup/bareos/bareos-21.0.0.ebuild @@ -0,0 +1,358 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{8..10} ) +CMAKE_WARN_UNUSED_CLI=no +#CMAKE_REMOVE_MODULES=yes + +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" + +LICENSE="AGPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="X acl ceph clientonly +director glusterfs ipv6 jansson lmdb + logwatch ndmp readline scsi-crypto + static +storage-daemon systemd tcpd 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 + 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/lzo[static-libs] + sys-libs/ncurses:=[static-libs] + dev-libs/openssl:0=[static-libs] + ) + !static? ( + acl? ( virtual/acl ) + dev-libs/lzo + dev-libs/openssl:0= + 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 ) ) + " +BDEPEND="${PYTHON_DEPS}" + +REQUIRED_USE=" + static? ( clientonly ) + x86? ( !ceph ) +" + +S=${WORKDIR}/${PN}-Release-${PV} + +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() { + # fix gentoo platform support + eapply -p1 "${FILESDIR}/${PN}-21-cmake-gentoo.patch" + + # 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 + + 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) + ) + + # 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 + + # 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-21" + fi + if use storage-daemon; then + 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 "${T}/${script}".confd || die "failed to copy ${script}.confd" + cp "${FILESDIR}/${script}".initd "${T}/${script}".initd || die "failed to copy ${script}.initd" + + # install init script and config + newinitd "${T}/${script}".initd "${script/-21/}" + newconfd "${T}/${script}".confd "${script/-21/}" + done + + # install systemd unit files + if use systemd; then + if ! use clientonly; then + use director && systemd_dounit "${FILESDIR}"/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 + + diropts -m0755 + 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 postgresql'" + einfo " su postgres -c '/usr/libexec/bareos/make_bareos_tables postgresql'" + einfo " su postgres -c '/usr/libexec/bareos/grant_bareos_privileges postgresql'" + einfo + fi +} 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-dir-21.confd b/app-backup/bareos/files/bareos-dir-21.confd new file mode 100644 index 000000000000..3ad4b7482f93 --- /dev/null +++ b/app-backup/bareos/files/bareos-dir-21.confd @@ -0,0 +1,10 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# Config file for /etc/init.d/bareos-dir + +# Options for the director daemon. +# The director can be run as a non-root user, however +# please ensure that this user has proper permissions to +# access your backup devices. +DIR_OPTIONS="-u bareos -g bareos" diff --git a/app-backup/bareos/files/bareos-dir-21.initd b/app-backup/bareos/files/bareos-dir-21.initd new file mode 100644 index 000000000000..7100b615105c --- /dev/null +++ b/app-backup/bareos/files/bareos-dir-21.initd @@ -0,0 +1,31 @@ +#!/sbin/openrc-run +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need postgresql + use dns bareos-fd bareos-sd +} + +start() { + ebegin "Starting bareos director" + # g+w until #631598 is resolved + checkpath -d -m 0770 -o root:bareos /run/bareos + start-stop-daemon --start --quiet --exec /usr/sbin/bareos-dir \ + -- ${DIR_OPTIONS} + # harden pid file until #631598 is resolved + ewaitfile 10 /run/bareos/bareos-dir.9101.pid + chown root:bareos /run/bareos/bareos-dir.9101.pid + eend $? +} + +stop() { + ebegin "Stopping bareos director" + # check pid file until #631598 is resolved + if [[ $(stat -c %U /run/bareos/bareos-dir.9101.pid) != "root" ]]; then + eerror "SECURITY ALERT: pid file is not root owned anymore?! (see #631598)" + else + start-stop-daemon --stop --quiet --pidfile /run/bareos/bareos-dir.9101.pid + fi + eend $? +} diff --git a/app-backup/bareos/files/bareos-dir-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 |