summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7c1c2e6dfd2f7fcfb459f89080b83da374801b76 (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
# This is an example PKGBUILD file. Use this as a start to creating your own,
# and remove these comments. For more information, see 'man PKGBUILD'.
# NOTE: Please fill out the license field for your package! If it is unknown,
# then please put 'unknown'.

# Maintainer: Matěj Týč <matej.tyc@gmail.com>
pkgname=osquery-git
pkgver=1.8.0.r4.gc1d004e
pkgrel=1
epoch=
pkgdesc="SQL powered operating system instrumentation, monitoring, and analytics."
arch=(any)
url="https://osquery.io"
license=('BSD')
groups=()
depends=('asio' 'audit' 'aws-sdk-cpp-git' 'boost' 'boost-libs' 'clang' 'cmake'
         'doxygen' 'gflags' 'git' 'google-glog' 'lsb-release' 'make' 'python'
         'python-jinja' 'python-pip' 'sleuthkit' 'snappy' 'thrift' 'yara')
makedepends=('python-jinja' 'python-psutil' 'python-pexpect' 'rocksdb'
             'rocksdb-static' 'cpp-netlib' 'magic' 'unzip' 'wget')
checkdepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=('etc/osquery/osquery.conf')
options=()
install=
changelog=
source=("${pkgname}::git+https://github.com/facebook/osquery"
        "osqueryd.service"
        "arch-linux.patch")
noextract=()
sha256sums=('SKIP'
            '1fa367325d4a7ad7dfef3b7b817b3c7588ad02a8d08fc11db24de66b486c6503'
            '745e4561eb065d05826d8f96d1cd06640463a5a85f38d2581ea85d2e33fd8d24')
validpgpkeys=()

_gitname=${pkgname}
# last known working commit-ish
_githash=c1d004ed1f12a4113102fafd0c633001b8e4254c

pkgver() {
    cd $_gitname

    git describe --long --tags $_githash | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
    cd $_gitname

    git checkout $_githash
    git submodule update --init
    patch -p1 -i "${srcdir}/arch-linux.patch"
}

build() {
    cd $_gitname

    make deps
    cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/usr
    make -j $(nproc)
}

package() {
    cd $_gitname

    make DESTDIR="${pkgdir}" install

    install -dm755 "${pkgdir}/var/osquery/"
    install -dm755 "${pkgdir}/var/log/osquery/"

    install -Dm755 "${pkgdir}/usr/share/osquery/osquery.example.conf" \
        "${pkgdir}/etc/osquery/osquery.conf"

    install -Dm755 "${srcdir}/osqueryd.service" \
        "${pkgdir}/usr/lib/systemd/system/osqueryd.service"
}