summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2010-12-05 09:05:18 +0000
committerChristian Pointner <equinox@spreadspace.org>2010-12-05 09:05:18 +0000
commit05c14c6459b2c60f281f1ff5e09a21acbae5e84c (patch)
tree6bdda25abd50a31e44b6783641f13f08c8f30212
parentcleaned parser a bit (diff)
fixed install target
added initscript and default file referring to rinetd in manpage git-svn-id: https://svn.spreadspace.org/tcpproxy/trunk@31 e61f0598-a718-4e21-a8f0-0aadfa62ad6b
-rw-r--r--contrib/default5
-rw-r--r--contrib/example.conf (renamed from example.conf)0
-rwxr-xr-xcontrib/initscript53
-rw-r--r--doc/tcpproxy.821
-rw-r--r--doc/tcpproxy.8.txt2
-rw-r--r--src/Makefile23
-rwxr-xr-xsrc/configure16
7 files changed, 96 insertions, 24 deletions
diff --git a/contrib/default b/contrib/default
new file mode 100644
index 0000000..92cc10d
--- /dev/null
+++ b/contrib/default
@@ -0,0 +1,5 @@
+# tcpproxy configuration
+#
+# see tcpproxy man page for available options
+#
+DAEMON_ARGS="-u tcpproxy -g tcpproxy"
diff --git a/example.conf b/contrib/example.conf
index 647fd44..647fd44 100644
--- a/example.conf
+++ b/contrib/example.conf
diff --git a/contrib/initscript b/contrib/initscript
new file mode 100755
index 0000000..75c9627
--- /dev/null
+++ b/contrib/initscript
@@ -0,0 +1,53 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: tcpproxy
+# Required-Start: $remote_fs $network $named $syslog
+# Required-Stop: $remote_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start tcp-proxy daemon at boot time
+# Description: Enables tcp proxying between ipv4 and ipv6
+### END INIT INFO
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/bin/tcpproxy
+CONFFILE=/etc/tcpproxy.conf
+PIDFILE=/var/run/tcpproxy.pid
+NAME=tcpproxy
+DESC="tcp proxy server"
+DAEMON_ARGS=""
+
+test -x $DAEMON || exit 0
+
+# Include tcpproxy defaults if available
+if [ -f /etc/default/tcpproxy ] ; then
+ . /etc/default/tcpproxy
+fi
+
+set -e
+case "$1" in
+ start)
+ echo -n "Starting $DESC"
+ start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_ARGS --write-pid $PIDFILE && echo -n " $NAME"
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping $DESC"
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON && echo -n " $NAME"
+ echo "."
+ ;;
+ reload|force-reload|restart)
+ echo -n "Stopping $DESC"
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON && echo -n " $NAME"
+ echo "."
+ sleep 1
+ echo -n "Starting $DESC"
+ start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_ARGS --write-pid $PIDFILE && echo -n " $NAME"
+ echo "."
+ ;;
+ *)
+ echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/doc/tcpproxy.8 b/doc/tcpproxy.8
index c0d9729..46609ec 100644
--- a/doc/tcpproxy.8
+++ b/doc/tcpproxy.8
@@ -1,13 +1,22 @@
'\" t
.\" Title: tcpproxy
.\" Author: [see the "AUTHORS" section]
-.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
-.\" Date: 12/03/2010
-.\" Manual: tcpproxy user manual
-.\" Source: tcpproxy trunk
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\" Date: 12/05/2010
+.\" Manual: \ \&
+.\" Source: \ \&
.\" Language: English
.\"
-.TH "TCPPROXY" "8" "12/03/2010" "tcpproxy trunk" "tcpproxy user manual"
+.TH "TCPPROXY" "8" "12/05/2010" "\ \&" "\ \&"
+.\" -----------------------------------------------------------------
+.\" * Define some portability stuff
+.\" -----------------------------------------------------------------
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.\" http://bugs.debian.org/507673
+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
@@ -201,7 +210,7 @@ Everything between the curly brackets except for the \fBremote\fR parameter may
Most likely there are some bugs in \fBtcpproxy\fR\&. If you find a bug, please let the developers know at tcpproxy@spreadspace\&.org\&. Of course, patches are preferred\&.
.SH "SEE ALSO"
.sp
-nothing yet\&.\&.
+rinetd(8)
.SH "AUTHORS"
.sp
Christian Pointner <equinox@spreadspace\&.org>
diff --git a/doc/tcpproxy.8.txt b/doc/tcpproxy.8.txt
index c6574d1..6af05d0 100644
--- a/doc/tcpproxy.8.txt
+++ b/doc/tcpproxy.8.txt
@@ -150,7 +150,7 @@ the developers know at tcpproxy@spreadspace.org. Of course, patches are preferre
SEE ALSO
--------
-nothing yet..
+rinetd(8)
AUTHORS
diff --git a/src/Makefile b/src/Makefile
index 7ee758e..5a4cebf 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -90,7 +90,6 @@ clean:
rm -f cfg_scan.c
rm -f cfg_parse.c cfg_parse.h
rm -f $(EXECUTABLE)
- rm -f $(EXECUTABLE).exe
cleanall: clean
$(MAKE) --directory="../doc/" clean
@@ -99,8 +98,8 @@ manpage:
$(MAKE) --directory="../doc/" manpage
-INSTALL_TARGETS := install-bin #install-etc
-REMOVE_TARGETS := remove-bin #remove-etc
+INSTALL_TARGETS := install-bin install-etc
+REMOVE_TARGETS := remove-bin remove-etc
ifdef MANDIR
INSTALL_TARGETS += install-man
@@ -115,15 +114,20 @@ endif
install: all $(INSTALL_TARGETS)
install-bin: $(EXECUTABLE)
- $(INSTALL) -d $(DESTDIR)$(SBINDIR)
- $(INSTALL) -m 755 $(EXECUTABLE) $(DESTDIR)$(SBINDIR)
+ $(INSTALL) -d $(DESTDIR)$(BINDIR)
+ $(INSTALL) -m 755 $(EXECUTABLE) $(DESTDIR)$(BINDIR)
install-etc:
- $(INSTALL) -d $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)
- @ echo "example configurations can be found at $(EXAMPLESDIR)/$(EXECUTABLE)" > $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/README
+ $(INSTALL) -d $(DESTDIR)$(ETCDIR)/init.d/
+ $(INSTALL) -m 755 ../contrib/initscript $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
+ $(INSTALL) -d $(DESTDIR)$(ETCDIR)/default/
+ $(INSTALL) -m 644 ../contrib/default $(DESTDIR)$(ETCDIR)/default/$(EXECUTABLE)
+ @ echo "# $(EXECUTABLE) configuration file" > $(DESTDIR)$(ETCDIR)/$(EXECUTABLE).conf
+ @ echo "# example configurations can be found at $(EXAMPLESDIR)/$(EXECUTABLE)" >> $(DESTDIR)$(ETCDIR)/$(EXECUTABLE).conf
install-examples:
$(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)
+ $(INSTALL) -m 644 ../contrib/example.conf $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/
install-man: manpage
$(INSTALL) -d $(DESTDIR)$(MANDIR)/man8/
@@ -134,7 +138,7 @@ uninstall: remove
remove: $(REMOVE_TARGETS)
remove-bin:
- rm -f $(DESTDIR)$(SBINDIR)/$(EXECUTABLE)
+ rm -f $(DESTDIR)$(BINDIR)/$(EXECUTABLE)
remove-etc:
rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
@@ -146,4 +150,5 @@ remove-man:
rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
purge: remove
- rm -rf $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/
+ rm -f $(DESTDIR)$(ETCDIR)/$(EXECUTABLE).conf
+ rm -f $(DESTDIR)$(ETCDIR)/default/$(EXECUTABLE)
diff --git a/src/configure b/src/configure
index 4afa358..b07190b 100755
--- a/src/configure
+++ b/src/configure
@@ -33,7 +33,7 @@ CFLAGS='-g -O2'
LDFLAGS='-g -Wall -O2'
PREFIX='/usr/local'
-SBINDIR=''
+BINDIR=''
ETCDIR=''
MANDIR=''
INSTALLMANPAGE=1
@@ -44,7 +44,7 @@ print_usage() {
echo "configure --help print this"
echo " --target=<TARGET> build target i.e. Linux (default: autodetect)"
echo " --prefix=<PREFIX> the installation prefix (default: /usr/local)"
- echo " --sbindir=<DIR> the path to the sbin directory (default: $PREFIX/sbin)"
+ echo " --bindir=<DIR> the path to the bin directory (default: $PREFIX/bin)"
echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc"
echo " --mandir=<DIR> the path to the system man pages (default: $PREFIX/share/man)"
echo " --no-manpage dont't install manpage"
@@ -61,8 +61,8 @@ do
--prefix=*)
PREFIX=${arg#--prefix=}
;;
- --sbindir=*)
- SBINDIR=${arg#--sbindir=}
+ --bindir=*)
+ BINDIR=${arg#--bindir=}
;;
--sysconfdir=*)
ETCDIR=${arg#--sysconfdir=}
@@ -116,8 +116,8 @@ case $TARGET in
;;
esac
-if [ -z "$SBINDIR" ]; then
- SBINDIR=$PREFIX/sbin
+if [ -z "$BINDIR" ]; then
+ BINDIR=$PREFIX/bin
fi
if [ -z "$ETCDIR" ]; then
@@ -147,7 +147,7 @@ FLEX := flex
BISON := bison
PREFIX := '$PREFIX'
-SBINDIR := '$SBINDIR'
+BINDIR := '$BINDIR'
ETCDIR := '$ETCDIR'
EOF
@@ -193,7 +193,7 @@ cat >> config.h <<EOF
#define TARGET "$TARGET"
#define PREFIX "$PREFIX"
-#define SBINDIR "$SBINDIR"
+#define BINDIR "$BINDIR"
#define ETCDIR "$ETCDIR"
#define CONFFILE "$ETCDIR/tcpproxy.conf"