1SUMMARY = "Filtering tool for a Linux-based bridging firewall"
2HOMEPAGE = "http://sourceforge.net/projects/ebtables/"
3DESCRIPTION = "Utility for basic Ethernet frame filtering on a Linux bridge, \
4               advanced logging, MAC DNAT/SNAT and brouting."
5LICENSE = "GPL-2.0-only"
6LIC_FILES_CHKSUM = "file://COPYING;md5=53b4a999993871a28ab1488fdbd2e73e"
7SECTION = "net"
8
9RDEPENDS:${PN} += "bash"
10
11RRECOMMENDS:${PN} += "kernel-module-ebtables \
12    "
13
14SRC_URI = "http://ftp.netfilter.org/pub/ebtables/ebtables-${PV}.tar.gz \
15           file://0001-Makefile.am-do-not-install-etc-ethertypes.patch \
16           file://ebtables-legacy-save \
17           file://ebtables.common \
18           file://ebtables.service \
19           "
20
21SRC_URI:append:libc-musl = " file://0010-Adjust-header-include-sequence.patch"
22
23SRC_URI[md5sum] = "071c8b0a59241667a0044fb040d4fc72"
24SRC_URI[sha256sum] = "b71f654784a726329f88b412ef7b96b4e5d786ed2bd28193ed7b4c0d677dfd2a"
25
26inherit systemd autotools
27
28do_install:append () {
29	# Replace upstream ebtables-save perl script with Fedora bash based rewrite
30	# http://pkgs.fedoraproject.org/cgit/rpms/ebtables.git/tree/ebtables-save
31	rm -f ${D}${sbindir}/ebtables-legacy-save
32	install -m 0755 ${WORKDIR}/ebtables-legacy-save ${D}${sbindir}/ebtables-legacy-save
33
34	# Install systemd service files
35	if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
36		install -d ${D}${systemd_unitdir}/system
37		install -m 0644 ${WORKDIR}/ebtables.service ${D}${systemd_unitdir}/system
38		sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/ebtables.service
39		install -m 0755 ${WORKDIR}/ebtables.common ${D}${sbindir}/ebtables.common
40	fi
41
42	install -d ${D}${base_sbindir}
43	ln -sf ${sbindir}/ebtables-legacy ${D}${base_sbindir}/ebtables
44}
45
46do_configure:prepend () {
47    ( cd ${S}; ./autogen.sh )
48}
49
50FILES:${PN}-dbg += "${base_libdir}/ebtables/.debug"
51FILES:${PN} += "${base_libdir}/ebtables/*.so"
52
53SYSTEMD_SERVICE:${PN} = "ebtables.service"
54