core: 不重要的更新

This commit is contained in:
bin456789
2026-09-06 12:12:28 +08:00
parent 6ec91dddb9
commit 6a0a2c9b3c
5 changed files with 371 additions and 105 deletions
+45 -25
View File
@@ -662,7 +662,8 @@ is_virt() {
if is_in_windows; then
# https://github.com/systemd/systemd/blob/main/src/basic/virt.c
# https://sources.debian.org/src/hw-detect/1.159/hw-detect.finish-install.d/08hw-detect/
vmstr='VMware|Virtual|Virtualization|VirtualBox|VMW|Hyper-V|Bochs|QEMU|KVM|OpenStack|KubeVirt|innotek|Xen|Parallels|BHYVE'
vmstr='VMware|VirtualBox|VMW|Hyper-V|Bochs|QEMU|KVM|OpenStack|KubeVirt|innotek|Xen|HVM|Parallels|BHYVE|OVMF'
vmstr+='|virt|Virtual|Virtualization'
for name in ComputerSystem BIOS BaseBoard; do
if wmic $name | grep -Eiw $vmstr; then
_is_virt=true
@@ -1090,6 +1091,14 @@ get_windows_iso_link() {
;;
esac
;;
2008 | '2008 r2')
case "$edition" in
serverweb | serverwebcore) echo _ ;;
serverstandard | serverstandardcore) echo _ ;;
serverenterprise | serverenterprisecore) echo _ ;;
serverdatacenter | serverdatacentercore) echo _ ;;
esac
;;
2012 | '2012 r2' | 2016 | 2019 | 2022 | 2025)
case "$edition" in
serverstandard | serverstandardcore) echo _ ;;
@@ -1241,6 +1250,9 @@ get_best_windows_iso_line() {
local lines
lines=$(cat)
# 排除 debug 版
lines=$(echo "$lines" | grep -Ei -v '_(symbols|debug|debugging|checked)_')
# 在所有符合的 iso 中
# 先选择 win10/11 大版本更新的 (version 26h1) 或者有 sp 版本的 (sp1, windows_8.1_with_update_)
# 再选择有日期更新的 (updated_july_2026)
@@ -1251,8 +1263,8 @@ get_best_windows_iso_line() {
# zh-cn_windows_server_2019_x64_dvd_19d65722.iso 2022-11-15
# cn_windows_server_2019_updated_april_2021_x64_dvd_a6dae187.iso 2021-04-20
for key in '(version|sp[0-9]|update)' 'updated' 'vl'; do
if grep_lines=$(grep -E "_${key}_" <<<"$lines"); then
for key in '(version_[0-9h]{4}|sp[1-9]|service_pack|with_update)' 'updated' 'vl'; do
if grep_lines=$(grep -Ei "_${key}_" <<<"$lines"); then
lines=$grep_lines
fi
done
@@ -1387,7 +1399,7 @@ setos() {
setos_debian() {
is_debian_elts() {
[ "$releasever" -le 10 ]
[ "$releasever" -le 11 ]
}
if [ "$releasever" -le 9 ] && [ "$basearch" = aarch64 ]; then
@@ -1545,7 +1557,6 @@ Continue?
# https://unicom.mirrors.ustc.edu.cn/ubuntu-cloud-images/releases/
# https://mirror.nju.edu.cn/ubuntu-cloud-images/releases/
# mirrors.cloud.tencent.com
ci_mirror=https://mirror.nju.edu.cn/ubuntu-cloud-images
else
ci_mirror=https://cloud-images.ubuntu.com
@@ -1717,10 +1728,10 @@ Continue?
# 16.0) file=Leap-$releasever-Minimal-VM.$basearch-kvm$(if [ "$basearch" = x86_64 ]; then echo '-and-xen'; fi).qcow2 ;;
esac
# https://src.opensuse.org/openSUSE/Leap-Images/src/branch/leap-16.0/kiwi-templates-Minimal/Minimal.kiwi
# kvm 镜像里面没有 cloud-init
# 但不够 Cloud 镜像通用?
# https://src.opensuse.org/pool/kiwi-templates-Minimal/src/branch/factory/Minimal.kiwi
# https://build.opensuse.org/projects/Virtualization:Appliances:Images:openSUSE-Tumbleweed/packages/kiwi-templates-Minimal/files/Minimal.kiwi
# 有专门的kvm镜像,openSUSE-Leap-15.5-Minimal-VM.x86_64-kvm-and-xen.qcow2,里面没有cloud-init
# file=openSUSE-Leap-15.5-Minimal-VM.x86_64-kvm-and-xen.qcow2
fi
img=$mirror/$dir/$file
fi
@@ -1858,10 +1869,10 @@ Continue with DD?
setos_fnos() {
# 系统盘大小
min=8
default=8
echo "请输入系统分区大小,最小 $min GB,但可能无法更新系统。"
echo "Please input System Partition Size. Minimal is $min GB but may not be able to do system updates."
min=10
default=64
echo "请输入系统分区大小,最小 $min GB,但可能无法更新系统。建议 $default GB。"
echo "Please input System Partition Size. Minimal is $min GB but may not be able to do system updates. Recommended is $default GB."
while true; do
IFS= read -r -p "Size in GB [$default]: " input
input=${input:-$default}
@@ -2064,15 +2075,18 @@ Continue with DD?
setos_opencloudos() {
# https://mirrors.opencloudos.tech 不支持 ipv6
# https://mirrors.cloud.tencent.com 没有 stream
# mirrors.cloud.tencent.com 为公网与内网统一域名
# https://cloud.tencent.com/document/product/213/8623
if [ "$releasever" -ge 23 ]; then
mirror=https://mirrors.opencloudos.tech/opencloudos-stream/releases
mirror=https://mirrors.cloud.tencent.com/opencloudos-stream/releases
else
mirror=https://mirrors.cloud.tencent.com/opencloudos
fi
if is_use_cloud_image; then
# ci
# https://opencloudos.org/api/v1/iso-releases/published
if [ -z "$img" ]; then
if [ "$releasever" -eq 9 ]; then
dir=$releasever/images/qcow2/$basearch
@@ -2786,7 +2800,7 @@ save_password() {
fi
# windows
if [ "$distro" = windows ] || [ "$distro" = dd ]; then
if [ "$distro" = windows ]; then
install_pkg iconv
# 要分两行写,因为 echo "$(xxx)" 返回值始终为 0,出错也不会中断脚本
@@ -3351,9 +3365,9 @@ install_grub_win() {
# grub 对应的 alpine 版本
case "$grub_ver" in
2.06) local alpine_ver=3.19 ;;
2.12) local alpine_ver=3.23 ;;
2.14) local alpine_ver=3.24 ;;
2.12) local alpine_ver=3.23 ;;
2.06) local alpine_ver=3.19 ;;
esac
# grub 架构名和对应的 alpine 包名
@@ -3395,9 +3409,10 @@ install_grub_win() {
fi
# 设置 grub 包含的模块
# 原系统是 windows,因此不需要 ext2 lvm xfs btrfs
grub_modules+=" normal minicmd serial ls echo test cat reboot halt linux chain search all_video configfile"
grub_modules+=" scsi part_msdos part_gpt fat ntfs ntfscomp lzopio xzio gzio zstd"
# 原系统是 windows,因此不需要 ext2 lvm xfs btrfs 模块
# vmlinuz/initramfs 不需要 grub 解压,因此不需要 lzopio xzio gzio zstd 模块
grub_modules="normal minicmd serial ls echo test cat reboot halt linux chain search all_video configfile"
grub_modules+=" scsi part_msdos part_gpt fat ntfs ntfscomp"
if ! is_efi; then
grub_modules+=" biosdisk linux16"
fi
@@ -3756,7 +3771,7 @@ EOF
# pata-modules 默认安装(改成可选),里面的驱动都是 pata_ 开头,但只有 pata_legacy.ko(+) 在云内核中
# sata-modules 默认安装(改成可选),里面的驱动大部分是 sata_ 开头的,其他重要的还有 ahci.ko libahci.ko ata_piix.ko(+)
# 云内核没有 sata 模块,也没有内嵌,有一个 CONFIG_SATA_HOST=y,libata-$(CONFIG_SATA_HOST) += libata-sata.o
# 云内核没有 sata 模块,也没有内嵌,有一个 CONFIG_SATA_HOST=y,libata-$(CONFIG_SATA_HOST) += libata-sata.o
# scsi-modules 默认安装(改成可选),包含 nvme.ko(+) 和各种虚拟化驱动(+)
download_and_extract_deb() {
@@ -3969,9 +3984,9 @@ EOF
fi
# amd64)
# level1=737 # MT=754108, qemu: -m 780
# level2=424 # MT=433340, qemu: -m 460
# min=316 # MT=322748, qemu: -m 350
# level1=737 # MT=754108, qemu: -m 780
# level2=424 # MT=433340, qemu: -m 460
# min=316 # MT=322748, qemu: -m 350
# 将 use_level 2 9 修改为 use_level 1
# x86 use_level 2 会出现 No root file system is defined.
@@ -4928,11 +4943,16 @@ EOF
[ -n "$2" ] || ssh_key_error_and_exit "Need value for $1"
case "$(to_lower <<<"$2")" in
github:* | gitlab:* | http://* | https://*)
gh:* | github:* | gl:* | gitlab:* | http://* | https://*)
if [[ "$(to_lower <<<"$2")" = http* ]]; then
key_url=$2
else
IFS=: read -r site user <<<"$2"
case "$(to_lower <<<"$site")" in
gh | github) site=github ;;
gl | gitlab) site=gitlab ;;
*) ;;
esac
[ -n "$user" ] || ssh_key_error_and_exit "Need a username for $site"
key_url="https://$site.com/$user.keys"
fi