update comment
This commit is contained in:
parent
eca16450e3
commit
9aa2dc4040
|
|
@ -31,6 +31,52 @@ if [[ $EUID -ne 0 ]]; then
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#Check system
|
||||||
|
check_sys(){
|
||||||
|
local checkType=$1
|
||||||
|
local value=$2
|
||||||
|
|
||||||
|
local release=''
|
||||||
|
local systemPackage=''
|
||||||
|
|
||||||
|
if [[ -f /etc/redhat-release ]]; then
|
||||||
|
release="centos"
|
||||||
|
systemPackage="yum"
|
||||||
|
elif cat /etc/issue | grep -q -E -i "debian"; then
|
||||||
|
release="debian"
|
||||||
|
systemPackage="apt"
|
||||||
|
elif cat /etc/issue | grep -q -E -i "ubuntu"; then
|
||||||
|
release="ubuntu"
|
||||||
|
systemPackage="apt"
|
||||||
|
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then
|
||||||
|
release="centos"
|
||||||
|
systemPackage="yum"
|
||||||
|
elif cat /proc/version | grep -q -E -i "debian"; then
|
||||||
|
release="debian"
|
||||||
|
systemPackage="apt"
|
||||||
|
elif cat /proc/version | grep -q -E -i "ubuntu"; then
|
||||||
|
release="ubuntu"
|
||||||
|
systemPackage="apt"
|
||||||
|
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then
|
||||||
|
release="centos"
|
||||||
|
systemPackage="yum"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ${checkType} == "sysRelease" ]]; then
|
||||||
|
if [ "$value" == "$release" ]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
elif [[ ${checkType} == "packageManager" ]]; then
|
||||||
|
if [ "$value" == "$systemPackage" ]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Disable selinux
|
# Disable selinux
|
||||||
disable_selinux(){
|
disable_selinux(){
|
||||||
if [ -s /etc/selinux/config ] && grep 'SELINUX=enforcing' /etc/selinux/config; then
|
if [ -s /etc/selinux/config ] && grep 'SELINUX=enforcing' /etc/selinux/config; then
|
||||||
|
|
@ -48,6 +94,8 @@ get_ip(){
|
||||||
|
|
||||||
# Pre-installation settings
|
# Pre-installation settings
|
||||||
pre_install(){
|
pre_install(){
|
||||||
|
# Check OS system
|
||||||
|
if check_sys packageManager apt; then
|
||||||
#Set shadowsocks-libev config password
|
#Set shadowsocks-libev config password
|
||||||
echo "Please input password for shadowsocks-libev:"
|
echo "Please input password for shadowsocks-libev:"
|
||||||
read -p "(Default password: teddysun.com):" shadowsockspwd
|
read -p "(Default password: teddysun.com):" shadowsockspwd
|
||||||
|
|
@ -63,12 +111,12 @@ pre_install(){
|
||||||
echo -e "Please input port for shadowsocks-libev [1-65535]:"
|
echo -e "Please input port for shadowsocks-libev [1-65535]:"
|
||||||
read -p "(Default port: 8989):" shadowsocksport
|
read -p "(Default port: 8989):" shadowsocksport
|
||||||
[ -z "$shadowsocksport" ] && shadowsocksport="8989"
|
[ -z "$shadowsocksport" ] && shadowsocksport="8989"
|
||||||
expr $shadowsocksport + 0 &>/dev/null
|
expr ${shadowsocksport} + 0 &>/dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
if [ $shadowsocksport -ge 1 ] && [ $shadowsocksport -le 65535 ]; then
|
if [ ${shadowsocksport} -ge 1 ] && [ ${shadowsocksport} -le 65535 ]; then
|
||||||
echo
|
echo
|
||||||
echo "---------------------------"
|
echo "---------------------------"
|
||||||
echo "port = $shadowsocksport"
|
echo "port = ${shadowsocksport}"
|
||||||
echo "---------------------------"
|
echo "---------------------------"
|
||||||
echo
|
echo
|
||||||
break
|
break
|
||||||
|
|
@ -99,6 +147,10 @@ pre_install(){
|
||||||
echo "Getting Public IP address, Please wait a moment..."
|
echo "Getting Public IP address, Please wait a moment..."
|
||||||
echo -e "Your main public IP is\t\033[32m $(get_ip) \033[0m"
|
echo -e "Your main public IP is\t\033[32m $(get_ip) \033[0m"
|
||||||
echo
|
echo
|
||||||
|
else
|
||||||
|
echo "Error: Your OS is not supported to run it! Please change OS to Debian/Ubuntu and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download latest shadowsocks-libev
|
# Download latest shadowsocks-libev
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user