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

Dev/deploy scripts opti v2 #463

Merged
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions scripts/base/install_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ function set_pypi_mirror() {
function quiet_install_python() {
LINUX_OS=$( get_linux_os )
LOG_INFO "Check Python version"
ret=$( check_python )
if [ "$ret" == "true" ]; then
LOG_WARN "This machine had installed Python3.7"
return 0
fi
pre_install
download_python_src
install_python
Expand All @@ -104,6 +99,11 @@ function quiet_install_python() {
}

function interactive_install_python() {
ret=$( check_python )
if [ "$ret" == "true" ]; then
LOG_WARN "This machine had installed Python3.7"
return 0
fi
LOG_INFO "Do you want to install python3.7 by this script?"
read -p "Please enter:[Y/N]" result
case $result in
Expand Down
20 changes: 11 additions & 9 deletions scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function force_kill() {
}

### 检验软链文件是否存在,存在则询问是否删除 ###
functio check_ln_file() {
function check_ln_file() {
file=$1
if [ -f $file ]; then
LOG_INFO "$file need to be removed, TCA will replaced it with new soft link file, otherwise python dependency may not be installed"
Expand All @@ -102,6 +102,7 @@ functio check_ln_file() {
exit 1
;;
esac
fi
}

### 核验pip版本 ###
Expand Down Expand Up @@ -140,7 +141,7 @@ function pre_check() {

### 校验是否为root权限 ###
function root_check() {
if [ $(whoami) != "root"]; then
if [ $(whoami) != "root" ]; then
error_exit "Please use TCA init script under root privilege."
fi
}
Expand All @@ -158,16 +159,16 @@ function os_digits_check() {
### 若其他系统版本不可用,可至https://github.com/Tencent/CodeAnalysis发出issue ###
function os_version_check() {
if [ -s "/etc/redhat-release" ]; then
centos_version_check=$(cat /etc/redhat-release | grep -iE 'release 1.|2.|3.|4.|5.|6.' | grep -iE 'centos|Red Hat')
if [ "$(centos_version_check)" ]; then
error_exit "version of centos must be 7. or above, otherwise TCA CAN'T be used."
centos_version=$(cat /etc/redhat-release | grep -iE 'release 1.|2.|3.|4.|5.|6.' | grep -iE 'centos|Red Hat')
if [ $centos_version ]; then
LOG_WARN "current centOS version is $centos_version, we recommend you use 7 or above."
fi
elif [ -s "/etc/issue" ]; then
ubuntu_version=$(cat /etc/issue|grep Ubuntu|awk '{print $2}'|cut -f 1 -d '.')
ubuntu_version=$(cat /etc/issue |grep Ubuntu |awk '{print $2}')
min_version="18.03"
if [ "$(ubuntu_version)" ]; then
if [[ $ubuntu_version > $min_version ]]; then
error_exit "version of ubuntu must be 18.04 or above, otherwise TCA CAN'T be used."
if [ $ubuntu_version ]; then
if [[ $ubuntu_version < $min_version ]]; then
LOG_WARN "current Ubuntu version is $ubuntu_version, we recommend you use 18.04 or above."
fi
fi
fi
Expand Down Expand Up @@ -200,6 +201,7 @@ function http_proxy_check() {
[3])
LOG_INFO "do nothing about PROXY setting"
return 1
;;
*)
LOG_ERROR "Invalid input. Stop."
exit 1
Expand Down