From b576c35b7623ef221d06e2a0d7bb477ee044ab9c Mon Sep 17 00:00:00 2001 From: Bart De Schuymer Date: Sun, 19 Aug 2007 13:03:37 +0000 Subject: install arptables.sysv,arptables-restore and arptables-save --- Makefile | 16 +++++++++++++++- arptables-restore | 8 ++------ arptables-save | 4 +--- arptables.sysv | 20 ++++++++++---------- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 11363ec..89fd6e7 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ PREFIX:=/usr/local LIBDIR:=$(PREFIX)/lib BINDIR:=$(PREFIX)/sbin MANDIR:=$(PREFIX)/man +INITDIR:=/etc/rc.d/init.d +SYSCONFIGDIR:=/etc/sysconfig DESTDIR:= COPT_FLAGS:=-O2 @@ -39,8 +41,20 @@ $(DESTDIR)$(BINDIR)/arptables: arptables mkdir -p $(DESTDIR)$(BINDIR) install -m 0755 -o root -g root $< $@ +tmp1:=$(shell printf $(BINDIR) | sed 's/\//\\\//g') +tmp2:=$(shell printf $(SYSCONFIGDIR) | sed 's/\//\\\//g') +.PHONY: scripts +scripts: arptables-save arptables-restore arptables.sysv + cat arptables-save | sed 's/__EXEC_PATH__/$(tmp1)/g' > arptables-save_ + install -m 0755 -o root -g root arptables-save_ $(DESTDIR)$(BINDIR)/arptables-save + cat arptables-restore | sed 's/__EXEC_PATH__/$(tmp1)/g' > arptables-restore_ + install -m 0755 -o root -g root arptables-restore_ $(DESTDIR)$(BINDIR)/arptables-restore + cat arptables.sysv | sed 's/__EXEC_PATH__/$(tmp1)/g' | sed 's/__SYSCONFIG__/$(tmp2)/g' > arptables.sysv_ + install -m 0755 -o root -g root arptables.sysv_ $(DESTDIR)$(INITDIR)/arptables + rm -f arptables-save_ arptables-restore_ arptables.sysv_ + .PHONY: install -install: $(DESTDIR)$(MANDIR)/man8/arptables.8 $(DESTDIR)$(BINDIR)/arptables +install: $(DESTDIR)$(MANDIR)/man8/arptables.8 $(DESTDIR)$(BINDIR)/arptables scripts .PHONY: clean clean: diff --git a/arptables-restore b/arptables-restore index d672d54..c509702 100644 --- a/arptables-restore +++ b/arptables-restore @@ -1,12 +1,8 @@ #!/usr/bin/perl -w -# -# -# A script that imports text ebtables rules. Similar to iptables-restore. -# It can be used to restore configuration from /etc/sysconfig/ebtables. -# +# A script that imports text arptables rules. Similar to iptables-restore. use strict; -my $tool = "/sbin/arptables"; +my $tool = "__EXEC_PATH__/arptables"; my $table; my $rc; my $line; diff --git a/arptables-save b/arptables-save index 84ad890..df9ad25 100644 --- a/arptables-save +++ b/arptables-save @@ -3,12 +3,10 @@ # # A script that generates text output of the arptables rules. # Similar to iptables-save. -# -# It can be used to store active configuration to /etc/sysconfig/arptables use strict; my $table; -my $tool = "/sbin/arptables"; +my $tool = "__EXEC_PATH__/arptables"; # ======================================================== # Process filter table diff --git a/arptables.sysv b/arptables.sysv index 903fd4b..ea5cf09 100644 --- a/arptables.sysv +++ b/arptables.sysv @@ -1,6 +1,6 @@ #!/bin/bash # -# init script for the arptables +# init script for arptables # # Original by Dag Wieers . # Modified/changed to arptables by @@ -9,7 +9,7 @@ # chkconfig: - 16 84 # description: Arp filtering tables # -# config: /etc/sysconfig/arptables +# config: __SYSCONFIG__/arptables source /etc/init.d/functions source /etc/sysconfig/network @@ -17,11 +17,11 @@ source /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 -[ -x /sbin/arptables ] || exit 1 -[ -x /sbin/arptables-save ] || exit 1 -[ -x /sbin/arptables-restore ] || exit 1 +[ -x __EXEC_PATH__/arptables ] || exit 1 +[ -x __EXEC_PATH__/arptables-save ] || exit 1 +[ -x __EXEC_PATH__/arptables-restore ] || exit 1 -[ "$1" == "save" -o -r /etc/sysconfig/arptables ] || exit 1 +[ "$1" != "save" -o -r __SYSCONFIG__/arptables ] || exit 1 RETVAL=0 prog="arptables" @@ -29,7 +29,7 @@ desc="Arp filtering" start() { echo -n $"Starting $desc ($prog): " - /sbin/arptables-restore < /etc/sysconfig/arptables || RETVAL=1 + __EXEC_PATH__/arptables-restore < __SYSCONFIG__/arptables || RETVAL=1 if [ $RETVAL -eq 0 ]; then success "$prog startup" @@ -44,7 +44,7 @@ start() { stop() { echo -n $"Stopping $desc ($prog): " - /sbin/arptables-restore < /dev/null || RETVAL=1 + __EXEC_PATH__/arptables-restore < /dev/null || RETVAL=1 if [ $RETVAL -eq 0 ]; then success "$prog shutdown" @@ -64,7 +64,7 @@ restart() { save() { echo -n $"Saving $desc ($prog): " - /sbin/arptables-save > /etc/sysconfig/arptables || RETVAL=1 + __EXEC_PATH__/arptables-save > __SYSCONFIG__/arptables || RETVAL=1 if [ $RETVAL -eq 0 ]; then success "$prog saved" @@ -92,7 +92,7 @@ case "$1" in save ;; status) - /sbin/arptables-save + __EXEC_PATH__/arptables-save RETVAL=$? ;; *) -- cgit v1.2.3