Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added judgment on Debian. #209

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions scripts/setup-bt/do_os.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/bash

# Check OS first, only support CentOS or Ubuntu
# Modification from mxdyeah.
yum --version >/dev/null 2>&1 && rpm --version >/dev/null 2>&1 && OS_NAME='CentOS'
apt-get --version >/dev/null 2>&1 && OS_NAME='Ubuntu'
if [[ -z $OS_NAME ]]; then echo "Only support CentOS/Ubuntu"; exit 1; fi
apt-get --version >/dev/null 2>&1 && OS_NAME='Ubuntu' && OS_NAME='Debian'
if [[ -z $OS_NAME ]]; then echo "Only support CentOS/Ubuntu/Debian"; exit 1; fi

if [[ $OS_NAME == 'CentOS' ]]; then
# Check CentOS version.
Expand All @@ -15,7 +16,13 @@ if [[ $OS_NAME == 'Ubuntu' ]]; then
# Check Ubuntu version.
Ubuntu_VERSION=$(cat /etc/os-release |grep VERSION_ID |awk -F '"' '{print $2}' |awk -F '.' '{print $1}')
if [[ $Ubuntu_VERSION -lt 18 ]]; then echo "Only support Ubuntu 18+, yours is $Ubuntu_VERSION"; exit 1; fi
echo "OS is $OS_NAME $Ubuntu_VERSION"
fi

echo "OS is $OS_NAME $Ubuntu_VERSION"
if [[ $OS_NAME == 'Debian' ]]; then
# Check Debian version.
Debian_VERSION=$(cat /etc/os-release |grep VERSION_ID |awk -F '"' '{print $2}' |awk -F '.' '{print $1}')
if [[ $Debian_VERSION -lt 11 ]]; then echo "Only support Debian 11+, yours is $Debian_VERSION"; exit 1; fi
echo "OS is $OS_NAME $Debian_VERSION"
fi