diff --git a/scripts/4_install_jumpserver.sh b/scripts/4_install_jumpserver.sh index 7f60d81b..87cb840e 100755 --- a/scripts/4_install_jumpserver.sh +++ b/scripts/4_install_jumpserver.sh @@ -44,8 +44,30 @@ function post_install() { echo -e "\n\n" } +function set_lang() { + # 安装默认不会为中文,所以直接用中文 + if [[ "${LANG-''}" == "zh_CN.UTF-8" ]];then + return + fi + # 设置过就不用改了 + if grep "export LANG=" ~/.bashrc &> /dev/null;then + return + fi + lang="cn" + read_from_input lang "语言 Language " "cn/en" "${lang}" + LANG='zh_CN.UTF-8' + if [[ "${lang}" == "en" ]];then + LANG='en_US.UTF-8' + fi + echo "export LANG=${LANG}" >> ~/.bashrc + # 之所以这么设置,是因为设置完 ~/.bashrc,就不会再询问,然而 LANG 环境变量,在用户当前 bash 进程中不生效 + echo "export LANG=${LANG}" >> "${PROJECT_DIR}"/static.env + export LANG +} + function main() { echo_logo + set_lang pre_install echo_green "\n>>> $(gettext -s 'Install and Configure JumpServer')" (bash "${BASE_DIR}/1_config_jumpserver.sh") diff --git a/static.env b/static.env index 8a131931..fe82e3fd 100644 --- a/static.env +++ b/static.env @@ -1 +1 @@ -export VERSION=dev \ No newline at end of file +export VERSION=dev