aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ossec-hids-local/APKBUILD
blob: 567bf4f5a6dd1aee6d6c4c16e443868d8fc931d2 (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
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=ossec-hids-local
_target=${pkgname/ossec-hids-/}
pkgver=3.6.0
pkgrel=0
pkgdesc="Open Source Host-based Intrusion Detection System"
url="https://www.ossec.net/"
arch="all !aarch64 !armhf !armv7 !s390x"
license="GPL-2.0-only WITH openssl-exception"
depends="inotify-tools procps ossec-hids-openrc"
makedepends="linux-headers bsd-compat-headers openssl-dev \
libevent-dev inotify-tools-dev findutils file zlib-dev pcre2-dev \
sqlite-dev lua5.3-dev geoip-dev czmq-dev"
checkdepends="check-dev subunit-dev"
subpackages="$pkgname-doc"
pkgusers="ossec ossecm ossecr"
pkggroups="ossec"
source="$pkgname-$pkgver.tar.gz::https://github.com/ossec/ossec-hids/archive/$pkgver.tar.gz
	$pkgname.logrotate
	musl_lack_of_a_out_h.patch
	makefile.patch
	config"
builddir="$srcdir"/ossec-hids-$pkgver

prepare() {
        default_prepare
        export V=1
        export USER_INSTALL_TYPE=$_target
        export USER_NO_STOP=yes
        export USER_DIR=/var/ossec
        export USER_BINARYINSTALL=x
        export USE_GEOIP=yes
        export USE_ZEROMQ=yes
        export LUA_ENABLE=yes
        export USE_SQLITE=yes
        export DATABASE=sqlite
        export USE_INOTIFY=yes
        export PCRE2_SYSTEM=yes
}

build() {
	cd "$builddir"/src
	make clean
	make TARGET=$_target PREFIX=/var/ossec
}

check() {
	cd "$builddir"/src
	make test PREFIX=/var/ossec
}

package() {
	install -Dm644 -D "$srcdir"/$pkgname.logrotate "$pkgdir"/etc/logrotate.d/$pkgname
	install -Dm644 -D etc/ossec-$_target.conf "$pkgdir"/etc/ossec-$_target.conf

	mkdir -p "$pkgdir"/var/ossec/etc
	cat << EOF > "$pkgdir"/var/ossec/etc/ossec-init.conf
DIRECTORY="/var/ossec"
VERSION="$(cat src/VERSION)"
DATE="$(date)"
TYPE="$_target"
EOF

	set -- $pkgusers
	cd "$builddir"/src
	find "$pkgdir" -user nobody -exec chown 524 '{}' ';'
	find "$pkgdir" -user mail -exec chown 525 '{}' ';'
	find "$pkgdir" -user daemon -exec chown 526 '{}' ';'
	find "$pkgdir" -group nobody -exec chgrp 525 '{}' ';'

	make TARGET="$_target" PREFIX="$pkgdir"/var/ossec install
}

doc() {
	cd "$builddir"
	pkgdesc="Documentation for $pkgname"
	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname
	cp -a doc/* \
	  "$subpkgdir"/usr/share/doc/$pkgname
}

sha512sums="1f5e897de757df264dfb56def74b7d8f886b6b9d772b5b3d0197c9cd00a32fd7fd8a7b53566851fea3cd74d433b5594cbd074e50b7dbe36305fb3c243e8ddcf5  ossec-hids-local-3.6.0.tar.gz
6cdf4852feabfdd043405e2570bb9a3013eb11c1865e9178fb67a019717d44fb0fedba05ab74c4334a1bae0a0c45912213dd7d6c7e1eab31853d40beea7596a0  ossec-hids-local.logrotate
4e076581cc3977c527f30da6c43552db18bc35ea7b745c1504f4d15ebfbcef42c9604804af28fc90744a85f847a0f0c5bf991476cae71e3d860adb7cfa33a63b  musl_lack_of_a_out_h.patch
27ccd8197541693c6cfa85e1598b40a5bd2dbd1dec2b7bd057211b45fd0c14c42c2ddd01d9ac57491eda93bb318961642d3adce55b395351d530609250ca003f  makefile.patch
5213936052ed3adf8d9bb36d044386e2decf85ad59e7d5a69b4b73c708ea779dc03049c3429e9b658efceb347b950b0192ca4f66bb56a3101c2016f106dcc287  config"