aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ossec-hids/APKBUILD
blob: 7f1926f383dc728350d51d9d540a80105872d8b3 (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
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=ossec-hids
pkgver=2.9.3
pkgrel=0
pkgdesc="Open Source Host-based Intrusion Detection System"
url="http://www.ossec.net/"
arch="all !aarch64 !armhf"
license="GPL-3.0"
depends="inotify-tools procps"
makedepends="linux-headers inotify-tools-dev findutils file"
install="$pkgname.pre-install"
subpackages="$pkgname-doc"
pkgusers="ossec ossecm ossecr"
pkggroups="ossec"
source="$pkgname-$pkgver.tar.gz::https://github.com/ossec/$pkgname/archive/v$pkgver.tar.gz
	$pkgname.initd
	$pkgname.logrotate
	musl_lack_of_a_out_h.patch
	config"
builddir="$srcdir/$pkgname-$pkgver"

prepare() {	
	default_prepare
	cd "$builddir"
	export USER_INSTALL_TYPE=server
	export USER_NO_STOP=yes
	export USER_DIR=/var/ossec
	export USER_BINARYINSTALL=x
	sed -i "s|^OSSEC_INIT.*|OSSEC_INIT=\"$pkgdir/etc/ossec-init.conf\"|" src/init/shared.sh
}

build() {
	. "$srcdir"/config
	cd "$builddir"/src
	make TARGET=$USER_INSTALL_TYPE
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/etc
	USER_DIR="$pkgdir"/var/ossec ./install.sh
	sed -i '/DIRECTORY=/c\DIRECTORY="/var/ossec"' "$pkgdir/etc/ossec-init.conf"
	install -D -m755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.logrotate "$pkgdir"/etc/logrotate.d/$pkgname
	cat << EOF > "$pkgdir"/etc/ossec-init.conf
DIRECTORY="/var/ossec"
VERSION="$(cat src/VERSION)"
DATE="$(date)"
TYPE="server"
EOF
	mkdir -p "$pkgdir"/var/ossec/logs
	set -- $pkgusers
	cd 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 '{}' ';'
}

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

sha512sums="cfc993ef698d479ead99d4b0fe598208831960af589b7119b6bc680073c5b8aef2395387cadcca00f90a33aab2f0d4a71787b265acf700fb341c377648a245cd  ossec-hids-2.9.3.tar.gz
62f52d91de3751c149b1c354ebb87c0a8c4a81129403b80a8448c5e6542a67b4aa9e132aab2429781913eb909320b431b381828e414d44235bb8e9a8959e0d8b  ossec-hids.initd
6cdf4852feabfdd043405e2570bb9a3013eb11c1865e9178fb67a019717d44fb0fedba05ab74c4334a1bae0a0c45912213dd7d6c7e1eab31853d40beea7596a0  ossec-hids.logrotate
4e076581cc3977c527f30da6c43552db18bc35ea7b745c1504f4d15ebfbcef42c9604804af28fc90744a85f847a0f0c5bf991476cae71e3d860adb7cfa33a63b  musl_lack_of_a_out_h.patch
df760cb8a24c080b016c4cad4d4b1df56ae26d4f94517a7b9d6ccc3d507a7a53f3a46abdddccad3244cacca12857dc3d5b4646ac763788c88cf59686504122d0  config"