Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/scripts/getos.sh

49 lines
1.8 KiB

7 years ago
#!/bin/bash
2 years ago
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
7 years ago
export PATH
3 years ago
#获取信息和版本
_os=`uname`
if [ ${_os} == "Darwin" ]; then
OSNAME='macos'
elif grep -Eq "openSUSE" /etc/*-release; then
OSNAME='opensuse'
elif grep -Eq "FreeBSD" /etc/*-release; then
OSNAME='freebsd'
10 months ago
elif grep -Eqi "EulerOS" /etc/*-release || grep -Eqi "openEuler" /etc/*-release; then
OSNAME='euler'
3 years ago
elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then
OSNAME='arch'
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
3 years ago
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
OSNAME='alma'
3 years ago
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
OSNAME='rocky'
7 years ago
elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then
3 years ago
OSNAME='rhel'
7 years ago
elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then
3 years ago
OSNAME='aliyun'
7 years ago
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
3 years ago
OSNAME='fedora'
7 years ago
elif grep -Eqi "Amazon Linux AMI" /etc/issue || grep -Eq "Amazon Linux AMI" /etc/*-release; then
3 years ago
OSNAME='amazon'
7 years ago
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
3 years ago
OSNAME='debian'
7 years ago
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
3 years ago
OSNAME='ubuntu'
7 years ago
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then
3 years ago
OSNAME='raspbian'
7 years ago
elif grep -Eqi "Deepin" /etc/issue || grep -Eq "Deepin" /etc/*-release; then
3 years ago
OSNAME='deepin'
7 years ago
else
3 years ago
OSNAME='unknow'
7 years ago
fi
2 years ago
if [ -d /www/server/mdserver-web ];then
echo "$OSNAME" > /www/server/mdserver-web/data/osname.pl
fi
if [ "$OSNAME" == "macos" ];then
echo "$OSNAME"
fi