Skip to content

Commit 5eb8f96

Browse files
committed
fix release.sh : check the version of linux
1 parent 0ec906c commit 5eb8f96

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

release.sh

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,38 @@ scanOS(){
9191
OS=`uname -s`
9292
if [ ${OS} == "Darwin" ]
9393
then
94-
echo "brew"
94+
PM="brew"
9595
elif [ ${OS} == "Linux" ]
9696
then
97-
source /etc/os-release
98-
case $ID in
99-
debian|ubuntu|devuan)
100-
echo "apt-get"
101-
;;
102-
centos|fedora|rhel)
103-
echo "yum"
104-
;;
105-
*)
106-
exit 1
107-
;;
108-
esac
97+
if grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
98+
DISTRO='CentOS'
99+
PM='yum'
100+
elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then
101+
DISTRO='RHEL'
102+
PM='yum'
103+
elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then
104+
DISTRO='Aliyun'
105+
PM='yum'
106+
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
107+
DISTRO='Fedora'
108+
PM='yum'
109+
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
110+
DISTRO='Debian'
111+
PM='apt-get'
112+
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
113+
DISTRO='Ubuntu'
114+
PM='apt-get'
115+
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then
116+
DISTRO='Raspbian'
117+
PM='apt-get'
118+
else
119+
DISTRO='unknow'
120+
fi
109121
else
110122
echo ${OS}
111123
fi
124+
125+
echo ${PM}
112126
}
113127

114128
modules=(

0 commit comments

Comments
 (0)