mirror of
https://github.com/3proxy/3proxy.git
synced 2025-02-23 02:25:40 +08:00
Correct make install and installation scripts for Linux
This commit is contained in:
parent
1af6e65fba
commit
775530e28e
@ -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
|
@ -225,6 +225,11 @@ BinInstall()
|
||||
local binlist
|
||||
local liblist
|
||||
|
||||
if [! -d bin]
|
||||
then
|
||||
mkdir bin
|
||||
fi
|
||||
|
||||
cd bin
|
||||
|
||||
binlist=`ls -l --time-style="+%d.%m.%Y %H:%m" | awk '$1 ~ /x$/ && $1 ~ /^[^d]/ && $8 !~ /\.so$/ { print $8 }'`
|
||||
|
@ -1,23 +1,23 @@
|
||||
#!/usr/local/etc/3proxy/bin/3proxy
|
||||
#!/bin/3proxy
|
||||
daemon
|
||||
pidfile /usr/local/etc/3proxy/3proxy.pid
|
||||
pidfile /var/run/3proxy/3proxy.pid
|
||||
nscache 65536
|
||||
nserver 127.0.0.1
|
||||
|
||||
config /usr/local/etc/3proxy/3proxy.cfg
|
||||
monitor /usr/local/etc/3proxy/3proxy.cfg
|
||||
monitor /usr/local/etc/3proxy/counters
|
||||
monitor /usr/local/etc/3proxy/passwd
|
||||
monitor /usr/local/etc/3proxy/bandlimiters
|
||||
config /etc/3proxy/3proxy.cfg
|
||||
monitor /etc/3proxy/3proxy.cfg
|
||||
monitor /etc/3proxy/counters
|
||||
monitor /etc/3proxy/passwd
|
||||
monitor /etc/3proxy/bandlimiters
|
||||
|
||||
log /var/log/3proxy/log D
|
||||
log /var/log/3proxy/3proxy-%y%m%d.log D
|
||||
rotate 60
|
||||
counter /usr/local/etc/3proxy/3proxy.3cf
|
||||
counter /var/run/3proxy/3proxy.3cf
|
||||
|
||||
users $/usr/local/etc/3proxy/passwd
|
||||
users $/etc/3proxy/passwd
|
||||
|
||||
include /usr/local/etc/3proxy/counters
|
||||
include /usr/local/etc/3proxy/bandlimiters
|
||||
include /etc/3proxy/counters
|
||||
include /etc/3proxy/bandlimiters
|
||||
|
||||
auth strong
|
||||
deny * * 127.0.0.1
|
||||
|
@ -1,10 +1,14 @@
|
||||
#!/bin/sh
|
||||
if [ $4 ]; then
|
||||
echo $1:`/usr/local/etc/3proxy/bin/mycrypt $$ $2` >> /usr/local/etc/3proxy/passwd
|
||||
echo countin \"`wc -l /usr/local/etc/3proxy/counters|awk '{print $1}'`/$1\" D $3 $1 >> /usr/local/etc/3proxy/counters
|
||||
echo bandlimin $4 $1 >> /usr/local/etc/3proxy/bandlimiters
|
||||
echo bandlimin $4 $1 >> /etc/3proxy/bandlimiters
|
||||
fi
|
||||
if [ $3 ]; then
|
||||
echo countin \"`wc -l /etc/3proxy/counters|awk '{print $1}'`/$1\" D $3 $1 >> /etc/3proxy/counters
|
||||
fi
|
||||
if [ $2 ]; then
|
||||
echo $1:`/bin/mycrypt $$ $2` >> /etc/3proxy/passwd
|
||||
else
|
||||
echo usage: $0 username password day_limit bandwidth
|
||||
echo usage: $0 username password [day_limit] [bandwidth]
|
||||
echo " "day_limit - traffic limit in MB per day
|
||||
echo " "bandwidth - bandwith in bits per second 1048576 = 1Mbps
|
||||
fi
|
||||
|
@ -1,17 +1,23 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: 3proxy
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Should-Start:
|
||||
# Should-Stop:
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start/stop 3proxy
|
||||
# Description: Start/stop 3proxy, tiny proxy server
|
||||
### END INIT INFO
|
||||
# chkconfig: 2345 20 80
|
||||
# description: 3proxy tiny proxy server
|
||||
#
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo Starting 3Proxy
|
||||
|
||||
/usr/local/etc/3proxy/bin/3proxy /usr/local/etc/3proxy/3proxy.cfg
|
||||
/bin/3proxy /etc/3proxy/3proxy.cfg
|
||||
|
||||
RETVAL=$?
|
||||
echo
|
||||
@ -20,8 +26,8 @@ case "$1" in
|
||||
|
||||
stop)
|
||||
echo Stopping 3Proxy
|
||||
if [ -f /usr/local/etc/3proxy/3proxy.pid ]; then
|
||||
/bin/kill `cat /usr/local/etc/3proxy/3proxy.pid`
|
||||
if [ -f /var/run/3proxy/3proxy.pid ]; then
|
||||
/bin/kill `cat /var/run/3proxy/3proxy.pid`
|
||||
else
|
||||
/usr/bin/killall 3proxy
|
||||
fi
|
||||
@ -33,8 +39,8 @@ case "$1" in
|
||||
|
||||
restart|reload)
|
||||
echo Reloading 3Proxy
|
||||
if [ -f /usr/local/etc/3proxy/3proxy.pid ]; then
|
||||
/bin/kill -s USR1 `cat /usr/local/etc/3proxy/3proxy.pid`
|
||||
if [ -f /var/run/3proxy/3proxy.pid ]; then
|
||||
/bin/kill -s USR1 `cat /var/run/3proxy/3proxy.pid`
|
||||
else
|
||||
/usr/bin/killall -s USR1 3proxy
|
||||
fi
|
@ -3,8 +3,8 @@ cd ..
|
||||
cp Makefile.unix Makefile
|
||||
make
|
||||
if [ ! -d /usr/local/etc/3proxy/bin ]; then mkdir -p /usr/local/etc/3proxy/bin/; fi
|
||||
install bin/3proxy /usr/local/etc/3proxy/bin/3proxy
|
||||
install bin/mycrypt /usr/local/etc/3proxy/bin/mycrypt
|
||||
install bin/3proxy /usr/local/bin/3proxy
|
||||
install bin/mycrypt /usr/local/bin/mycrypt
|
||||
install scripts/rc.d/proxy.sh /usr/local/etc/rc.d/proxy.sh
|
||||
install scripts/add3proxyuser.sh /usr/local/etc/3proxy/bin/
|
||||
if [ -s /usr/local/etc/3proxy/3proxy.cfg ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user