#!/usr/bin/env bash # # ... # # 使用方法: # URL="https://git.1-h.cc/Scripts/Linux/raw/branch/main/debian/upgrade.sh"; curl -fsSL "$URL" | bash # 设置非交互式环境变量 export DEBIAN_FRONTEND=noninteractive apt -qq update # 安装自动更新 apt install -y unattended-upgrades # 启用自动更新 dpkg-reconfigure -plow unattended-upgrades # ARGS_configure=() # ARGS_configure+=("--force-confdef") # 强制使用默认配置。如果有配置文件冲突,它会选择默认选项。 # ARGS_configure+=("--force-confold") # 强制保留旧的配置文件。如果有冲突,保留现有版本而不是提示用户选择。 # DEBIAN_FRONTEND=noninteractive dpkg --configure -a "${ARGS_configure[@]}" # 配置自动更新并在凌晨2点自动重启 cat <