update comment

This commit is contained in:
Teddysun 2016-09-17 18:35:49 +09:00
parent 8c1bd08aef
commit b805bf9bd4

View File

@ -112,10 +112,10 @@ is_64bit(){
# 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
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
setenforce 0 setenforce 0
fi fi
} }
get_ip(){ get_ip(){
@ -156,10 +156,10 @@ pre_install(){
echo echo
break break
else else
echo "Input error! Please input correct numbers." echo "Input error, please input correct number"
fi fi
else else
echo "Input error! Please input correct numbers." echo "Input error, please input correct number"
fi fi
done done
get_char(){ get_char(){
@ -181,9 +181,6 @@ pre_install(){
apt-get -y update apt-get -y update
apt-get install -y wget unzip gzip curl apt-get install -y wget unzip gzip curl
fi fi
# Get IP address
echo "Getting Public IP address, Please wait a moment..."
echo -e "Your main public IP is\t\033[32m $(get_ip) \033[0m"
echo echo
} }
@ -236,7 +233,7 @@ download_files(){
# Config shadowsocks # Config shadowsocks
config_shadowsocks(){ config_shadowsocks(){
if [ ! -d /etc/shadowsocks ]; then if [ ! -d /etc/shadowsocks ]; then
mkdir /etc/shadowsocks mkdir -p /etc/shadowsocks
fi fi
cat > /etc/shadowsocks/config.json<<-EOF cat > /etc/shadowsocks/config.json<<-EOF
{ {
@ -250,7 +247,7 @@ config_shadowsocks(){
EOF EOF
} }
# firewall set # Firewall set
firewall_set(){ firewall_set(){
echo "firewall set start..." echo "firewall set start..."
if centosversion 6; then if centosversion 6; then
@ -289,36 +286,36 @@ firewall_set(){
echo "firewall set completed..." echo "firewall set completed..."
} }
# Install # Install Shadowsocks-go
install_go(){ install(){
# Install shadowsocks-go
if [ -s /usr/bin/shadowsocks-server ]; then if [ -s /usr/bin/shadowsocks-server ]; then
echo "shadowsocks-go install success!" echo "shadowsocks-go install success!"
chmod +x /usr/bin/shadowsocks-server chmod +x /usr/bin/shadowsocks-server
chmod +x /etc/init.d/shadowsocks chmod +x /etc/init.d/shadowsocks
# Add run on system start up
if check_sys packageManager yum; then if check_sys packageManager yum; then
chkconfig --add shadowsocks chkconfig --add shadowsocks
chkconfig shadowsocks on chkconfig shadowsocks on
elif check_sys packageManager apt; then elif check_sys packageManager apt; then
update-rc.d -f shadowsocks defaults update-rc.d -f shadowsocks defaults
fi fi
# Start shadowsocks
/etc/init.d/shadowsocks start /etc/init.d/shadowsocks start
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Shadowsocks-go start success!" echo "Shadowsocks-go start success!"
else else
echo "Shadowsocks-go start failure!" echo "Shadowsocks-go start failed!"
fi fi
else else
echo echo
echo "shadowsocks-go install failed!" echo "Shadowsocks-go install failed!"
exit 1 exit 1
fi fi
clear clear
echo echo
echo "Congratulations, shadowsocks-go install completed!" echo "Congratulations, Shadowsocks-go install completed!"
echo -e "Your Server IP: \033[41;37m $(get_ip) \033[0m" echo -e "Your Server IP: \033[41;37m $(get_ip) \033[0m"
echo -e "Your Server Port: \033[41;37m ${shadowsocksport} \033[0m" echo -e "Your Server Port: \033[41;37m ${shadowsocksport} \033[0m"
echo -e "Your Password: \033[41;37m ${shadowsockspwd} \033[0m" echo -e "Your Password: \033[41;37m ${shadowsockspwd} \033[0m"
@ -328,7 +325,6 @@ install_go(){
echo "Welcome to visit:https://teddysun.com/392.html" echo "Welcome to visit:https://teddysun.com/392.html"
echo "Enjoy it!" echo "Enjoy it!"
echo echo
exit 0
} }
# Uninstall Shadowsocks-go # Uninstall Shadowsocks-go
@ -354,7 +350,9 @@ uninstall_shadowsocks_go(){
rm -f /usr/bin/shadowsocks-server rm -f /usr/bin/shadowsocks-server
echo "Shadowsocks-go uninstall success!" echo "Shadowsocks-go uninstall success!"
else else
echo
echo "Uninstall cancelled, nothing to do..." echo "Uninstall cancelled, nothing to do..."
echo
fi fi
} }
@ -368,21 +366,18 @@ install_shadowsocks_go(){
if check_sys packageManager yum; then if check_sys packageManager yum; then
firewall_set firewall_set
fi fi
install_go install
} }
# Initialization step # Initialization step
action=$1 action=$1
[ -z $1 ] && action=install [ -z $1 ] && action=install
case "$action" in case "$action" in
install) install|uninstall)
install_shadowsocks_go ${action}_shadowsocks_go
;; ;;
uninstall) *)
uninstall_shadowsocks_go echo "Arguments error! [${action}]"
;;
*)
echo "Arguments error! [${action} ]"
echo "Usage: `basename $0` {install|uninstall}" echo "Usage: `basename $0` {install|uninstall}"
;; ;;
esac esac