Update install.sh

This commit is contained in:
星光-k
2025-01-10 00:06:47 +08:00
committed by GitHub
parent 8337d62ed0
commit 25f2ab0e84

View File

@@ -7,7 +7,7 @@ if [ "$EUID" -ne 0 ]; then
fi
# 默认语言环境
DEFAULT_LANG="en_US.UTF-8"
DEFAULT_LANG="en_GB.UTF-8"
# 检查是否使用中国镜像源
USE_CN_MIRROR=false
# 控制调试输出
@@ -18,7 +18,6 @@ while [ "$#" -gt 0 ]; do
case "$1" in
--cn)
USE_CN_MIRROR=true
DEFAULT_LANG="zh_CN.UTF-8" # 当使用 --cn 参数时,设置默认语言为中文
;;
--debug)
DEBUG=true
@@ -31,11 +30,28 @@ while [ "$#" -gt 0 ]; do
shift
done
# 系统语言环境设置
echo "请选择系统语言环境:"
echo "1. 中文 (zh_CN.UTF-8)"
echo "2. 英文 (en_GB.UTF-8)"
read -p "输入选项 (1/2): " lang_choice
case $lang_choice in
1)
DEFAULT_LANG="zh_CN.UTF-8"
;;
2)
DEFAULT_LANG="en_GB.UTF-8"
;;
*)
echo "无效的选项,将使用默认系统语言环境: $DEFAULT_LANG"
;;
esac
# 设置语言环境
export LANG=$DEFAULT_LANG
export LC_ALL=$DEFAULT_LANG
# 如果 locale.gen 不存在,则添加到 locale.gen
# 添加到 locale.gen 如果不存在
if ! grep -q "^$DEFAULT_LANG UTF-8" /etc/locale.gen; then
echo "$DEFAULT_LANG UTF-8" >> /etc/locale.gen
fi
@@ -48,8 +64,8 @@ dpkg-reconfigure --frontend=noninteractive locales
# 如果需要调试输出
if [ "$DEBUG" = true ]; then
echo "语言设置为: $DEFAULT_LANG"
echo "使用中国镜像源: $USE_CN_MIRROR"
echo "Language set to: $DEFAULT_LANG"
echo "Using CN mirror: $USE_CN_MIRROR"
fi
# Debian版本相关命令
@@ -68,13 +84,14 @@ is_raspberry_pi() {
DEBIAN_MIRROR="http://deb.debian.org/debian/"
DEBIAN_SECURITY_MIRROR="http://security.debian.org/"
PI_SUGAR_POWER_MANAGER_URL="https://cdn.pisugar.com/release/pisugar-power-manager.sh"
INK_SCREEN_CLOCK_REPO_URL="https://gitee.com/xingguangk/2.13-Ink-screen-clock.git"
INK_SCREEN_CLOCK_REPO_URL="https://github.com/kxgx/2.13-Ink-screen-clock.git"
PIPY_MIRROR="https://pypi.org/simple"
# 如果使用中国镜像源,则更新链接变量
if [ "$USE_CN_MIRROR" = true ]; then
DEBIAN_MIRROR="https://mirrors.cernet.edu.cn/debian/"
DEBIAN_SECURITY_MIRROR="https://mirrors.cernet.edu.cn/debian-security"
INK_SCREEN_CLOCK_REPO_URL="https://gitee.com/xingguangk/2.13-Ink-screen-clock.git"
PIPY_MIRROR="https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
fi
@@ -160,7 +177,7 @@ if [ -f /etc/debian_version ]; then
update_sources_list "bullseye"
install_packages
install_pip_packages
#download_and_execute
download_and_execute
clone_and_execute
;;
12)
@@ -168,7 +185,7 @@ if [ -f /etc/debian_version ]; then
update_sources_list "bookworm"
install_packages
install_pip_packages
#download_and_execute
download_and_execute
clone_and_execute
;;
*)