# Maintainer: Michael Spradling # Contributor: Daniel Albers pkgver=16.2.5 _pkgver=16.2.5 pkgrel=2 arch=(i686 x86_64) groups=('bareos') pkgdesc="Bareos - Backup Archiving REcovery Open Sourced" url="http://www.bareos.org" license=('AGPL3') makedepends=('sqlite3' 'libmariadbclient' 'postgresql-libs' 'lzo' 'acl' 'libcap' 'python2' 'python') optdepends=('openssl: network encryption between daemons') _instdir="${startdir}/install" _pkgsrc="${startdir}/src/bareos" _configure_args="--prefix=/usr \ --with-sbin-perm=755 \ --libdir=/usr/lib/bareos \ --sysconfdir=/etc \ --with-confdir=/etc/bareos \ --with-archivedir=/var/lib/bareos/storage \ --with-backenddir=/usr/lib/bareos/backends \ --with-configtemplatedir="" \ --with-scriptdir=/usr/lib/bareos/scripts \ --with-plugindir=/usr/lib/bareos/plugins \ --with-working-dir=/var/lib/bareos \ --with-pid-dir=/var/lib/bareos \ --with-bsrdir=/var/lib/bareos \ --with-logdir=/var/log/bareos \ --with-subsys-dir=/var/lock \ --enable-smartalloc \ --disable-conio \ --enable-readline \ --enable-batch-insert \ --enable-dynamic-debian-package-list \ --enable-dynamic-cats-backends \ --enable-dynamic-storage-backends \ --enable-acl \ --enable-ndmp \ --enable-xattr \ --enable-scsi-crypto \ --enable-lmdb \ --enable-ndmp \ --enable-ipv6 \ --with-postgresql \ --with-mysql \ --with-sqlite3 \ --with-openssl \ --with-python \ --enable-includes \ --disable-rpath \ --with-systemd=/usr/lib/systemd/system \ --with-dir-user=bareos \ --with-dir-group=bareos \ --with-sd-user=bareos \ --with-sd-group=bareos \ --with-fd-user=root \ --with-fd-group=root" prepare() { # bareos must use python2 cd "${_pkgsrc}" sed -i "s/python-config/python2-config/g" configure } build() { # bug: openssl 1.0 isue export CFLAGS="${CFLAGS} -L /usr/include/openssl-1.0" export LIBS="${LIBS} -I /usr/include/openssl-1.0" pushd "${_pkgsrc}" &> /dev/null QMAKE="/usr/bin/qmake-qt4" DISTNAME="debian" ./configure $_configure_args make DESTDIR="$_instdir" install popd &> /dev/null } _install_files() { pushd $_instdir &> /dev/null # Create files while read line do # Don't expand globs yet, or it might be an old version set -f first=$(echo $line | sed 's,\([^ ]*\).*,\1,g') # First param second=$(echo $line | sed 's,[^ ]*\(.*\),\1,g') # Second Param file=$(basename $first) # File set +f # Skip example files. they don't exist if [[ $file == *".conf.example" ]]; then continue fi #TODO: BUG 16.5 seems to have this in an install dir but doesn't build them if [[ $file == *"ndmp"*.so ]]; then continue fi if [[ $second == "" ]]; then pushd $_instdir &> /dev/null set -f srcpath=$(dirname $first) srcpath=${srcpath#/} set +f cp -a --parents $srcpath/$file $pkgdir else destpath=${pkgdir}$(dirname $first) mkdir -p $destpath second=${second#' '} # Remove leading space from sed match # Handle files that have a ? in them rename to '.' # this only works if space files are also not paired with wildcards if [[ $file == *"?"* ]]; then newfile=${file//\?/.} file=${file//\?/\ } # Contains a space, rename to '.' cp -a "${_pkgsrc}/src/defaultconfigs${second}${file}" $destpath/${newfile} else # No space, but may have wild cards cp -a ${_pkgsrc}/src/defaultconfigs${second}${file} $destpath fi fi done < ${_pkgsrc}/debian/$1.install mv "${pkgdir}/usr/sbin" "${pkgdir}/usr/bin" &> /dev/null || true popd &> /dev/null } _etc_files() { pushd $_instdir &> /dev/null if [ ! -e "${_pkgsrc}/debian/$1" ]; then return fi while read file do file=$(echo $file | sed 's,\([^ ]*\).*,\1,g') # Remove second param, if exists file=${file:1:${#file}-1} # Remove leading / file=${file//\?/.} # Convert ? to . file=${file//\*/} # Drop wildcards, pacman doesn't support them for BACKUP. Also there is only one at the moment # Skip example files. they don't exist if [[ "$file" == *".conf.example" ]]; then continue fi if [[ "$file" =~ "etc" ]]; then out="${file} $out" fi done < ${_pkgsrc}/debian/$1 popd &> /dev/null echo $out } package_bareos-bat() { pkgdesc="${pkgdesc} - Admin Tool (GUI)" depends=("bareos-common=$pkgver" "qt4") makedepends+=('qt4') backup=(`_etc_files ${pkgname}.install`) install=bareos-bat.install _install_files ${pkgname} } package_bareos-bconsole() { pkgdesc="${pkgdesc} - Admin Tool (CLI)" depends=("bareos-common=$pkgver") groups+=('bareos-client') backup=(`_etc_files ${pkgname}.install`) install=bareos-bconsole.install _install_files ${pkgname} } package_bareos-common() { pkgdesc="${pkgdesc} - Common files" backup=(`_etc_files ${pkgname}.install`) install=bareos-common.install _install_files ${pkgname} } package_bareos-database-common() { pkgdesc="${pkgdesc} - Generic abstration libs and tools for sql catalog" depends=("bareos-common=$pkgver" "bareos-database-tools=$pkgver") backup=(`_etc_files ${pkgname}.install`) _install_files ${pkgname} } package_bareos-database-mysql() { pkgdesc="${pkgdesc} - Libs and tools for mysql catalog" provides=("bareos-database=$pkgver") depends=("bareos-database-common=$pkgver" "libmariadbclient") backup=(`_etc_files ${pkgname}.install`) install=bareos-database-mysql.install _install_files ${pkgname} } package_bareos-database-postgresql() { pkgdesc="${pkgdesc} - Libs and tools for postgresql catalog" provides=("bareos-database=$pkgver") depends=("bareos-database-common=$pkgver" "postgresql-libs") backup=(`_etc_files ${pkgname}.install`) _install_files ${pkgname} } package_bareos-database-sqlite3() { pkgdesc="${pkgdesc} - Libs and tools for sqlite3 catalog" provides=("bareos-database=$pkgver") depends=("bareos-database-common=$pkgver" "sqlite3") backup=(`_etc_files ${pkgname}.install`) _install_files ${pkgname} } package_bareos-database-tools() { pkgdesc="${pkgdesc} - CLI tools with database dpendencies (dbcheck, bscan)" backup=(`_etc_files ${pkgname}.install`) _install_files ${pkgname} } package_bareos-devel() { pkgdesc="${pkgdesc} - Devel headers" backup=(`_etc_files ${pkgname}.install`) _install_files ${pkgname} } package_bareos-director() { pkgdesc="${pkgdesc} - Director daemon" depends=("bareos-common=$pkgver") backup=(`_etc_files ${pkgname}.install`) install=bareos-director.install _install_files ${pkgname} # Install systemd service mkdir -p ${pkgdir}/usr/lib/systemd/system cp ${_pkgsrc}/platforms/systemd/bareos-dir.service ${pkgdir}/usr/lib/systemd/system/ } package_bareos-director-python-plugin() { pkgdesc="${pkgdesc} - Python plugin for director daemon" depends=("bareos-director=$pkgver" "python2" "python") backup=(`_etc_files ${pkgname}.install`) _install_files ${pkgname} } package_bareos-filedaemon() { pkgdesc="${pkgdesc} - File daemon" depends=("bareos-common=$pkgver") groups+=('bareos-client') backup=(`_etc_files ${pkgname}.install`) install=bareos-filedaemon.install _install_files ${pkgname} # Install systemd service mkdir -p ${pkgdir}/usr/lib/systemd/system cp ${_pkgsrc}/platforms/systemd/bareos-fd.service ${pkgdir}/usr/lib/systemd/system/ } package_bareos-filedaemon-python-plugin() { pkgdesc="${pkgdesc} - Python plugin for file daemon" depends=("bareos-filedaemon=$pkgver" "python2" "python") backup=(`_etc_files ${pkgname}.install`) _install_files ${pkgname} } package_bareos-storage() { pkgdesc="${pkgdesc} - Storage daemon" optdepends+=('lzo2: LZO compression for Storage Daemon') depends=("bareos-common=$pkgver") backup=(`_etc_files ${pkgname}.install`) install=bareos-storage.install _install_files ${pkgname} # Install systemd service mkdir -p ${pkgdir}/usr/lib/systemd/system cp ${_pkgsrc}/platforms/systemd/bareos-sd.service ${pkgdir}/usr/lib/systemd/system/ } package_bareos-storage-fifo() { pkgdesc="${pkgdesc} - FIFO support for storage daemon" depends=("bareos-storage=$pkgver") backup=(`_etc_files ${pkgname}.install`) _install_files ${pkgname} } package_bareos-storage-python-plugin() { pkgdesc="${pkgdesc} - Python plugin for storage daemon" depends=("bareos-storage=$pkgver" "python2" "python") backup=(`_etc_files ${pkgname}.install`) _install_files ${pkgname} } package_bareos-storage-tape() { pkgdesc="${pkgdesc} - Tape support for storage daemon" depends=("bareos-storage=$pkgver" "mtx") backup=(`_etc_files ${pkgname}.install`) _install_files ${pkgname} } package_bareos-tools() { pkgdesc="${pkgdesc} - CLI tools (bcopy, bextract, bls, bregeq, bwild)" depends=("bareos-common=$pkgver") backup=(`_etc_files ${pkgname}.install`) _install_files ${pkgname} } package_bareos-traymonitor() { pkgdesc="${pkgdesc} - Tray Monitor (QT)" depends=("bareos-common=$pkgver" "qt4") makedepends+=('qt4') backup=(`_etc_files ${pkgname}.install`) install=bareos-traymonitor.install _install_files ${pkgname} }