summarylogtreecommitdiffstats
path: root/PKGBUILD.common
blob: 251ae82f02ddc8e150e57345a0df1ccc1c09c215 (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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# Maintainer: Michael Spradling <mike@mspradling.com>
# Contributor: Daniel Albers <daniel@lbe.rs>

pkgver=15.2.2
pkgrel=2
arch=(i686 x86_64)
groups=('bareos')
pkgdesc="Bareos - Backup Archiving REcovery Open Sourced"
url="http://www.bareos.org"
license=('AGPL3')
makedepends=('sqlite' 'libmariadbclient' 'postgresql-libs' 'lzo' 'acl' 'libcap')
optdepends=('openssl: network encryption between daemons')

_instdir="${startdir}/install"
_pkgsrc="${startdir}/src/bareos-Release-${pkgver}"
_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=/usr/lib/bareos/defaultconfigs \
  --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-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=bareos \
  --with-fd-group=bareos"

prepare() {
  # bareos must use python2
  cd "${_pkgsrc}"
  sed -i "s/python-config/python2-config/g" configure
}

build() {
  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 needed directories
  if [ -e "${_pkgsrc}/debian/$1.dirs" ]; then
    while read dir
    do
      mkdir -p ${pkgdir}${dir}
    done < ${_pkgsrc}/debian/$1.dirs
  fi

  # Create files
  while read file
  do
    set -f # Handle BLOB wild cards
    file=$(echo $file | sed 's,\([^ ]*\).*,\1,g') # Remove second param, if exists
    file=${file:1:${#file}-1}
    set +f
    cp --parents -a ${file} ${pkgdir}
  done < ${_pkgsrc}/debian/$1.install

  mv "${pkgdir}/usr/sbin" "${pkgdir}/usr/bin" &> /dev/null || true

  popd &> /dev/null
}

_etc_files() {
  pushd $_instdir &> /dev/null

  # HACK: This allows mksrcinfo to work when determining etc files dynamically
  [[ ${_pkgsrc} == $(readlink -f $(pwd)/..)* ]] || MKSRCINFO=1
  [[ $MKSRCINFO -eq 1 ]] &&  _pkgsrc=${_pkgsrc:1:${#_pkgsrc}-1}

  while read file
  do
    file=$(echo $file | sed 's,\([^ ]*\).*,\1,g') # Remove second param, if exists
    file=${file:1:${#file}-1}

    if [[ "$file" =~ "etc" ]]; then
      out="${file} $out"
    fi
  done < ${_pkgsrc}/debian/$1

  popd &> /dev/null
  echo $out
}


package_bareos-bat() {
  conflicts=("alsa-utils")
  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" "python" "python2")
  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" "python" "python2")
  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=bareos-storage-fifo.install
  _install_files ${pkgname}
}

package_bareos-storage-python-plugin() {
  pkgdesc="${pkgdesc} - Python plugin for storage daemon"
  depends=("bareos-storage=$pkgver" "python" "python2")
  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=bareos-storage-tape.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}
}