aboutsummaryrefslogtreecommitdiffstats
path: root/main/snort/APKBUILD
blob: 24c9ad225638323662a4f06fcaf81751178b944b (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
# Contributor: Michael Mason <ms13sp@gmail.com>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=snort
pkgver=2.9.8.2
pkgrel=0
pkgdesc="An open source network intrusion prevention and detection system"
url="http://www.snort.org/"
arch="all"
license="GPL"
depends=
makedepends="pcre-dev libpcap-dev libnet-dev libdnet-dev daq-dev
	bison flex zlib-dev libtirpc-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-dev"
source="https://www.snort.org/downloads/snort/snort-$pkgver.tar.gz
        snort.initd
        snort.confd
	"
pkgusers="snort"
pkggroups="snort"

_builddir="$srcdir/$pkgname-$pkgver"
prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done

	# fix parallel builds
#	sed -i -e 's/^all-local:.*/all-local: $(LTLIBRARIES)/' \
#		src/dynamic-preprocessors/*/Makefile.am || return 1
	# correct paths in default config file
	sed -i -e 's|/usr/local|/usr|' etc/snort.conf || return 1
	sed -i -e 's|\.\./|/var/lib/snort/|' etc/snort.conf || return 1
}

build() {
        cd "$_builddir"
	export CFLAGS="$CFLAGS `pkgconf --cflags libtirpc`"
	export LDFLAGS="$LDFLAGS `pkgconf --libs libtirpc`"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--enable-ipv6 \
		--enable-gre \
		--enable-non-ether-decoders \
		|| return 1
        make || return 1
}

package() {
        cd "$_builddir"
        make -j1 DESTDIR="$pkgdir" install

        install -D -m 755 ../snort.initd "$pkgdir"/etc/init.d/snort
        install -D -m 644 ../snort.confd "$pkgdir"/etc/conf.d/snort
        install -D -m 644 etc/snort.conf "$pkgdir"/etc/snort/snort.conf
        install -D -m 644 rpm/snort.logrotate "$pkgdir"/etc/logrotate.d/snort
	mkdir -p "$pkgdir"/usr/lib/snort_dynamicrules
	mkdir -p "$pkgdir"/var/lib/snort/rules
	mkdir -m 770 -p "$pkgdir"/var/log/snort && chown snort.snort "$pkgdir"/var/log/snort
	for file in classification.config reference.config threshold.conf \
		unicode.map
	do
		ln -s /var/lib/snort/etc/$file "$pkgdir"/etc/snort/$file
	done
	touch "$pkgdir"/var/lib/snort/rules/white_list.rules
	touch "$pkgdir"/var/lib/snort/rules/black_list.rules
}

md5sums="b5005f88a01b42ff7ee0defb94161ffc  snort-2.9.8.2.tar.gz
f163599315be80d682a51f8d22849ab5  snort.initd
446f8d2b3435b8a6be738da978670605  snort.confd"
sha256sums="4075012d350dfa47a0200b7a920323f15cb7c370790f2a47367c03aba4009333  snort-2.9.8.2.tar.gz
d447f1481a49543878030d361c8c31a6538c41b2c57e1c0cffd858cc5f83f70b  snort.initd
d504cb31ffcce9acc8fc7b68123a31a53b491444c52730339ea9a4e986521f71  snort.confd"
sha512sums="60f660b2093ae88211dcef9256edf35441c0ffc61ec8240b6d25e947b55b0fdb23482913246e2288a8a533dbaff4e5ea2d8f51298ab9aa67baa1ab74d1c4f7a4  snort-2.9.8.2.tar.gz
c71d11f4cde4aba432641d3915faec8070e9fea5b33c71f6b2872b2208871180b3c7dbbadd2ddaebe5f3280adf7c5c9daf1585afd331fe552486a675ff676e52  snort.initd
abc0846ea6e08029c772f24e213f211a39219701e6e2c8b3aa112632318479db7b21014c5f2c4987cb2981cafce0ea744549c3ce754e9145cba9ec5604ae66f3  snort.confd"