Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
feat: 检测 locale 配置并覆盖为 C 语言环境
Browse files Browse the repository at this point in the history
  • Loading branch information
i-abc committed May 8, 2024
1 parent 3c50b8a commit aee8e97
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gb5-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ _banner() {
echo
}

##### 检测locale配置并覆盖为C语言环境 #####
_check_locale() {
if locale -a 2>/dev/null | grep -q "^C$"; then
export LC_ALL=C
fi
}

##### 检测某软件包是否安装,没安则自动安上,目前只支持RedHat、Debian系 #####
_check_package() {
_yellow "正在检测所需的$1是否安装"
Expand Down Expand Up @@ -300,6 +307,7 @@ _output_summary() {
_rm_dir() {
sudo swapoff $dir/swap &>/dev/null
rm -rf $dir
unset LC_ALL
echo -e "\033[0m"
}

Expand All @@ -308,6 +316,7 @@ _main() {
trap '_rm_dir' EXIT
clear
_banner
_check_locale
_check_ip
_check_package wget wget
_check_package tar tar
Expand Down

0 comments on commit aee8e97

Please sign in to comment.