# Template file for 'firewalld'
pkgname=firewalld
version=2.3.0
revision=1
build_style=gnu-configure
hostmakedepends="autoconf pkg-config docbook-xsl xmlcatmgr intltool libxslt
 python3 glib-devel iptables-nft ipset"
depends="python3-gobject python3-dbus libcap-ng-python3 nftables iptables-nft ipset polkit"
short_desc="Dynamically managed firewall with support for network zones"
maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="GPL-2.0-or-later"
homepage="https://firewalld.org/"
distfiles="https://github.com/firewalld/firewalld/releases/download/v${version}/firewalld-${version}.tar.bz2"
checksum=f6ba846c92fc08aebda8dfd2856e6c6224d170a5288a2ae1c181d6a43036c009
python_version=3
conf_files="/etc/firewalld/firewalld.conf /etc/sysconfig/firewalld"
# firewalld does not believe it is root in the chroot and fails
make_check=no

post_install() {
	mv ${DESTDIR}/etc/modprobe.d ${DESTDIR}/usr/lib
	vsv ${pkgname}
}

firewalld-applet_package() {
	short_desc+=" - desktop applet"
	depends="firewalld>=${version}_${revision} python3-pyqt6-gui
	 python3-pyqt6-dbus python3-pyqt6-widgets libnotify"
	conf_files="/etc/firewall/applet.conf"
	pkg_install() {
		vmove etc/xdg/autostart/firewall-applet.desktop
		vmove usr/bin/firewall-applet
		for size in 16 22 24 32 48; do
	 		vmove "usr/share/icons/hicolor/${size}x${size}/apps/firewall-applet*"
		done
		vmove "usr/share/icons/hicolor/scalable/apps/firewall-applet*"
		vmove usr/share/man/man1/firewall-applet.1
		vmove etc/firewall/applet.conf
	}
}

firewalld-config_package() {
	short_desc+=" - configuration gui"
	depends="firewalld>=${version}_${revision} gtk+3"
	pkg_install() {
		vmove usr/bin/firewall-config
		vmove usr/share/applications/firewall-config.desktop
		vmove usr/share/firewalld/firewall-config.glade
		for size in 16 22 24 32 48; do
	 		vmove "usr/share/icons/hicolor/${size}x${size}/apps/firewall-config*"
		done
		vmove "usr/share/icons/hicolor/scalable/apps/firewall-config*"
		vmove usr/share/man/man1/firewall-config.1
		vmove usr/share/metainfo/firewall-config.appdata.xml
	}
}
