APKBUILD 2.58 KB
Newer Older
1 2
# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
Stuart Cardall's avatar
Stuart Cardall committed
3
pkgname=fwsnort
4
pkgver=1.6.8
5
pkgrel=1
Stuart Cardall's avatar
Stuart Cardall committed
6 7 8 9
pkgdesc="Application layer IDS/IPS by translating snort rules into iptables"
url="http://www.cipherdyne.org/fwsnort/"
arch="noarch"
license="GPL"
10
depends="perl perl-netaddr-ip perl-iptables-parse iptables ip6tables net-tools wget"
Stuart Cardall's avatar
Stuart Cardall committed
11 12
install="$pkgname.post-install"
source="http://www.cipherdyne.org/$pkgname/download/$pkgname-nodeps-$pkgver.tar.gz
Jakub Jirutka's avatar
Jakub Jirutka committed
13 14 15
	fwsnort.up
	fwsnort.update
	periodic.daily"
16
options="!check" # requires uid=0
17
builddir="$srcdir/$pkgname-$pkgver"
Stuart Cardall's avatar
Stuart Cardall committed
18 19

build() {
20
	cd "$builddir"
Stuart Cardall's avatar
Stuart Cardall committed
21

Jakub Jirutka's avatar
Jakub Jirutka committed
22 23 24 25
	# Disable Root requirement to build.
	local start=$(sed -n '/die "You need to be root (or equivalent UID 0"/=' ./install.pl)
	local end=$(expr $start + 1)
	# Busybox sed does not support +1d.
Jakub Jirutka's avatar
Jakub Jirutka committed
26
	sed "$start,${end}d" ./install.pl -i
Stuart Cardall's avatar
Stuart Cardall committed
27

Jakub Jirutka's avatar
Jakub Jirutka committed
28 29
	# Prevent chmod 0500 halting the build.
	sed "s|0500|0755|" ./install.pl -i
Stuart Cardall's avatar
Stuart Cardall committed
30

Jakub Jirutka's avatar
Jakub Jirutka committed
31 32
	# Change MAN path so package builds.
	sed "s|/usr/share/man/man8|$pkgdir&|" ./install.pl -i
Stuart Cardall's avatar
Stuart Cardall committed
33 34 35 36 37 38 39 40

	# --install-test-dir sets the INSTALL_ROOT to $src/../test/fwsnort-test
	# avoids installation attempted into /etc /usr /var
	# -S disables dependency installs (we also build with the nodep sources)
	./install.pl -S --install-test-dir
}

package() {
Jakub Jirutka's avatar
Jakub Jirutka committed
41 42 43
	cd "$builddir"

	mkdir -p "$pkgdir"/etc "$pkgdir"/usr
44 45
	cp -rf test/fwsnort-install/* "$pkgdir"/
	cp -f fwsnort.conf "$pkgdir"/etc/fwsnort/fwsnort.conf
Jakub Jirutka's avatar
Jakub Jirutka committed
46 47

	# Fix permissions.
48 49 50
	chmod 0500 "$pkgdir"/etc/fwsnort "$pkgdir"/etc/fwsnort/snort_rules
	chmod 0500 "$pkgdir"/usr/sbin/fwsnort
	chmod 0600 "$pkgdir"/etc/fwsnort/fwsnort.conf
Jakub Jirutka's avatar
Jakub Jirutka committed
51 52 53

	# Install rule / signature update script.
	install -Dm755 "$srcdir"/fwsnort.update \
54
		"$pkgdir"/usr/bin/update-fwsnort
Stuart Cardall's avatar
Stuart Cardall committed
55

Jakub Jirutka's avatar
Jakub Jirutka committed
56 57
	# Install iptables rule splicing script.
	install -Dm755 "$srcdir"/fwsnort.up \
58
		"$pkgdir"/etc/network/if-pre-up.d/fwsnort
Stuart Cardall's avatar
Stuart Cardall committed
59

Jakub Jirutka's avatar
Jakub Jirutka committed
60 61 62
	# Install daily cron.
	install -Dm755 "$srcdir"/periodic.daily \
		"$pkgdir"/etc/periodic/daily/fwsnort
Stuart Cardall's avatar
Stuart Cardall committed
63 64
}

65 66
check() {
	cd "$builddir/test"
67
	./test-fwsnort.pl
68 69
}

70
sha512sums="9ebc5f2ab23d0fea66c99ade39e45b4b77cb48ec5dd5f2c69f9fb092e54806fc433f0723cd20542b359a86d4b9960f396e3dbbd709386d6ac368b411564af1c6  fwsnort-nodeps-1.6.8.tar.gz
Stuart Cardall's avatar
Stuart Cardall committed
71 72 73
3c97b5f4bb922086acd62305baae4ba1d91e6e627d063f131f98e08da3f57b607b35558eae2cf292b3997d25f09147039f95123161f8f29c5b97b71c80811e9f  fwsnort.up
2a1e7ca6dc1c4a6e59907175c3483736f0efe1dcd8035dae2b903cd22fe953d29333939ad9e0a6f446480eda55370f4b11a77016932bef73e769b5e5401e92c0  fwsnort.update
763b459d43319e9b6678a5addd96b3542c629379f9f11095bc158b1ef08b039cd776ceedd6207953ab01000804d7580a3a8223b352b407d3cc6a05c27d96fcb0  periodic.daily"