summaryrefslogtreecommitdiff
path: root/main/bacula/APKBUILD
blob: c0c56dadd1e20494454f3a15023dc01241f19f26 (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
177
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=bacula
pkgver=9.0.5
pkgrel=3
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.initd
	bacula-sd.initd
	bacula-fd.initd
	bacula-7.4.0-path-mounted.patch
	"
options="!check" #no test suite provided
builddir="$srcdir/$pkgname-$pkgver"

_bworkdir="/var/lib/$pkgname"

prepare () {
	default_prepare

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

build() {
	cd "$builddir"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc/$pkgname \
		--localstatedir=/var \
		--mandir=/usr/share/man \
		--docdir=/usr/share/doc \
		--infodir=/usr/share/info \
		--with-pid-dir=/run/$pkgname \
		--with-subsys-dir=/run/lock/subsys \
		--with-logdir=/var/log/$pkgname \
		--enable-largefile \
		--enable-smartalloc \
		--disable-nls \
		--with-openssl=/usr/include/openssl \
		--with-postgresql \
		--with-mysql \
		--with-sqlite3 \
		--with-scriptdir=/etc/$pkgname/scripts \
		--with-working-dir=$_bworkdir \
		--with-dir-user=$pkgname \
		--with-dir-group=$pkgname \
		--with-archivedir=$_bworkdir/archive \
		--with-sd-user=$pkgusers \
		--with-sd-group=$pkggroup \
		--with-fd-user=root \
		--with-fd-group=root \
		--with-sbin-perm=0755

	make NO_ECHO=
}

package() {
	cd "$builddir"

	make DESTDIR="$pkgdir" install

	local daemon; for daemon in dir sd fd; do
		install -Dm755 "$srcdir"/$pkgname-${daemon}.initd \
			"$pkgdir"/etc/init.d/$pkgname-${daemon}
	done

	install -Dm644 examples/sample-query.sql \
		"$pkgdir"/etc/$pkgname/scripts/query.sql

	# Fix correct log dir
	sed -i 's%/var/bacula/log%/var/log/bacula%' \
		"$pkgdir"/etc/$pkgname/$pkgname-dir.conf

	# Install logrotate script
	install -Dm644 scripts/logrotate $pkgdir/etc/logrotate.d/$pkgname
	sed -i 's%/var/bacula/log%/var/log/bacula%' \
		"$pkgdir"/etc/logrotate.d/$pkgname

	# Use shell script for catalog backup instead of perl
	sed -i 's/make_catalog_backup.pl/make_catalog_backup/' \
		"$pkgdir"/etc/$pkgname/$pkgname-dir.conf

	local dir; for dir in $_bworkdir \
		/etc/$pkgname/scripts/make_catalog_backup* \
		/etc/$pkgname/scripts/mtx-changer* \
		/etc/$pkgname/*.conf
	do
		chown $pkgusers.$pkggroups "$pkgdir"$dir
	done

	find "$pkgdir"/usr/lib -iname libbaccats* -type l -delete
}

_mv_backend() {
	mkdir -p "$subpkgdir"/usr/lib
	mkdir -p "$subpkgdir"/etc/$pkgname/scripts

	mv "$pkgdir"/usr/lib/libbaccats-${1}-${pkgver}.so \
		"$subpkgdir"/usr/lib

	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/$pkgname/scripts/*_${1}_* \
		"$subpkgdir"/etc/$pkgname/scripts
}

mysql() {
	pkgdesc="Bacula MySQL backend"
	depends="$pkgname"

	_mv_backend mysql
}

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

	_mv_backend postgresql

	local file
	for file in create_postgresql_database make_postgresql_tables \
			grant_postgresql_privileges
	do
		chown postgres "$subpkgdir"/etc/$pkgname/scripts/$file
	done
}

sqlite() {
	pkgdesc="Bacula SQLite backend"
	depends="$pkgname"

	_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 \
		"$subpkgdir"/etc/init.d \
		"$subpkgdir"/etc/$pkgname
	for bin in $pkgname $pkgname-fd bconsole btraceback; do
		mv "$pkgdir"/usr/sbin/$bin "$subpkgdir"/usr/sbin
	done
	mv "$pkgdir"/etc/init.d/$pkgname-fd "$subpkgdir"/etc/init.d
	mv "$pkgdir"/etc/$pkgname/$pkgname-fd.conf "$subpkgdir"/etc/$pkgname/
	install -d -o $pkgname -g $pkgname "$subpkgdir"/$_bworkdir
}

sha512sums="97a23c701808666833e773106f5618bcce1af90fff299da88e58b23ed04fc7e6bfdf4c231f3724d2186fad7985f5f9d7f6b629d59cea489b2d4d4ce6f041ca63  bacula-9.0.5.tar.gz
e3ea78c7b920ab33c94c715f9375cf8dc52fd963a526827941c3d6de619c999e00f01ac102d3260e4de457de50af146ab014862174b14524862c92e00908f765  bacula-dir.initd
60f174799ad15b0f5ea94bc578d3a58681e45b8306c059c4d7e78bc3c7edfcff95f8a551495d0af5a94dc645e96d1aa36d4c378f0dfd871e38b0c9b64b82da26  bacula-sd.initd
3887a65972f6a82b2b7b93521e534b8347a5ed9da36c9645eb2bf5eb683b6e0e3ee0613b048b7d2ec725e890ec0513afb2197adfd2bf5d91108dce3b23662c07  bacula-fd.initd
2d3757236aacca421261a8866ff04b5b0151538e1462559bd1240119b1bece1d456acbba9fee86dbc6aaec7af2a52eb2c0b7490c5f371b7deb478731c74342ff  bacula-7.4.0-path-mounted.patch"