diff options
-rw-r--r-- | src/Makefile | 68 | ||||
-rwxr-xr-x | src/configure | 10 |
2 files changed, 44 insertions, 34 deletions
diff --git a/src/Makefile b/src/Makefile index bb2b0c4..522ba7c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -198,7 +198,7 @@ clean: manpage: @cd man ; $(MAKE) -install: all install-bin install-etc install-man +install: all install-bin install-etc install-examples install-man install-bin: $(EXECUTABLES) $(INSTALL) -d $(DESTDIR)$(SBINDIR) @@ -210,31 +210,7 @@ install-bin: $(EXECUTABLES) install-etc: $(INSTALL) -d $(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 ; \ - $(INSTALL) -d $(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 \ - $(INSTALL) -d $(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 \ - ) + @ echo "example configurations can be found at $(EXAMPLESDIR)/anytun" > $(DESTDIR)$(ETCDIR)/anytun/README $(INSTALL) -d $(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 @@ -242,17 +218,40 @@ install-etc: @ 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-examples: + $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun + $(INSTALL) -m 644 ../etc/anytun/autostart $(DESTDIR)$(EXAMPLESDIR)/anytun/autostart + @( cd '../etc/anytun/' ; \ + for dir in `ls`; do \ + if [ -d $$dir ]; then \ + echo "install $$dir configuration" ; \ + cd $$dir ; \ + $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir ; \ + $(INSTALL) -m 600 config $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/config ; \ + if [ -e 'post-up.sh' ]; then \ + $(INSTALL) -m 755 post-up.sh $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/post-up.sh ; \ + fi ; \ + if [ -d 'conf.d' ]; then \ + $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/conf.d ; \ + cd conf.d ; \ + for file in `ls`; do \ + if [ -f $$file ]; then \ + $(INSTALL) -m 644 $$file $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/conf.d ; \ + fi ; \ + done ; \ + cd .. ; \ + fi ; \ + cd .. ; \ + fi ; \ + done \ + ) install-man: manpage $(INSTALL) -d $(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 uninstall: remove @@ -261,11 +260,12 @@ remove: 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)$(MANDIR)/man8/anytun.8 + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-config.8 + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-controld.8 + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-showtables.8 rm -f $(DESTDIR)$(ETCDIR)/init.d/anytun + rm -rf $(DESTDIR)$(EXAMPLESDIR)/anytun/ purge: remove rm -rf $(DESTDIR)$(ETCDIR)/anytun/ diff --git a/src/configure b/src/configure index 77002f3..cfffbe7 100755 --- a/src/configure +++ b/src/configure @@ -47,6 +47,7 @@ BINDIR='' SBINDIR='' ETCDIR='' MANDIR='' +EXAMPLESDIR='' print_usage() { echo "configure --help print this" @@ -56,6 +57,7 @@ print_usage() { 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 " --examplesdir=<DIR> the path to the examples files (default: $PREFIX/share/examples)" echo " --use-ssl-crypto use ssl crypto library instead of libgcrypt" echo " --no-crypto disable crypto at all (only NULL cipher)" echo " --disable-passphrase disable master key and salt passphrase" @@ -85,6 +87,9 @@ do --mandir=*) MANDIR=${arg#--mandir=} ;; + --examplesdir=*) + EXAMPLESDIR=${arg#--examplesdir=} + ;; --use-ssl-crypto) CRYPTO_LIB='ssl' ;; @@ -189,6 +194,10 @@ if [ -z "$MANDIR" ]; then MANDIR=$PREFIX/share/man fi +if [ -z "$EXAMPLESDIR" ]; then + EXAMPLESDIR=$PREFIX/share/examples +fi + cat >> include.mk <<EOF # this file was created automatically # do not edit this file directly @@ -207,6 +216,7 @@ BINDIR := $BINDIR SBINDIR := $SBINDIR ETCDIR := $ETCDIR MANDIR := $MANDIR +EXAMPLESDIR := $EXAMPLESDIR EOF exit 0 |