diff options
-rw-r--r-- | etc/anytun/client1/config | 4 | ||||
-rw-r--r-- | etc/anytun/client2/config | 4 | ||||
-rw-r--r-- | etc/anytun/client3/config | 4 | ||||
-rw-r--r-- | etc/anytun/p2p-a/config | 4 | ||||
-rw-r--r-- | etc/anytun/p2p-b/config | 4 | ||||
-rw-r--r-- | etc/anytun/server/config | 4 | ||||
-rw-r--r-- | src/Makefile | 83 | ||||
-rwxr-xr-x | src/configure | 62 |
8 files changed, 150 insertions, 19 deletions
diff --git a/etc/anytun/client1/config b/etc/anytun/client1/config index da11356..dec6c97 100644 --- a/etc/anytun/client1/config +++ b/etc/anytun/client1/config @@ -53,8 +53,8 @@ remote-port 4444 log syslog:3,anytun-client1,daemon ## change user and group after init -username anytun -groupname anytun +#username anytun +#groupname anytun ## chroot to users home directory #chroot /var/run/anytun diff --git a/etc/anytun/client2/config b/etc/anytun/client2/config index ff9bab7..adc1cfa 100644 --- a/etc/anytun/client2/config +++ b/etc/anytun/client2/config @@ -53,8 +53,8 @@ remote-port 4444 log syslog:3,anytun-client2,daemon ## change user and group after init -username anytun -groupname anytun +#username anytun +#groupname anytun ## chroot to users home directory #chroot /var/run/anytun diff --git a/etc/anytun/client3/config b/etc/anytun/client3/config index c5f529c..9714a51 100644 --- a/etc/anytun/client3/config +++ b/etc/anytun/client3/config @@ -53,8 +53,8 @@ remote-port 4444 log syslog:3,anytun-client3,daemon ## change user and group after init -username anytun -groupname anytun +#username anytun +#groupname anytun ## chroot to users home directory #chroot /var/run/anytun diff --git a/etc/anytun/p2p-a/config b/etc/anytun/p2p-a/config index 126f918..d7d25b0 100644 --- a/etc/anytun/p2p-a/config +++ b/etc/anytun/p2p-a/config @@ -61,8 +61,8 @@ remote-port 4445 log syslog:3,anytun-p2p-a,daemon ## change user and group after init -username anytun -groupname anytun +#username anytun +#groupname anytun ## chroot to users home directory #chroot /var/run/anytun diff --git a/etc/anytun/p2p-b/config b/etc/anytun/p2p-b/config index 859b26d..6f2d7a3 100644 --- a/etc/anytun/p2p-b/config +++ b/etc/anytun/p2p-b/config @@ -61,8 +61,8 @@ remote-port 4445 log syslog:3,anytun-p2p-b,daemon ## change user and group after init -username anytun -groupname anytun +#username anytun +#groupname anytun ## chroot to users home directory #chroot /var/run/anytun diff --git a/etc/anytun/server/config b/etc/anytun/server/config index 977c579..1e5786a 100644 --- a/etc/anytun/server/config +++ b/etc/anytun/server/config @@ -55,8 +55,8 @@ port 4444 log syslog:3,anytun-server,daemon ## change user and group after init -username anytun -groupname anytun +#username anytun +#groupname anytun ## chroot to /var/run/anytun #chroot /var/run/anytun diff --git a/src/Makefile b/src/Makefile index 5b13efd..b83439e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -102,7 +102,7 @@ ANYCONFOBJS := log.o \ syncConnectionCommand.o \ resolver.o -EXECUTABLE := anytun anytun-config anytun-controld anytun-showtables anytun-nosync +EXECUTABLES := anytun anytun-config anytun-controld anytun-showtables anytun-nosync EXEOBJS := anytun.o anytun-config.o anytun-controld.o anytun-showtables.o SRCS := $(OBJS:%.o=%.cpp) @@ -113,7 +113,7 @@ EXESRCS := $(EXEOBJS:%.o=%.cpp) .PHONY: distclean cleanall clean ctags -all: $(EXECUTABLE) #libAnysync.a +all: $(EXECUTABLES) #libAnysync.a %.d: %.cpp @set -e; rm -f $@; \ @@ -125,8 +125,8 @@ ifneq ($(MAKECMDGOALS),distclean) -include $(SRCS:%.cpp=%.d) $(SYNCSRCS:%.cpp=%.d) $(ANYCTRSRCS:%.cpp=%.d) $(ANYCONFSRCS:%.cpp=%.d) $(EXESRCS:%.cpp=%.d) endif -strip: $(EXECUTABLE) - strip -s $(EXECUTABLE) +strip: $(EXECUTABLES) + strip -s $(EXECUTABLES) anytun: $(OBJS) $(SYNCOBJS) anytun.o $(LD) $(OBJS) $(SYNCOBJS) anytun.o -o $@ $(LDFLAGS) @@ -188,7 +188,7 @@ clean: rm -f *.o rm -f *.d rm -f *.d.* - rm -f $(EXECUTABLE) + rm -f $(EXECUTABLES) rm -f anytun-nosync rm -f -r doc/html/* rm -f -r doc/latex/* @@ -198,3 +198,76 @@ clean: manpage: @cd man ; $(MAKE) +install: all install-bin install-etc install-man + +install-bin: $(EXECUTABLES) + mkdir -p $(DESTDIR)$(SBINDIR) + install -m 755 anytun $(DESTDIR)$(SBINDIR) + $(STRIP) $(DESTDIR)$(SBINDIR)/anytun + mkdir -p $(DESTDIR)$(BINDIR) + install -m 755 anytun-config $(DESTDIR)$(BINDIR) + $(STRIP) $(DESTDIR)$(BINDIR)/anytun-config + install -m 755 anytun-controld $(DESTDIR)$(BINDIR) + $(STRIP) $(DESTDIR)$(BINDIR)/anytun-controld + install -m 755 anytun-showtables $(DESTDIR)$(BINDIR) + $(STRIP) $(DESTDIR)$(BINDIR)/anytun-showtables + +install-etc: + mkdir -p $(DESTDIR)$(ETCDIR)/anytun + install -m 644 ../etc/anytun/autostart $(DESTDIR)$(ETCDIR)/anytun/autostart + @( cd '../etc/anytun/' ; \ + for dir in `ls`; do \ + if [ -d $$dir ]; then \ + echo "install $$dir configuration" ; \ + cd $$dir ; \ + mkdir -p $(DESTDIR)$(ETCDIR)/anytun/$$dir ; \ + install -m 600 config $(DESTDIR)$(ETCDIR)/anytun/$$dir/config ; \ + if [ -e 'post-up.sh' ]; then \ + install -m 755 post-up.sh $(DESTDIR)$(ETCDIR)/anytun/$$dir/post-up.sh ; \ + fi ; \ + if [ -d 'conf.d' ]; then \ + mkdir -p $(DESTDIR)$(ETCDIR)/anytun/$$dir/conf.d ; \ + cd conf.d ; \ + for file in `ls`; do \ + if [ -f $$file ]; then \ + install -m 644 $$file $(DESTDIR)$(ETCDIR)/anytun/$$dir/conf.d ; \ + fi ; \ + done ; \ + cd .. ; \ + fi ; \ + cd .. ; \ + fi ; \ + done \ + ) + mkdir -p $(DESTDIR)$(ETCDIR)/init.d + install -m 755 ../etc/init.d/anytun $(DESTDIR)$(ETCDIR)/init.d/anytun + @ sed -i 's#DAEMON=/usr/sbin/anytun#DAEMON=$(SBINDIR)/anytun#' $(DESTDIR)$(ETCDIR)/init.d/anytun + @ sed -i 's#ANYTUNCONFIG=/usr/bin/anytun-config#ANYTUNCONFIG=$(BINDIR)/anytun-config#' $(DESTDIR)$(ETCDIR)/init.d/anytun + @ sed -i 's#CONTROLDAEMON=/usr/bin/anytun-controld#CONTROLDAEMON=$(BINDIR)/anytun-controld#' $(DESTDIR)$(ETCDIR)/init.d/anytun + @ sed -i 's#CONFIG_DIR=/etc/anytun#CONFIG_DIR=$(ETCDIR)/anytun#' $(DESTDIR)$(ETCDIR)/init.d/anytun + + +install-man: manpage + mkdir -p $(DESTDIR)$(MANDIR)/man8/ + install -m 644 man/anytun.8 $(DESTDIR)$(MANDIR)/man8/ + gzip $(DESTDIR)$(MANDIR)/man8/anytun.8 + install -m 644 man/anytun-config.8 $(DESTDIR)$(MANDIR)/man8/ + gzip $(DESTDIR)$(MANDIR)/man8/anytun-config.8 + install -m 644 man/anytun-controld.8 $(DESTDIR)$(MANDIR)/man8/ + gzip $(DESTDIR)$(MANDIR)/man8/anytun-controld.8 + install -m 644 man/anytun-showtables.8 $(DESTDIR)$(MANDIR)/man8/ + gzip $(DESTDIR)$(MANDIR)/man8/anytun-showtables.8 + +remove: + rm -f $(DESTDIR)$(SBINDIR)/anytun + rm -f $(DESTDIR)$(BINDIR)/anytun-config + rm -f $(DESTDIR)$(BINDIR)/anytun-controld + rm -f $(DESTDIR)$(BINDIR)/anytun-showtables + rm -f $(DESTDIR)$(MANDIR)/man8/anytun.8.gz + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-config.8.gz + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-controld.8.gz + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-showtables.8.gz + rm -f $(DESTDIR)$(ETCDIR)/init.d/anytun + +purge: remove + rm -rf $(DESTDIR)$(ETCDIR)/anytun/ diff --git a/src/configure b/src/configure index d05edfd..762315e 100755 --- a/src/configure +++ b/src/configure @@ -40,26 +40,61 @@ CRYPTO_LIB='gcrypt' PASSPHRASE=1 ROUTING=1 +PREFIX='/usr/local' +BINDIR='' +SBINDIR='' +ETCDIR='' +MANDIR='' + 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 " --bindir=<DIR> the path to the bin directory (default: $PREFIX/bin)" + echo " --sbindir=<DIR> the path to the sbin directory (default: $PREFIX/sbin)" + 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 " --use-ssl-crypto use ssl crypto library instead of libgcrypt" - echo " --disable-crypto disable crypto at all (only NULL cipher)" + echo " --no-crypto disable crypto at all (only NULL cipher)" echo " --disable-passphrase disable master key and salt passphrase" + echo " --enable-passphrase enable master key and salt passphrase" echo " --disable-routing disable built-in routing capability" + echo " --enable-routing enable built-in routing capability" } for arg do case $arg in + --target=*) + TARGET=${arg#--target=} + ;; + --prefix=*) + PREFIX=${arg#--prefix=} + ;; + --sbindir=*) + SBINDIR=${arg#--sbindir=} + ;; + --sysconfdir=*) + ETCDIR=${arg#--sysconfdir=} + ;; + --mandir=*) + MANDIR=${arg#--mandir=} + ;; --use-ssl-crypto) CRYPTO_LIB='ssl' ;; - --disable-crypto) + --no-crypto) CRYPTO_LIB='none' ;; + --enable-passphrase) + PASSPHRASE=1 + ;; --disable-passphrase) PASSPHRASE=0 ;; + --enable-routing) + ROUTING=1 + ;; --disable-routing) ROUTING=0 ;; @@ -122,6 +157,22 @@ if [ $ROUTING -eq 0 ]; then echo "disabling built-in routing capability" fi +if [ -z "$BINDIR" ]; then + BINDIR=$PREFIX/bin +fi + +if [ -z "$SBINDIR" ]; then + SBINDIR=$PREFIX/sbin +fi + +if [ -z "$ETCDIR" ]; then + ETCDIR=$PREFIX/etc +fi + +if [ -z "$MANDIR" ]; then + MANDIR=$PREFIX/share/man +fi + cat >> include.mk <<EOF # this file was created automatically # do not edit this file directly @@ -132,6 +183,13 @@ CXX = gcc CXXFLAGS = $CXXFLAGS LD = gcc LDFLAGS = $LDFLAGS +STRIP = strip + +PREFIX := $PREFIX +BINDIR := $BINDIR +SBINDIR := $SBINDIR +ETCDIR := $ETCDIR +MANDIR := $MANDIR EOF exit 0 |