Support CentOS 5 & 7
This commit is contained in:
parent
04141f5ac2
commit
864ea176ae
|
|
@ -18,17 +18,6 @@ echo "#"
|
||||||
echo "#############################################################"
|
echo "#############################################################"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Install Shadowsocks-go
|
|
||||||
function install_shadowsocks_go(){
|
|
||||||
rootness
|
|
||||||
disable_selinux
|
|
||||||
pre_install
|
|
||||||
download_files
|
|
||||||
config_shadowsocks
|
|
||||||
iptables_set
|
|
||||||
install
|
|
||||||
}
|
|
||||||
|
|
||||||
# Make sure only root can run our script
|
# Make sure only root can run our script
|
||||||
function rootness(){
|
function rootness(){
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
|
@ -77,14 +66,6 @@ fi
|
||||||
|
|
||||||
# Pre-installation settings
|
# Pre-installation settings
|
||||||
function pre_install(){
|
function pre_install(){
|
||||||
# Not support CentOS 5.x and 7.x
|
|
||||||
if centosversion 5; then
|
|
||||||
echo "Not support CentOS 5.x, please change to CentOS 6.x and try again."
|
|
||||||
exit 1
|
|
||||||
elif centosversion 7; then
|
|
||||||
echo "Not support CentOS 7.x, please change to CentOS 6.x and try again."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# Set shadowsocks-go config password
|
# Set shadowsocks-go config password
|
||||||
echo "Please input password for shadowsocks-go:"
|
echo "Please input password for shadowsocks-go:"
|
||||||
read -p "(Default password: teddysun.com):" shadowsockspwd
|
read -p "(Default password: teddysun.com):" shadowsockspwd
|
||||||
|
|
@ -106,14 +87,15 @@ function pre_install(){
|
||||||
echo "Press any key to start...or Press Ctrl+C to cancel"
|
echo "Press any key to start...or Press Ctrl+C to cancel"
|
||||||
char=`get_char`
|
char=`get_char`
|
||||||
#Install necessary dependencies
|
#Install necessary dependencies
|
||||||
yum install -y wget unzip gzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent
|
yum install -y wget unzip gzip curl
|
||||||
yum install -y automake make curl curl-devel zlib-devel openssl-devel perl perl-devel cpio expat-devel gettext-devel
|
|
||||||
# Get IP address
|
# Get IP address
|
||||||
echo "Getting Public IP address, Please wait a moment..."
|
echo "Getting Public IP address, Please wait a moment..."
|
||||||
IP=`curl -s checkip.dyndns.com | cut -d' ' -f 6 | cut -d'<' -f 1`
|
IP=`curl -s checkip.dyndns.com | cut -d' ' -f 6 | cut -d'<' -f 1`
|
||||||
if [ -z $IP ]; then
|
if [ -z $IP ]; then
|
||||||
IP=`curl -s ifconfig.me/ip`
|
IP=`curl -s ifconfig.me/ip`
|
||||||
fi
|
fi
|
||||||
|
echo -e "Your main public IP is\t\033[32m$IP\033[0m"
|
||||||
|
echo ""
|
||||||
#Current folder
|
#Current folder
|
||||||
cur_dir=`pwd`
|
cur_dir=`pwd`
|
||||||
}
|
}
|
||||||
|
|
@ -175,6 +157,7 @@ EOF
|
||||||
|
|
||||||
# iptables set
|
# iptables set
|
||||||
function iptables_set(){
|
function iptables_set(){
|
||||||
|
echo "iptables start setting..."
|
||||||
/sbin/service iptables status 1>/dev/null 2>&1
|
/sbin/service iptables status 1>/dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
/etc/init.d/iptables status | grep '8989' | grep 'ACCEPT' >/dev/null 2>&1
|
/etc/init.d/iptables status | grep '8989' | grep 'ACCEPT' >/dev/null 2>&1
|
||||||
|
|
@ -182,11 +165,14 @@ function iptables_set(){
|
||||||
/sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8989 -j ACCEPT
|
/sbin/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8989 -j ACCEPT
|
||||||
/etc/init.d/iptables save
|
/etc/init.d/iptables save
|
||||||
/etc/init.d/iptables restart
|
/etc/init.d/iptables restart
|
||||||
|
else
|
||||||
|
echo "port 8989 has been set up."
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "iptables looks like shutdown, please manually set it if necessary."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
function install(){
|
function install(){
|
||||||
# Install shadowsocks-go
|
# Install shadowsocks-go
|
||||||
|
|
@ -250,6 +236,19 @@ function uninstall_shadowsocks_go(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Install Shadowsocks-go
|
||||||
|
function install_shadowsocks_go(){
|
||||||
|
rootness
|
||||||
|
disable_selinux
|
||||||
|
pre_install
|
||||||
|
download_files
|
||||||
|
config_shadowsocks
|
||||||
|
if ! centosversion 7; then
|
||||||
|
iptables_set
|
||||||
|
fi
|
||||||
|
install
|
||||||
|
}
|
||||||
|
|
||||||
# Initialization step
|
# Initialization step
|
||||||
action=$1
|
action=$1
|
||||||
[ -z $1 ] && action=install
|
[ -z $1 ] && action=install
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user