aboutsummaryrefslogtreecommitdiffstats
path: root/main/bacula/APKBUILD
blob: 964bad6ee1abda0da4551d1731e0a224d55d7178 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname="bacula"
pkgver=5.2.12
pkgrel=0
pkgdesc="Enterprise ready, network based backup program"
url="http://www.bacula.org"
arch="all"
license="AGPL3"
depends=""
depends_dev="autoconf mysql-dev ncurses-dev openssl-dev postgresql-dev sqlite-dev 
	zlib-dev"
makedepends="$depends_dev"
install="$pkgname.pre-install $pkgname.post-install $pkgname.post-upgrade"
subpackages="$pkgname-doc $pkgname-mysql $pkgname-pgsql $pkgname-sqlite"
source="http://downloads.sourceforge.net/project/$pkgname/$pkgname/$pkgver/$pkgname-$pkgver.tar.gz
	bacula-dir-init
	bacula-dir-conf
	bacula-sd-init
	bacula-sd-conf
	bacula-fd-init
	bacula-fd-conf
	bacula-5.0.2-config.patch
	bacula-5.0.2-openssl.patch
	bacula-5.0.3-sqlite-priv.patch
	bacula-config.patch
	configure.in.patch
	bacula-5.0.3-Makefile.patch
	os.m4.patch
	cxx.patch"

_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

	cd "$_builddir"/autoconf
	autoconf && cp configure ../
}

build() {
	cd "$srcdir/$pkgname-$pkgver"
	./configure --prefix=/usr \
	 --sysconfdir=/etc/bacula \
	 --localstatedir=/var \
	 --mandir=/usr/share/man \
	 --docdir=/usr/share/doc \
	 --infodir=/usr/share/info \
	 --with-pid-dir=/var/run \
	 --with-subsys-dir=/var/lock/subsys \
	 --with-logdir=/var/log/bacula \
	 --enable-largefile \
	 --enable-smartalloc \
	 --disable-nls \
	 --with-openssl=/usr/include/openssl \
	 --with-postgresql \
	 --with-mysql \
	 --with-sqlite3 \
	 --with-scriptdir=/etc/bacula/scripts \
	 --with-working-dir=/var/bacula \
	 --with-dir-user=bacula \
	 --with-dir-group=bacula \
	 --with-sd-user=bacula \
	 --with-sd-group=bacula \
	 --with-fd-user=root \
	 --with-fd-group=root

	make NO_ECHO= || return 1
}

package() {
	cd "$srcdir/$pkgname-$pkgver"
	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}
	done
	install -Dm644 examples/sample-query.sql \
	 "$pkgdir"/etc/bacula/scripts/query.sql
	# Fix correct log dir
	sed -i -e 's%/var/bacula/log%/var/log/bacula%' \
	 "$pkgdir"/etc/bacula/bacula-dir.conf
	# 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
	# 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
	find "$pkgdir" -iname *.la -delete
	# Backend is dinamically linked when subpackage is installed
	#rm "$pkgdir"/usr/lib/libbaccats.so
	#rm "$pkgdir"/usr/lib/libbaccats-5.2.1.so
}

_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
	mv "$pkgdir"/usr/lib/libbaccats-${1}.so \
	  "$subpkgdir"/usr/lib || return 1
	mv "$pkgdir"/etc/bacula/scripts/*_${1}_* \
	  "$subpkgdir"/etc/bacula/scripts || return 1
}

mysql() {
	pkgdesc="Bacula MySQL backend"
	depends="bacula"
	install="$pkgname.post-install"
	_mv_backend mysql
}

pgsql() {
	pkgdesc="Bacula PGSQL backend"
	depends="bacula"
	install="$pkgname.post-install"
	_mv_backend postgresql
}

sqlite() {
	pkgdesc="Bacula SQLite backend"
	depends="bacula"
	install="$pkgname.post-install"
	_mv_backend sqlite3
}

md5sums="b04c22b128b73359e4bbc9de06652c38  bacula-5.2.12.tar.gz
b1b328013634c98119663730e3e2da7e  bacula-dir-init
20f28a16f34e3f20ed18ed81b010e765  bacula-dir-conf
5ae1fba6860a320394d65744e5640bdb  bacula-sd-init
afe2f9a4d79d7d96eb9372d003d10f86  bacula-sd-conf
6ae93e570f95fa845fa534c2d2efaac0  bacula-fd-init
4500ce2d62bf9df33c07f70dc40f7b85  bacula-fd-conf
71f7f9c041eff045b2e97d141316c059  bacula-5.0.2-config.patch
4e310e84c7aba5b8d043758e0fa0088f  bacula-5.0.2-openssl.patch
9def0e68e3eb2f5f8b4c34108a248efd  bacula-5.0.3-sqlite-priv.patch
5d3c1bf25d50996e0c0c344dc2444014  bacula-config.patch
ebc9c2bbc9be95c920723a3f142d8e19  configure.in.patch
0ec20df57bb632ed729cfaf5d0a3ee33  bacula-5.0.3-Makefile.patch
cf7a2a4e972697f54364654c4e282b8b  os.m4.patch
1bfdbfea7a36d5503753414dffb953eb  cxx.patch"