diff options
Diffstat (limited to 'community/arptables')
-rw-r--r-- | community/arptables/PKGBUILD | 38 | ||||
-rw-r--r-- | community/arptables/arptables.rc | 58 |
2 files changed, 96 insertions, 0 deletions
diff --git a/community/arptables/PKGBUILD b/community/arptables/PKGBUILD new file mode 100644 index 000000000..172baf2bd --- /dev/null +++ b/community/arptables/PKGBUILD @@ -0,0 +1,38 @@ +# $Id: PKGBUILD 59644 2011-11-29 01:04:59Z seblu $ +# Maintainer: Sebastien Luttringer <seblu+arch@seblu.net +# Contributor: Daniel Micay <danielmicay@gmail.com> +# Contributor: Michal Soltys <soltys@ziu.info> + +pkgname=arptables +pkgver=0.0.3_4 +pkgrel=1 +pkgdesc='ARP filtering utility' +arch=('i686' 'x86_64') +url='http://ebtables.sourceforge.net/' +license=('GPL') +source=("http://downloads.sourceforge.net/ebtables/$pkgname-v${pkgver//_/-}.tar.gz" 'arptables.rc') +md5sums=('1d4ab05761f063b0751645d8f2b8f8e5' + 'f8c0ecad9151a16347c133e043232d4a') + +build() { + cd $pkgname-v${pkgver//_/-} + make +} + +package() { + # install rc script + install -D -m 0755 arptables.rc "$pkgdir/etc/rc.d/arptables" + + # setup arptables + cd $pkgname-v${pkgver//_/-} + make install \ + DESTDIR="$pkgdir" \ + PREFIX=/usr \ + LIBDIR=/usr/lib/arptables \ + BINDIR=/usr/sbin \ + MANDIR=/usr/share/man \ + INITDIR=/etc/rc.d \ + SYSCONFIGDIR=/etc/arptables +} + +# vim:set ts=2 sw=2 ft=sh et: diff --git a/community/arptables/arptables.rc b/community/arptables/arptables.rc new file mode 100644 index 000000000..dae90ac2a --- /dev/null +++ b/community/arptables/arptables.rc @@ -0,0 +1,58 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +[[ -x /usr/sbin/arptables ]] || exit 1 +[[ -x /usr/sbin/arptables-save ]] || exit 1 +[[ -x /usr/sbin/arptables-restore ]] || exit 1 + +do_start() { + stat_busy "Restore arptables rules" + if [[ -r /etc/arptables/arptables ]]; then + /usr/sbin/arptables-restore </etc/arptables/arptables + (( $? == 0 )) && stat_done && add_daemon arptables && return + fi + stat_fail +} + +do_stop() { + stat_busy "Flushing arptables rules" + /usr/sbin/arptables-restore </dev/null + if (( $? == 0 )); then + stat_done + rm_daemon arptables + else + stat_fail + fi +} + +do_save() { + stat_busy "Saving arptables rules" + /usr/sbin/arptables-save >/etc/arptables/arptables + (( $? == 0 )) && stat_done || stat_fail +} + +case "$1" in + start) + do_start + ;; + stop) + do_stop + ;; + restart) + do_stop + do_start + ;; + save) + do_save + ;; + status) + /usr/sbin/arptables-save + ;; + *) + echo "Usage $0 {start|stop|restart|save|status}" >&2 + exit 1 +esac + +# vim:set ts=2 sw=2 ft=sh et: |