summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile41
-rwxr-xr-xsrc/configure16
2 files changed, 36 insertions, 21 deletions
diff --git a/src/Makefile b/src/Makefile
index 8e3205b..1c9c1ef 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -103,34 +103,38 @@ cleanall: clean
manpage:
$(MAKE) --directory="../doc/" manpage
-install: all install-bin install-etc install-man
+install: all install-bin install-etc install-examples install-man
install-bin: $(EXECUTABLE)
$(INSTALL) -d $(DESTDIR)$(SBINDIR)
$(INSTALL) -m 755 $(EXECUTABLE) $(DESTDIR)$(SBINDIR)
install-etc:
- $(INSTALL) -d $(DESTDIR)$(ETCDIR)/uanytun
- $(INSTALL) -m 644 ../etc/uanytun/autostart $(DESTDIR)$(ETCDIR)/uanytun/autostart
- @( cd '../etc/uanytun/' ; \
- for dir in `ls`; do \
- if [ -d $$dir ]; then \
- echo "install $$dir configuration" ; \
- cd $$dir ; \
- $(INSTALL) -d $(DESTDIR)$(ETCDIR)/uanytun/$$dir ; \
- $(INSTALL) -m 600 config $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
- if [ -e 'post-up.sh' ]; then \
- $(INSTALL) -m 755 post-up.sh $(DESTDIR)$(ETCDIR)/uanytun/$$dir/post-up.sh ; \
- fi ; \
- cd .. ; \
- fi ; \
- done \
- )
+ $(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 ../etc/init.d/uanytun $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
@ sed -i 's#DAEMON=/usr/sbin/uanytun#DAEMON=$(SBINDIR)/$(EXECUTABLE)#' $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
@ sed -i 's#CONFIG_DIR=/etc/uanytun#CONFIG_DIR=$(ETCDIR)/uanytun#' $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
+install-examples:
+ $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)
+ $(INSTALL) -m 644 ../etc/uanytun/autostart $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/autostart
+ @( cd '../etc/uanytun/' ; \
+ for dir in `ls`; do \
+ if [ -d $$dir ]; then \
+ echo "install $$dir configuration" ; \
+ cd $$dir ; \
+ $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/$$dir ; \
+ $(INSTALL) -m 600 config $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/$$dir/config ; \
+ if [ -e 'post-up.sh' ]; then \
+ $(INSTALL) -m 755 post-up.sh $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/$$dir/post-up.sh ; \
+ fi ; \
+ cd .. ; \
+ fi ; \
+ done \
+ )
+
install-man: manpage
$(INSTALL) -d $(DESTDIR)$(MANDIR)/man8/
$(INSTALL) -m 644 ../doc/uanytun.8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
@@ -142,6 +146,7 @@ remove:
rm -f $(DESTDIR)$(SBINDIR)/$(EXECUTABLE)
rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8.gz
rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
+ rm -rf $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/
purge: remove
- rm -rf $(DESTDIR)$(ETCDIR)/uanytun/
+ rm -rf $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/
diff --git a/src/configure b/src/configure
index 075d8f5..69eb03f 100755
--- a/src/configure
+++ b/src/configure
@@ -49,6 +49,7 @@ PREFIX='/usr/local'
SBINDIR=''
ETCDIR=''
MANDIR=''
+EXAMPLES=''
print_usage() {
echo "configure --help print this"
@@ -57,6 +58,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"
@@ -84,6 +86,9 @@ do
--mandir=*)
MANDIR=${arg#--mandir=}
;;
+ --examplesdir=*)
+ EXAMPLESDIR=${arg#--examplesdir=}
+ ;;
--use-ssl-crypto)
CRYPTO_LIB='ssl'
;;
@@ -177,15 +182,19 @@ if [ $V4_MAPPED -eq 0 ]; then
fi
if [ -z "$SBINDIR" ]; then
- SBINDIR=$PREFIX/sbin
+ SBINDIR=$PREFIX/sbin
fi
if [ -z "$ETCDIR" ]; then
- ETCDIR=$PREFIX/etc
+ ETCDIR=$PREFIX/etc
fi
if [ -z "$MANDIR" ]; then
- MANDIR=$PREFIX/share/man
+ MANDIR=$PREFIX/share/man
+fi
+
+if [ -z "$EXAMPLESDIR" ]; then
+ EXAMPLESDIR=$PREFIX/share/examples
fi
cat >> include.mk <<EOF
@@ -204,6 +213,7 @@ PREFIX := $PREFIX
SBINDIR := $SBINDIR
ETCDIR := $ETCDIR
MANDIR := $MANDIR
+EXAMPLESDIR := $EXAMPLESDIR
EOF
exit 0