Not support CentOS 5.x and 7.x

This commit is contained in:
Teddysun 2014-12-09 21:14:35 +09:00
parent 05e07eb870
commit 5925ef1d90
2 changed files with 58 additions and 0 deletions

View File

@ -37,6 +37,27 @@ if [[ $EUID -ne 0 ]]; then
fi fi
} }
# Get version
function getversion(){
if [[ -s /etc/redhat-release ]];then
grep -oE "[0-9.]+" /etc/redhat-release
else
grep -oE "[0-9.]+" /etc/issue
fi
}
# CentOS version
function centosversion(){
local code=$1
local version="`getversion`"
local main_ver=${version%%.*}
if [ $main_ver == $code ];then
return 0
else
return 1
fi
}
# Disable selinux # Disable selinux
function disable_selinux(){ function 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
@ -47,6 +68,14 @@ 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-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

View File

@ -37,6 +37,27 @@ if [[ $EUID -ne 0 ]]; then
fi fi
} }
# Get version
function getversion(){
if [[ -s /etc/redhat-release ]];then
grep -oE "[0-9.]+" /etc/redhat-release
else
grep -oE "[0-9.]+" /etc/issue
fi
}
# CentOS version
function centosversion(){
local code=$1
local version="`getversion`"
local main_ver=${version%%.*}
if [ $main_ver == $code ];then
return 0
else
return 1
fi
}
# Disable selinux # Disable selinux
function disable_selinux(){ function 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
@ -47,6 +68,14 @@ 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 config password #Set shadowsocks config password
echo "Please input password for shadowsocks:" echo "Please input password for shadowsocks:"
read -p "(Default password: teddysun.com):" shadowsockspwd read -p "(Default password: teddysun.com):" shadowsockspwd