aboutsummaryrefslogtreecommitdiffstats
path: root/main/bacula/APKBUILD
blob: 81b5ac9764184cfe614f8285cdc7d7c106bcf4e9 (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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=bacula
pkgver=7.4.6
pkgrel=0
pkgdesc="Enterprise ready, network based backup program"
url="http://www.bacula.org"
arch="all"
license="AGPL3"
depends=""
makedepends="autoconf mariadb-dev ncurses-dev libressl-dev postgresql-dev
	sqlite-dev zlib-dev lzo-dev acl-dev"
install="$pkgname.pre-install $pkgname.post-upgrade"
subpackages="$pkgname-doc $pkgname-mysql $pkgname-pgsql $pkgname-sqlite
	$pkgname-client $pkgname-libs"
pkgusers="bacula"
pkggroups="bacula"
somask="libbaccats-$pkgver.so"
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-7.4.0-path-mounted.patch
	"
builddir="$srcdir/$pkgname-$pkgver"

prepare () {
	default_prepare || return 1

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

build() {
	cd "$builddir"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--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/lib/bacula \
		--with-dir-user=bacula \
		--with-dir-group=bacula \
		--with-archivedir=/var/lib/bacula/archive \
		--with-sd-user=bacula \
		--with-sd-group=bacula \
		--with-fd-user=root \
		--with-fd-group=root \
		|| return 1

	make NO_ECHO= || return 1
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install

	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 || return 1

	# Fix correct log dir
	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 || 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 '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*
	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

	ln -s libbaccats-${pkgver}.so "$subpkgdir"/usr/lib/libbaccats.so
	ln -s libbaccats-${1}-${pkgver}.so \
		"$subpkgdir"/usr/lib/libbaccats-${pkgver}.so

	mv "$pkgdir"/etc/bacula/scripts/*_${1}_* \
		"$subpkgdir"/etc/bacula/scripts || return 1
}

mysql() {
	pkgdesc="Bacula MySQL backend"
	depends="bacula"

	_mv_backend mysql
}

pgsql() {
	pkgdesc="Bacula PGSQL backend"
	depends="bacula"
	pkgusers="postgres"

	_mv_backend postgresql || return 1

	local file
	for file in create_postgresql_database make_postgresql_tables \
			grant_postgresql_privileges
	do
		chown postgres "$subpkgdir"/etc/bacula/scripts/$file || return 1
	done
}

sqlite() {
	pkgdesc="Bacula SQLite backend"
	depends="bacula"

	_mv_backend sqlite3
}

libs() {
	pkgdesc="Bacula libraries"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/* "$subpkgdir"/usr/lib
}

client() {
	pkgdesc="Bacula client"
	mkdir -p "$subpkgdir"/usr/sbin
	for bin in bacula bacula-fd bconsole btraceback; do
		mv "$pkgdir"/usr/sbin/$bin "$subpkgdir"/usr/sbin
	done
}

sha512sums="2d8c47d184dd5d611bf3d209f0d39b0d2e60763bbb757a393c1ddb2fb361de855a4d53d4cbd76f4fda555cc7c069e79eefcb57fc01389a98dec6dc7815d0cde7  bacula-7.4.6.tar.gz
852df12c6555ad65661345e15872ca75b99a9d3e5b9e6ed80d82021006c9716a04919dabe88ff672aa550ac0b00b31eaa2e739469557fc326e6bb4216e2308b9  bacula-dir-init
e06e5f8821d4a9a3f40cc8f11feeb5004780b82e2ad5e645f69a0f8faff78d8a8c6e66b36e105619b2a78d6b2f294dedd0e00e9bbf568af201cf299387135fef  bacula-dir-conf
ee8a9206d3e604f5ac81bc70bece97ec77dae87b463a6ff4d08fba9418bf37e99a30895f115b2e9fbba1ec5f92b5d9368fd155717fedae12792f255b02413208  bacula-sd-init
80f6cf74cc14e722747d92e6e7b073bdf32456d395c6b4b63daa1ddcaf75f3d76d1b9a0e8e2da512e8f82e4d59a4a93cc38117af91d974fe7db644516bdb9909  bacula-sd-conf
e4c09734ccf9e1ac197ac4684c8294dddae817cf764b168ce7357b2529d11314f948ed2807d501b3c7cd7725ba488981fe573d7b389fca7feedfa9c8a1cce6fa  bacula-fd-init
ff312e8952b31de27f22b257d12b570e151794d985f854ff19bab34363ea974d7583edced6b125518da3ecfe2b2a229b732473958b10484d988fcc8a67a372cc  bacula-fd-conf
2d3757236aacca421261a8866ff04b5b0151538e1462559bd1240119b1bece1d456acbba9fee86dbc6aaec7af2a52eb2c0b7490c5f371b7deb478731c74342ff  bacula-7.4.0-path-mounted.patch"