# Contributor: Danilo Falcão <danilo@falcao.org>
# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=ufw
pkgver=0.36.2
pkgrel=2
pkgdesc="Uncomplicated CLI tool managing a netfilter firewall"
url="https://launchpad.net/ufw"
arch="noarch"
license="GPL-3.0-or-later"
depends="iptables python3"
makedepends="py3-setuptools"
checkdepends="bash"
subpackages="$pkgname-doc $pkgname-openrc $pkgname-bash-completion $pkgname-pyc"
source="https://launchpad.net/ufw/${pkgver%.*}/$pkgver/+download/ufw-$pkgver.tar.gz
	$pkgname.initd
	0001-syntaxwarning.patch
	0002-assertEqual.patch
	disable-iptables-test.patch
	fix-lib_path.patch
	iptables-version.patch
	"

check() {
	sh run_tests.sh
}

package() {
	python3 setup.py install --root="$pkgdir"

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	chmod 644 "$pkgdir"/etc/ufw/*.rules

	install -Dm0644 "$builddir"/shell-completion/bash \
		"$pkgdir"/usr/share/bash-completion/completions/ufw
}

sha512sums="
43c5f31c98681e006b821f30e3d729eec0bbe21eeea833916b6ab18899201e5e243e5077ace32480b2a222b69b2c383ff95b7a50241053d025d68f34c25cd60b  ufw-0.36.2.tar.gz
c2f1a4e4f2de3f71ef4626645acb1805df6194ee99bcbcd024092d791ccf1391e65276718f0578b1647fbc8439aa6d962f7485273c4875f5109905d9bca2fe09  ufw.initd
86f20c6c1a0d1efaeff571a8193e5f8267c7880342628c79686893dfbb000a25ae767dd049e8a89ad79a99dbccfc9744d785f8dee1b4b797d570dd9b6778fea6  0001-syntaxwarning.patch
f47d945b359e9f213b550894897e909836b4302db1bad457a9d4ebdf018f4eddaf524efe040cf20d128b95166ec7d94ffd15d694fc1c0d9a096d4b12eb374e83  0002-assertEqual.patch
0c21a46a2f8a652908be706734975f11b8e3dc527fca215847effa8db6291afc14e5938031a1dc20eb55616fe19fdc0f0c211b66c0bb3de3cc19df534348b6dc  disable-iptables-test.patch
1f3f884f219dad9f2a8eaa1c02d90e82ac1646910c5a30b37cd70fc228f885aa147ef00b6e45d30bc0bdd7f2f19bc8f4db1fe0b63917ee013c07ab953744006a  fix-lib_path.patch
68f86033fc2a98c81d83f65c39b9f4b9417d02b70dbced18bf6f8aa9bb327baf66e33d55b381849363fb9c87a2f757a22588d53fa0e1689f21daf802273096c4  iptables-version.patch
"
