feat: 自动设置中国时区 (Asia/Shanghai)

- 安装时自动设置系统时区为东八区
- 解决服务器时间慢8小时的问题
- 使用 timedatectl 或 ln 命令兼容不同系统

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-01 00:30:49 +08:00
parent dbc7952df3
commit 24c49cdf2f

View File

@@ -933,7 +933,13 @@ main() {
apt install -y cups avahi-daemon wget unzip apt install -y cups avahi-daemon wget unzip
success "CUPS 和 Avahi 安装完成" success "CUPS 和 Avahi 安装完成"
# 3. 安装中文语言包CUPS汉化 # 3. 设置中国时区
info "设置系统时区为中国Asia/Shanghai..."
timedatectl set-timezone Asia/Shanghai 2>/dev/null || \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
success "时区设置完成:$(date '+%Y-%m-%d %H:%M:%S')"
# 4. 安装中文语言包CUPS汉化
info "安装中文语言包..." info "安装中文语言包..."
apt install -y locales language-pack-zh-hans 2>/dev/null || apt install -y locales 2>/dev/null apt install -y locales language-pack-zh-hans 2>/dev/null || apt install -y locales 2>/dev/null
# 生成中文 locale # 生成中文 locale