Commit 2a055a0e authored by Jakub Jirutka's avatar Jakub Jirutka

main/bacula: improve abuild

parent 60b8d7ad
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname="bacula"
pkgname=bacula
pkgver=7.4.3
pkgrel=0
pkgdesc="Enterprise ready, network based backup program"
......@@ -8,14 +8,13 @@ url="http://www.bacula.org"
arch="all"
license="AGPL3"
depends=""
depends_dev=""
makedepends="$depends_dev autoconf mariadb-dev ncurses-dev openssl-dev
postgresql-dev sqlite-dev zlib-dev lzo-dev"
makedepends="autoconf mariadb-dev ncurses-dev openssl-dev postgresql-dev
sqlite-dev zlib-dev lzo-dev"
install="$pkgname.pre-install $pkgname.post-upgrade"
subpackages="$pkgname-doc $pkgname-mysql $pkgname-pgsql $pkgname-sqlite"
pkgusers="bacula"
pkggroups="bacula"
somask="libbaccats-${pkgver}.so"
somask="libbaccats-$pkgver.so"
source="http://downloads.sourceforge.net/project/$pkgname/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz
bacula-dir-init
bacula-dir-conf
......@@ -25,23 +24,18 @@ source="http://downloads.sourceforge.net/project/$pkgname/$pkgname/$pkgver/$pkgn
bacula-fd-conf
bacula-7.4.0-path-mounted.patch
"
_builddir="$srcdir/$pkgname-$pkgver"
builddir="$srcdir/$pkgname-$pkgver"
prepare () {
cd "$_builddir"
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
default_prepare || return 1
cd "$_builddir"/autoconf
cd "$builddir"/autoconf
autoconf && cp configure ../
}
build() {
cd "$srcdir/$pkgname-$pkgver"
cd "$builddir"
./configure \
--build=$CBUILD \
--host=$CHOST \
......@@ -76,53 +70,62 @@ build() {
}
package() {
cd "$srcdir/$pkgname-$pkgver"
cd "$builddir"
make DESTDIR="$pkgdir" install
for DAEMON in dir sd fd
do
install -Dm755 "$srcdir"/bacula-${DAEMON}-init \
"$pkgdir"/etc/init.d/bacula-${DAEMON}
install -Dm644 "$srcdir"/bacula-${DAEMON}-conf \
"$pkgdir"/etc/conf.d/bacula-${DAEMON}
local daemon; for daemon in dir sd fd; do
install -Dm755 "$srcdir"/bacula-${daemon}-init \
"$pkgdir"/etc/init.d/bacula-${daemon} || return 1
install -Dm644 "$srcdir"/bacula-${daemon}-conf \
"$pkgdir"/etc/conf.d/bacula-${daemon} || return 1
done
install -Dm644 examples/sample-query.sql \
"$pkgdir"/etc/bacula/scripts/query.sql
"$pkgdir"/etc/bacula/scripts/query.sql || return 1
# Fix correct log dir
sed -i -e 's%/var/bacula/log%/var/log/bacula%' \
"$pkgdir"/etc/bacula/bacula-dir.conf
sed -i 's%/var/bacula/log%/var/log/bacula%' \
"$pkgdir"/etc/bacula/bacula-dir.conf || return 1
# Install logrotate script
install -Dm644 scripts/logrotate $pkgdir/etc/logrotate.d/bacula
sed -i -e 's%/var/bacula/log%/var/log/bacula%' \
"$pkgdir"/etc/logrotate.d/bacula
install -Dm644 scripts/logrotate $pkgdir/etc/logrotate.d/bacula || return 1
sed -i 's%/var/bacula/log%/var/log/bacula%' \
"$pkgdir"/etc/logrotate.d/bacula || return 1
# Use shell script for catalog backup instead of perl
sed -i -e 's/make_catalog_backup.pl/make_catalog_backup/' \
"$pkgdir"/etc/bacula/bacula-dir.conf
sed -i 's/make_catalog_backup.pl/make_catalog_backup/' \
"$pkgdir"/etc/bacula/bacula-dir.conf || return 1
local dir
for dir in /var/lib/bacula /etc/bacula/scripts/make_catalog_backup* \
/etc/bacula/scripts/mtx-changer*
/etc/bacula/scripts/mtx-changer*
do
chown bacula.bacula "$pkgdir"$dir || return 1
done
find "$pkgdir"/usr/lib -iname libbaccats* -type l -delete
}
_mv_backend() {
mkdir -p "$subpkgdir"/usr/lib
mkdir -p "$subpkgdir"/etc/bacula/scripts
mv "$pkgdir"/usr/lib/libbaccats-${1}-${pkgver}.so \
"$subpkgdir"/usr/lib || return 1
"$subpkgdir"/usr/lib || return 1
ln -s libbaccats-${pkgver}.so "$subpkgdir"/usr/lib/libbaccats.so
ln -s libbaccats-${1}-${pkgver}.so \
"$subpkgdir"/usr/lib/libbaccats-${pkgver}.so
#mv "$pkgdir"/usr/lib/libbaccats-${1}.so \
# "$subpkgdir"/usr/lib/libbaccats.so || return 1
"$subpkgdir"/usr/lib/libbaccats-${pkgver}.so
mv "$pkgdir"/etc/bacula/scripts/*_${1}_* \
"$subpkgdir"/etc/bacula/scripts || return 1
"$subpkgdir"/etc/bacula/scripts || return 1
}
mysql() {
pkgdesc="Bacula MySQL backend"
depends="bacula"
_mv_backend mysql
}
......@@ -130,17 +133,21 @@ pgsql() {
pkgdesc="Bacula PGSQL backend"
depends="bacula"
pkgusers="postgres"
_mv_backend postgresql
_mv_backend postgresql || return 1
local file
for file in create_postgresql_database make_postgresql_tables \
grant_postgresql_privileges
grant_postgresql_privileges
do
chown postgres "$subpkgdir"/etc/bacula/scripts/$file
chown postgres "$subpkgdir"/etc/bacula/scripts/$file || return 1
done
}
sqlite() {
pkgdesc="Bacula SQLite backend"
depends="bacula"
_mv_backend sqlite3
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment