Skip to content

Commit

Permalink
修复有些系统无法check出系统类型
Browse files Browse the repository at this point in the history
  • Loading branch information
flyzy2005 committed Apr 27, 2018
1 parent d559c1f commit 1cb7ba6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Binary file added .sshelp.swp
Binary file not shown.
26 changes: 22 additions & 4 deletions ss-fly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ uninstall_ss() {
ssserver -c /etc/shadowsocks.json -d stop
fi
case $os in
'ubuntu')
'ubuntu'|'debian')
update-rc.d -f ss-fly remove
;;
'centos')
Expand Down Expand Up @@ -148,7 +148,7 @@ install_ssr() {
./shadowsocksR.sh 2>&1 | tee shadowsocksR.log
}

check_os() {
check_os_() {
source /etc/os-release
local os_tmp=$(echo $ID | tr [A-Z] [a-z])
case $os_tmp in
Expand All @@ -165,6 +165,24 @@ check_os() {
esac
}

check_os() {
if [[ -f /etc/redhat-release ]]; then
os="centos"
elif cat /etc/issue | grep -Eqi "debian"; then
os="debian"
elif cat /etc/issue | grep -Eqi "ubuntu"; then
os="ubuntu"
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
os="centos"
elif cat /proc/version | grep -Eqi "debian"; then
os="debian"
elif cat /proc/version | grep -Eqi "ubuntu"; then
os="ubuntu"
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
os="centos"
fi
}

check_bbr_status() {
local param=$(sysctl net.ipv4.tcp_available_congestion_control | awk '{print $3}')
if [[ x"${param}" == x"bbr" ]]; then
Expand Down Expand Up @@ -247,7 +265,7 @@ kern=$( uname -r )

check_dependency() {
case $os in
'ubuntu')
'ubuntu'|'debian')
apt-get -y update
apt-get -y install python python-dev python-setuptools openssl libssl-dev curl wget unzip gcc automake autoconf make libtool
;;
Expand Down Expand Up @@ -401,7 +419,7 @@ install() {
cp $fly_dir/ss-fly /etc/init.d/
chmod +x /etc/init.d/ss-fly
case $os in
'ubuntu')
'ubuntu'|'debian')
update-rc.d ss-fly defaults
;;
'centos')
Expand Down

0 comments on commit 1cb7ba6

Please sign in to comment.