aboutsummaryrefslogtreecommitdiffstats
path: root/main/awall/APKBUILD
blob: 1d6763ace253e9420f7c3f8f43280c4ad12a325e (plain) (blame)
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
# Contributor: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
# Maintainer: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
pkgname=awall
pkgver=1.8.2
pkgrel=0
pkgdesc="Alpine Wall"
url="https://gitlab.alpinelinux.org/alpine/awall"
_luaver=5.3
arch="noarch"
license="GPL-2.0"
replaces="awall-nat"
depends="drill ip6tables ipset iptables lua$_luaver lua$_luaver-alt-getopt
         lua$_luaver-cjson lua$_luaver-pc lua$_luaver-posix lua$_luaver-stringy
         lua$_luaver-lyaml xtables-addons"
subpackages="$pkgname-masquerade $pkgname-policies"
triggers="$pkgname.trigger=/usr/share/awall"
source="$url/-/archive/v$pkgver/awall-v$pkgver.tar.bz2
	awall-init
	setup-firewall
	"
builddir=$srcdir/awall-v$pkgver

build() {
	sed -i -e "1,1s:lua:lua$_luaver:" awall-cli
	return 0
}

check() {
	make LUA_VERSION=$_luaver check
}

package() {
	make "ROOT_DIR=$pkgdir" LUA_VERSION=$_luaver install
	install -D "$srcdir"/awall-init "$pkgdir"/usr/libexec/awall-init
}

masquerade() {
	depends=awall
	for file in lua/$_luaver/awall/modules/masquerade.lua awall/mandatory/masquerade.json; do
		local path=usr/share/$file
		install -d "$subpkgdir/$(dirname $path)"
		mv "$pkgdir/$path" "$subpkgdir/$path"
	done
}

policies() {
	depends=awall
	local dir=usr/share/awall/optional
	install -d "$subpkgdir"/$dir
	mv "$pkgdir"/$dir/*.json "$subpkgdir"/$dir
	install -D "$srcdir"/setup-firewall "$subpkgdir"/usr/sbin/setup-firewall
}

sha512sums="40bb09d81152618be65e5b6c907b0b49a9e7ebcdf7d940d029450eae5cf51ad02aca4ba9208f89919b079ff7048d6f7cced26a27f579c27d5fbc3a27bde39b15  awall-v1.8.2.tar.bz2
e83ea3281c298092530e45fa5b62f6f85b9e5109b11e109799465ea832608294c7d9c4c3f5b0f321dfc0e82040daf3a17d066e9dea65cb0dbae2c453ea9e62cd  awall-init
1cd4b7fa5fc6c9ac6667dff5cc00d96a3cc42aaccafe3c5562d3dcfd9f22ddec9cfe5a9339fee8001b67ccb8e8b81c9417f39a461e5052af9bf74a2753559bf7  setup-firewall"