summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 42e23cdc2116f04f275998e5c94f06b636f5a018 (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
# Maintainer: Philipp Classen <philipp.classen@posteo.de>
#
# Forked from https://aur.archlinux.org/packages/cassandra

# check() function is used to verify GPG signature. check() imports 3 keys into your GPG keyring at first build.
# See http://scarybeastsecurity.blogspot.com/2011/07/alert-vsftpd-download-backdoored.html for reason of this step.
# If you have problems with gpg, you can remove check() function, and all will be ok.

pkgname=cassandra21
_pkgname=cassandra
pkgver=2.1.20
pkgrel=1
pkgdesc='Apache Cassandra NoSQL database 2.1.x'
arch=('any')
url='http://cassandra.apache.org/'
license=('APACHE')
depends=('java-runtime')
makedepends=('gnupg')
checkdepends=('wget')
optdepends=('python: to use Python CLI administration scripts')
conflicts=('cassandra')
backup=(etc/cassandra/cassandra-env.sh
        etc/cassandra/cassandra-rackdc.properties
        etc/cassandra/cassandra-topology.properties
        etc/cassandra/cassandra.yaml
        etc/cassandra/commitlog_archiving.properties
        etc/cassandra/logback.xml
        etc/cassandra/logback-tools.xml)
install=cassandra.install
_url_tgz="http://www.apache.org/dist/${_pkgname}/${pkgver}/apache-${_pkgname}-${pkgver}-bin.tar.gz"
source=("${_url_tgz}"
        '01_fix_cassandra_home_path.patch'
        'cassandra.install'
        'cassandra.service'
        'cassandra-tmpfile.conf'
        'cassandra-user.conf')
sha256sums=('ca50ffae388a2d6b363b5400217cd8ce1800d7ce40e920b3b77de8f124516746'
            'bbb5dcc19cac4e19c506210da901280c3063a6a241480bf12bc874e6a5c02657'
            '971d6d0f21963b2d9443039431e5225191771454728c6eda4aab9175ee478ce4'
            'abc9d54399c84eacf5922811b5480846ea1c88a73c5d214ea1db3d20c7c0422a'
            '7ea0024331734b9755b6fa2ed1881f9bc608b551990b96f14e80406cb6b05eb8'
            '7a87a4369ca2c13558fa8733f6abdcf548c63dda8a16790b5bcc20bae597ee91')

build() {
  cd ${srcdir}/apache-cassandra-${pkgver}

  patch -p0 < ${srcdir}/01_fix_cassandra_home_path.patch
}

## to check gpg signature
check() {
  msg "Checking GPG signature..."
  msg2 "(To disable gpg-check: build with '--nocheck')"

  _url_keys='https://www.apache.org/dist/cassandra/KEYS'
  msg "Importing GPG keys from ${_url_keys} ..."
  wget --quiet -O - ${_url_keys} | gpg --import -

  # no need to add signature to package dependences
  echo "${_url_tgz}.asc"
  wget --quiet -O - "${_url_tgz}.asc" | gpg --verify - "apache-${_pkgname}-${pkgver}-bin.tar.gz"
  msg2 "Detached GPG signature is valid."
}

package() {
  cd ${srcdir}/apache-cassandra-${pkgver}

  mkdir -p ${pkgdir}/{etc/cassandra,var/log/cassandra}
  mkdir -p ${pkgdir}/{usr/bin,usr/share/cassandra,usr/share/java/cassandra}

  cp -a interface pylib tools ${pkgdir}/usr/share/cassandra/

  mkdir -p ${pkgdir}/usr/share/cassandra/bin/
  for f in bin/*; do
    if [[ ! "${f}" == *.bat && -x ${f} ]]; then
      cp -a ${f} ${pkgdir}/usr/share/cassandra/bin/
      ln -s /usr/share/cassandra/${f} ${pkgdir}/usr/${f}
    fi
  done
  cp -a bin/cassandra.in.sh ${pkgdir}/usr/share/cassandra/

  cp -a lib/* ${pkgdir}/usr/share/java/cassandra/
  ln -s ../java/cassandra ${pkgdir}/usr/share/cassandra/lib

  cp -a conf/* ${pkgdir}/etc/cassandra/
  ln -s /etc/cassandra ${pkgdir}/usr/share/cassandra/conf

  install -Dm644 ${srcdir}/cassandra.service ${pkgdir}/usr/lib/systemd/system/cassandra.service
  install -Dm644 ${srcdir}/cassandra-tmpfile.conf ${pkgdir}/usr/lib/tmpfiles.d/cassandra.conf
  install -Dm644 ${srcdir}/cassandra-user.conf ${pkgdir}/usr/lib/sysusers.d/cassandra.conf
}

# vim:set ts=2 sw=2 et: