Correct make install and installation scripts for Linux

This commit is contained in:
z3APA3A 2018-04-25 02:40:11 +03:00
parent 1af6e65fba
commit 775530e28e
6 changed files with 87 additions and 38 deletions

View file

@ -42,9 +42,9 @@ allplugins:
@list='$(PLUGINS)'; for p in $$list; do cp Makefile Makefile.var plugins/$$p; cd plugins/$$p ; make ; cd ../.. ; done
DESTDIR =
prefix = /usr/local
prefix =
exec_prefix = $(prefix)
man_prefix = $(prefix)/share
man_prefix = /usr/share
INSTALL = /usr/bin/install
INSTALL_BIN = $(INSTALL) -m 755
@ -61,15 +61,21 @@ INSTALL_OBJS = bin/3proxy \
INSTALL_CFG_OBJS = scripts/3proxy.cfg \
scripts/add3proxyuser.sh
INSTALL_CFG_DEST = config
INSTALL_CFG_DEST =
INSTALL_CFG_OBJS2 = passwd counters bandlimiters
INSTALL_CFG_OBJS2 = counters bandlimiters
INSTALL_INITD_SCRIPT = scripts/init.d/3proxy.sh
MANDIR1 = $(DESTDIR)$(man_prefix)/man/man1
MANDIR3 = $(DESTDIR)$(man_prefix)/man/man3
MANDIR8 = $(DESTDIR)$(man_prefix)/man/man8
BINDIR = $(DESTDIR)$(exec_prefix)/bin
ETCDIR = $(DESTDIR)$(prefix)/etc/3proxy
INITDDIR = $(DESTDIR)$(prefix)/etc/init.d
RUNDIR = $(DESTDIR)$(prefix)/var/run/3proxy
LOGDIR = $(DESTDIR)$(prefix)/var/log/3proxy
INSTALL_CFG_DEST = $(ETCDIR)
install-bin:
$(INSTALL_BIN) -d $(BINDIR)
@ -79,13 +85,11 @@ install-etc-dir:
$(INSTALL_BIN) -d $(ETCDIR)
install-etc-default-config:
if [ -f $(ETCDIR)/$(INSTALL_CFG_DEST) ]; then \
: ; \
else \
$(INSTALL_DATA) $(INSTALL_CFG_OBJS) $(ETCDIR)/$(INSTALL_CFG_DEST) \
if [ ! -f $(ETCDIR)/$(INSTALL_CFG_DEST) ]; then \
$(INSTALL_BIN) $(INSTALL_CFG_OBJS) $(INSTALL_CFG_DEST); \
fi
install-etc: install-etc-dir
install-etc: install-etc-dir install-etc-default-config
for file in $(INSTALL_CFG_OBJS2); \
do \
touch $(ETCDIR)/$$file; chmod 0600 $(ETCDIR)/$$file; \
@ -97,5 +101,35 @@ install-man:
$(INSTALL_DATA) man/*.3 $(MANDIR3)
$(INSTALL_DATA) man/*.8 $(MANDIR8)
install: install-bin install-etc install-man
install-init:
if [ -f $(INITDIR) ]; then \
$(INSTALL_BIN) $(INSTALL_INITD_SCRIPT) $(INITDDIR)/3proxy; \
fi
if [ -f /usr/sbin/update-rc.d ]; then \
/usr/sbin/update-rc.d 3proxy defaults; \
/usr/sbin/update-rc.d 3proxy enable; \
fi
install-run:
$(INSTALL_BIN) -d $(RUNDIR)
install-log:
$(INSTALL_BIN) -d $(LOGDIR)
install: install-bin install-etc install-man install-log install-run install-init
@if [ ! -f $(INSTALL_CFG_DEST)/passwd ]; then \
touch $(ETCDIR)/passwd; chmod 0600 $(ETCDIR)/passwd; \
stty -echo ;\
echo "" ;\
read -p "Proxy admin password: " password && $(INSTALL_CFG_DEST)/add3proxyuser.sh admin $password ;\
stty echo ;\
fi
@echo ""
@echo 3proxy installed.
@echo use
@echo " "$(INSTALL_CFG_DEST)/add3proxyuser.sh
@echo to add users
@if [ -f /usr/sbin/service ]; then \
/usr/sbin/service 3proxy stop ;\
/usr/sbin/service 3proxy start ;\
fi