summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-02-28 14:04:10 +0000
committerChristian Pointner <equinox@anytun.org>2009-02-28 14:04:10 +0000
commita1499b9808cc65db2eea55db0e07ae1f801fdec9 (patch)
tree06cae858974cc53185ca96dab8b656c432bb498b /src
parentadded install info to README (diff)
added adduser and deluser to insatll target
Diffstat (limited to 'src')
-rw-r--r--src/Makefile40
-rwxr-xr-xsrc/configure24
2 files changed, 47 insertions, 17 deletions
diff --git a/src/Makefile b/src/Makefile
index fff8ee2..9b95da3 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -91,7 +91,7 @@ clean:
manpage:
$(MAKE) --directory="../doc/" manpage
-install: install-bin install-etc install-man
+install: install-bin install-etc install-man add-user
install-bin: $(EXECUTABLE)
mkdir -p $(DESTDIR)$(SBINDIR)
@@ -101,19 +101,22 @@ install-bin: $(EXECUTABLE)
install-etc:
mkdir -p $(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 ; \
- mkdir -p $(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 \
+ @( cd '../etc/uanytun/' ; \
+ for dir in `ls`; do \
+ if [ -d $$dir ]; then \
+ echo "install $$dir configuration" ; \
+ cd $$dir ; \
+ mkdir -p $(DESTDIR)$(ETCDIR)/uanytun/$$dir ; \
+ install -m 600 config $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
+ sed -i 's#username uanytun#username $(USERNAME)#' $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
+ sed -i 's#groupname uanytun#groupname $(USERNAME)#' $(DESTDIR)$(ETCDIR)/uanytun/$$dir/config ; \
+ sed -i 's#chroot /var/run/uanytun#chroot $(USERHOME)#' $(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 \
)
mkdir -p $(DESTDIR)$(ETCDIR)/init.d
install -m 755 ../etc/init.d/uanytun $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
@@ -125,10 +128,17 @@ install-man: manpage
cp ../doc/uanytun.8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
gzip $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
+add-user:
+ @ adduser --system --group --home $(USERHOME) $(USERNAME)
+
+remove-user:
+ @ deluser $(USERNAME)
+ @ rm -rf $(USERHOME)
+
remove:
rm -f $(DESTDIR)$(SBINDIR)/$(EXECUTABLE)
rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8.gz
rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
-purge: remove
+purge: remove remove-user
rm -rf $(DESTDIR)$(ETCDIR)/uanytun/
diff --git a/src/configure b/src/configure
index d112494..a5c8173 100755
--- a/src/configure
+++ b/src/configure
@@ -43,16 +43,22 @@ PASSPHRASE=1
V4_MAPPED=1
PREFIX='/usr/local'
+USERNAME='uanytun'
+USERHOME='/var/run/uanytun'
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 " --username=<USERNAME> create this user when installing (default: uanytun)"
+ echo " --userhome=<PATH> the home directory of the user to be created (default: /var/run/uanytun)"
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-v4-mapped disable V4-Mapped addresses (this means to disable"
echo " simultanious use of IPv4 and IPv6)"
+ echo " --enable-v4-mapped enable V4-Mapped addresses"
}
for arg
@@ -64,18 +70,30 @@ do
--prefix=*)
PREFIX=${arg#--prefix=}
;;
+ --username=*)
+ USERNAME=${arg#--username=}
+ ;;
+ --userhome=*)
+ USERHOME=${arg#--userhome=}
+ ;;
--use-ssl-crypto)
CRYPTO_LIB='ssl'
;;
- --disable-crypto)
+ --no-crypto)
CRYPTO_LIB='none'
;;
--disable-passphrase)
PASSPHRASE=0
;;
+ --enable-passphrase)
+ PASSPHRASE=1
+ ;;
--disable-v4-mapped)
V4_MAPPED=0
;;
+ --enable-v4-mapped)
+ V4_MAPPED=1
+ ;;
--help)
print_usage
exit 0
@@ -159,6 +177,8 @@ LDFLAGS := $LDFLAGS
SBINDIR := $PREFIX/sbin
MANDIR := $PREFIX/share/man
ETCDIR := $ETCDIR
+USERNAME := $USERNAME
+USERHOME := $USERHOME
EOF
exit 0