diff --git a/ebtables/PKGBUILD b/ebtables/PKGBUILD new file mode 100644 index 000000000..7bbb4c21e --- /dev/null +++ b/ebtables/PKGBUILD @@ -0,0 +1,53 @@ + +pkgname=ebtables +pkgver=2.0.10_4 +pkgrel=3 +pkgdesc='Ethernet bridge filtering utilities' +arch=('x86_64') +url='http://ebtables.sourceforge.net/' +license=('GPL2') +backup=("etc/$pkgname.conf" "etc/conf.d/$pkgname") +# ebtables segfault with --as-needed +options=('!buildflags') +install=$pkgname.install +source=("http://downloads.sourceforge.net/${pkgname}/${pkgname}-v${pkgver/_/-}.tar.gz" + "$pkgname.conf" + "$pkgname.rc" + "$pkgname.systemd" + "$pkgname.service") +md5sums=('506742a3d44b9925955425a659c1a8d0' + 'c6f0838de4429af68d21b4d61f00db59' + 'd0e340f2cefe91b1569c0e87c2a1288f' + '5a49ea09af202cb438c8a1b15abf9147' + 'baf923443c3b16277e50d60d2e68f534') + +build() { + cd $pkgname-v${pkgver/_/-} + make CFLAGS='-Wunused -Wall -Werror -Wno-error=unused-but-set-variable' +} + +package() { + pushd $pkgname-v${pkgver/_/-} + make install \ + DESTDIR="$pkgdir" \ + LIBDIR=/usr/lib \ + MANDIR=/usr/share/man \ + BINDIR=/usr/sbin \ + INITDIR=/etc/rc.d \ + SYSCONFIGDIR=/etc + popd + # rm package ebtables rc.d scripts + rm "$pkgdir/etc/ebtables-config" + # install initscripts + install -Dm 755 $pkgname.rc "$pkgdir/etc/rc.d/$pkgname" + install -Dm 644 $pkgname.conf "$pkgdir/etc/conf.d/$pkgname" + # install systemd service + install -Dm 755 $pkgname.systemd \ + "$pkgdir/usr/lib/systemd/scripts/$pkgname" + install -Dm 644 $pkgname.service \ + "$pkgdir/usr/lib/systemd/system/$pkgname.service" + # default config file + install -Dm 644 /dev/null "$pkgdir/etc/$pkgname.conf" +} + +# vim:set ts=2 sw=2 ft=sh et: diff --git a/ebtables/ebtables.conf b/ebtables/ebtables.conf new file mode 100644 index 000000000..386f94249 --- /dev/null +++ b/ebtables/ebtables.conf @@ -0,0 +1,7 @@ +# Configuration file used to load/save configuration. +CONFIG_FILE='/etc/ebtables.conf' + +# Save configuration on stop/restart. +#SAVE_ON_STOP=yes + +# vim:set ts=2 sw=2 ft=sh et: diff --git a/ebtables/ebtables.install b/ebtables/ebtables.install new file mode 100644 index 000000000..7dd6921ed --- /dev/null +++ b/ebtables/ebtables.install @@ -0,0 +1,9 @@ +## arg 1: the new package version +## arg 2: the old package version +post_upgrade() { + [ $(vercmp "$2" '2.0.10_4-1') -gt 0 ] || cat < "$CONFIG_FILE" && stat_done || stat_die + ;; + *) + echo "usage: ${0##*/} {start|stop|restart|save}" >&2 + exit 1 + ;; +esac + +# vim:set ts=2 sw=2 ft=sh et: diff --git a/ebtables/ebtables.service b/ebtables/ebtables.service new file mode 100644 index 000000000..25e6b76cc --- /dev/null +++ b/ebtables/ebtables.service @@ -0,0 +1,11 @@ +[Unit] +Description=Ethernet bridge table + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/lib/systemd/scripts/ebtables start +ExecStop=/usr/lib/systemd/scripts/ebtables stop + +[Install] +WantedBy=multi-user.target diff --git a/ebtables/ebtables.systemd b/ebtables/ebtables.systemd new file mode 100644 index 000000000..4c51e9b6f --- /dev/null +++ b/ebtables/ebtables.systemd @@ -0,0 +1,22 @@ +#!/bin/bash + +. /etc/conf.d/ebtables + +case $1 in + start) + ebtables-restore < "$CONFIG_FILE" + ;; + stop) + [[ $SAVE_ON_STOP =~ [yY][eE][sS] ]] && $0 save + ebtables -F + ;; + save) + ebtables-save > "$CONFIG_FILE" + ;; + *) + echo "usage: ${0##*/} {start|stop|save}" >&2 + exit 1 + ;; +esac + +# vim:set ts=2 sw=2 ft=sh et: