From ec99ce01d31c3947a3470ac37f5eae0b1006fee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=88=B1=E5=96=9D=E6=B0=B4=E7=9A=84=E6=9C=A8=E5=AD=90?= Date: Fri, 20 Mar 2026 16:12:24 +0800 Subject: [PATCH] Fix yum installs on CentOS with UTF-8 and disabled history --- install-docker.sh | 2 +- install-mambaconda.sh | 2 +- install-nvm.sh | 2 +- install_muzi.sh | 9 ++++++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/install-docker.sh b/install-docker.sh index c4aa4c0..21273fa 100644 --- a/install-docker.sh +++ b/install-docker.sh @@ -76,7 +76,7 @@ install_dependencies() { elif command -v dnf >/dev/null 2>&1; then run_privileged dnf install -y ca-certificates curl elif command -v yum >/dev/null 2>&1; then - run_privileged yum install -y ca-certificates curl + run_privileged env LANG="${LANG:-en_US.UTF-8}" LC_ALL="${LC_ALL:-${LANG:-en_US.UTF-8}}" yum --setopt=history_record=false install -y ca-certificates curl else error "当前 Linux 包管理器不受支持,请手动安装 curl 和 ca-certificates。" fi diff --git a/install-mambaconda.sh b/install-mambaconda.sh index fcec66f..33e27ae 100644 --- a/install-mambaconda.sh +++ b/install-mambaconda.sh @@ -94,7 +94,7 @@ install_dependencies() { elif command -v dnf >/dev/null 2>&1; then run_privileged dnf install -y curl wget ca-certificates bzip2 elif command -v yum >/dev/null 2>&1; then - run_privileged yum install -y curl wget ca-certificates bzip2 + run_privileged env LANG="${LANG:-en_US.UTF-8}" LC_ALL="${LC_ALL:-${LANG:-en_US.UTF-8}}" yum --setopt=history_record=false install -y curl wget ca-certificates bzip2 else error "当前 Linux 包管理器不受支持,请手动安装 curl、wget、ca-certificates 和 bzip2。" fi diff --git a/install-nvm.sh b/install-nvm.sh index 565ca1e..e6b5c0d 100644 --- a/install-nvm.sh +++ b/install-nvm.sh @@ -77,7 +77,7 @@ install_dependencies() { elif command -v dnf >/dev/null 2>&1; then run_privileged dnf install -y curl ca-certificates elif command -v yum >/dev/null 2>&1; then - run_privileged yum install -y curl ca-certificates + run_privileged env LANG="${LANG:-en_US.UTF-8}" LC_ALL="${LC_ALL:-${LANG:-en_US.UTF-8}}" yum --setopt=history_record=false install -y curl ca-certificates else error "当前 Linux 包管理器不受支持,请手动安装 curl 和 ca-certificates。" fi diff --git a/install_muzi.sh b/install_muzi.sh index 9a91037..3db21be 100644 --- a/install_muzi.sh +++ b/install_muzi.sh @@ -15,6 +15,13 @@ CONDA_PATH="$HOME/mambaconda" LATEST_CONDA_VERSION="" LATEST_NVM_VERSION="" +run_yum_install() { + local lang_value="${LANG:-en_US.UTF-8}" + local lc_all_value="${LC_ALL:-$lang_value}" + LANG="$lang_value" LC_ALL="$lc_all_value" \ + yum --setopt=history_record=false install -y "$@" +} + # 打印信息函数 info() { echo -e "${GREEN}[INFO]${NC} $1" @@ -101,7 +108,7 @@ install_dependencies() { if command -v apt &> /dev/null; then apt update && apt install -y curl wget git ca-certificates --no-install-recommends elif command -v yum &> /dev/null; then - yum install -y curl wget git ca-certificates + run_yum_install curl wget git ca-certificates elif command -v dnf &> /dev/null; then dnf install -y curl wget git ca-certificates else