core: 添加参数禁止安装云内核

This commit is contained in:
bin456789
2026-09-07 19:21:11 +08:00
parent 86b88f5b71
commit 5db0516751
4 changed files with 41 additions and 13 deletions
+1
View File
@@ -189,6 +189,7 @@ bash reinstall.sh anolis 7|8|23
- `--ssh-port PORT` Change the SSH port
- `--web-port PORT` Change the Web port (for log observation during installation only)
- `--frpc-config PATH` Add frpc for intranet tunneling. Parameter can be local filepath or HTTP URL of the configuration file.
- `--no-cloud-kernel` Avoid using cloud kernel to prevent black or glitch screens on certain machines; applicable to Debian, Ubuntu, and Alpine.
- `--hold 1` Reboot only into install environment, without running installer, only for SSH connect to test network connection.
- `--hold 2` Prevent reboot after installation completes, allowing SSH login to modify system content; the system is mounted at `/target` for Debian/Kali and `/os` for other distros.
+1
View File
@@ -189,6 +189,7 @@ bash reinstall.sh anolis 7|8|23
- `--ssh-port PORT` 修改 SSH 端口
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
- `--frpc-config PATH` 添加 frpc 内网穿透,参数填配置文件的本地路径或 HTTP 链接
- `--no-cloud-kernel` 不使用云内核,避免部分机器黑屏/花屏,适用于 Debian、Ubuntu、Alpine
- `--hold 1` 仅重启到安装环境,不运行安装,用于 SSH 登录验证网络连通性
- `--hold 2` 安装结束后不重启,用于 SSH 登录修改系统内容,Debian/Kali 会挂载在 `/target`,其它系统会挂载在 `/os`
+19 -4
View File
@@ -119,7 +119,10 @@ Usage: $reinstall_____ anolis 7|8|23
[--rdp-port PORT]
[--add-driver INF_OR_DIR]
Manual: https://github.com/bin456789/reinstall
For Linux Only:
[--no-cloud-kernel] (Debian/Ubuntu/Alpine)
Manual: https://github.com/bin456789/reinstall
EOF
exit 1
@@ -1470,11 +1473,19 @@ Continue?
# cloud.debian.org 同样在瑞典,不是 cdn
fi
# kernel
if [ "$no_cloud_kernel" = 1 ]; then
flavour=
else
is_virt && flavour=-cloud || flavour=
# debian 10 云内核 vultr efi vnc 没有显示
[ "$releasever" -le 10 ] && flavour=
# 现在改成手动 --no-cloud-kernel 规避
# [ "$releasever" -le 10 ] && flavour=
# 甲骨文 arm64 cloud 内核 vnc 没有显示
[ "$basearch_alt" = arm64 ] && flavour=
fi
if is_use_cloud_image; then
# cloud image
@@ -3526,7 +3537,7 @@ build_extra_cmdline() {
# 会将 extra.xxx=yyy 写入新系统的 /etc/modprobe.d/local.conf
# https://answers.launchpad.net/ubuntu/+question/249456
# https://salsa.debian.org/installer-team/rootskel/-/blob/master/src/lib/debian-installer-startup.d/S02module-params?ref_type=heads
for key in confhome hold force_boot_mode force_cn force_old_windows_setup cloud_image main_disk \
for key in confhome hold force_boot_mode force_cn force_old_windows_setup cloud_image no_cloud_kernel main_disk \
elts deb_mirror \
username ssh_port rdp_port web_port web_path allow_ping; do
value=${!key}
@@ -4762,7 +4773,7 @@ fi
# 整理参数
long_opts=
for o in ci installer debug minimal allow-ping force-cn help \
for o in ci installer debug minimal no-cloud-kernel allow-ping force-cn help \
add-driver: \
hold: sleep: \
iso: \
@@ -4858,6 +4869,10 @@ while true; do
minimal=1
shift
;;
--no-cloud-kernel)
no_cloud_kernel=1
shift
;;
--allow-ping)
allow_ping=1
shift
+16 -5
View File
@@ -1613,11 +1613,16 @@ install_alpine() {
rc-update add acpid
fi
# 如果是 vm 就用 virt 内核
if is_virt; then
kernel_flavor="virt"
# 内核
# shellcheck disable=SC2154
if [ "$no_cloud_kernel" = 1 ]; then
kernel_flavor=lts
else
kernel_flavor="lts"
if is_virt; then
kernel_flavor=virt
else
kernel_flavor=lts
fi
fi
# 重置为官方仓库配置
@@ -8306,6 +8311,13 @@ get_ubuntu_kernel_flavor() {
# https://github.com/canonical/cloud-init/blob/main/tools/ds-identify
# http://git.annexia.org/?p=virt-what.git;a=blob;f=virt-what.in;hb=HEAD
is_ubuntu_lts && suffix=-hwe-$releasever || suffix=
if [ "$no_cloud_kernel" = 1 ]; then
echo generic$suffix
return
fi
# 这里有坑
# $(get_cloud_vendor) 调用了 cache_dmi_and_virt
# 但是 $(get_cloud_vendor) 运行在 subshell 里面
@@ -8316,7 +8328,6 @@ get_ubuntu_kernel_flavor() {
case "$vendor" in
aws | gcp | oracle | azure | ibm) echo $vendor ;;
*)
is_ubuntu_lts && suffix=-hwe-$releasever || suffix=
if is_virt; then
echo virtual$suffix
else