mirror of
https://github.com/bin456789/reinstall.git
synced 2026-10-04 06:27:49 +08:00
debian/opensuse: 完善云内核驱动判断
This commit is contained in:
+1
-1
@@ -189,7 +189,7 @@ bash reinstall.sh anolis 7|8|23
|
|||||||
- `--ssh-port PORT` Change the SSH port
|
- `--ssh-port PORT` Change the SSH port
|
||||||
- `--web-port PORT` Change the Web port (for log observation during installation only)
|
- `--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.
|
- `--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.
|
- `--no-cloud-kernel` Avoid using cloud kernel to prevent black or glitch screens on certain machines; applicable to Debian, Ubuntu, Alpine and openSUSE.
|
||||||
- `--hold 1` Reboot only into install environment, without running installer, only for SSH connect to test network connection.
|
- `--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.
|
- `--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.
|
||||||
|
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ bash reinstall.sh anolis 7|8|23
|
|||||||
- `--ssh-port PORT` 修改 SSH 端口
|
- `--ssh-port PORT` 修改 SSH 端口
|
||||||
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
|
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
|
||||||
- `--frpc-config PATH` 添加 frpc 内网穿透,参数填配置文件的本地路径或 HTTP 链接
|
- `--frpc-config PATH` 添加 frpc 内网穿透,参数填配置文件的本地路径或 HTTP 链接
|
||||||
- `--no-cloud-kernel` 不使用云内核,避免部分机器黑屏/花屏,适用于 Debian、Ubuntu、Alpine
|
- `--no-cloud-kernel` 不使用云内核,避免部分机器黑屏/花屏,适用于 Debian、Ubuntu、Alpine、openSUSE
|
||||||
- `--hold 1` 仅重启到安装环境,不运行安装,用于 SSH 登录验证网络连通性
|
- `--hold 1` 仅重启到安装环境,不运行安装,用于 SSH 登录验证网络连通性
|
||||||
- `--hold 2` 安装结束后不重启,用于 SSH 登录修改系统内容,Debian/Kali 会挂载在 `/target`,其它系统会挂载在 `/os`
|
- `--hold 2` 安装结束后不重启,用于 SSH 登录修改系统内容,Debian/Kali 会挂载在 `/target`,其它系统会挂载在 `/os`
|
||||||
|
|
||||||
|
|||||||
+16
-5
@@ -11,7 +11,7 @@ confhome_cn=https://cnb.cool/bin456789/reinstall/-/git/raw/main
|
|||||||
# confhome_cn=https://www.ghproxy.cc/https://raw.githubusercontent.com/bin456789/reinstall/main
|
# confhome_cn=https://www.ghproxy.cc/https://raw.githubusercontent.com/bin456789/reinstall/main
|
||||||
|
|
||||||
# 用于判断 reinstall.sh 和 trans.sh 是否兼容
|
# 用于判断 reinstall.sh 和 trans.sh 是否兼容
|
||||||
SCRIPT_VERSION=4BACD833-A585-23BA-6CBB-9AA4E08E0004
|
SCRIPT_VERSION=4BACD833-A585-23BA-6CBB-9AA4E08E0005
|
||||||
|
|
||||||
# 记录要用到的 windows 程序,运行时输出删除 \r
|
# 记录要用到的 windows 程序,运行时输出删除 \r
|
||||||
WINDOWS_EXES='cmd powershell wmic reg diskpart netsh bcdedit mountvol'
|
WINDOWS_EXES='cmd powershell wmic reg diskpart netsh bcdedit mountvol'
|
||||||
@@ -4187,9 +4187,18 @@ exit_if_cant_use_cloud_kernel() {
|
|||||||
can_use_cloud_kernel() {
|
can_use_cloud_kernel() {
|
||||||
# initrd 下也要使用,不要用 <<<
|
# initrd 下也要使用,不要用 <<<
|
||||||
|
|
||||||
# 有些虚拟机用了 ahci,但云内核没有 ahci 驱动
|
if [ "$distro" = opensuse ]; then
|
||||||
cloud_eth_modules='ena|gve|mana|virtio_net|xen_netfront|hv_netvsc|vmxnet3|mlx4_en|mlx4_core|mlx5_core|ixgbevf'
|
# kernel-default-base 缺少 ena gve mlx mana 驱动
|
||||||
cloud_blk_modules='ata_generic|ata_piix|pata_legacy|nvme|virtio_blk|virtio_scsi|xen_blkfront|xen_scsifront|hv_storvsc|vmw_pvscsi'
|
cloud_eth_modules='virtio_net|xen_netfront|hv_netvsc|vmxnet3|e100|e1000|e1000e|8139cp|8139too'
|
||||||
|
cloud_blk_modules='ata_generic|ata_piix|ahci|nvme|virtio_blk|virtio_scsi|xen_blkfront|xen_scsifront|hv_storvsc|vmw_pvscsi'
|
||||||
|
else
|
||||||
|
# debian kali
|
||||||
|
cloud_eth_modules='ena|gve|mana|virtio_net|xen_netfront|hv_netvsc|vmxnet3|mlx4_en|mlx4_core|mlx5_core|ixgbevf'
|
||||||
|
cloud_blk_modules='ata_generic|ata_piix|pata_legacy|nvme|virtio_blk|virtio_scsi|xen_blkfront|xen_scsifront|hv_storvsc|vmw_pvscsi'
|
||||||
|
if { [ "$distro" = debian ] && [ "$releasever" -ge 13 ]; } || [ "$distro" = kali ]; then
|
||||||
|
cloud_blk_modules="$cloud_blk_modules|ahci"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# disk
|
# disk
|
||||||
drivers="$(get_disk_drivers $1)"
|
drivers="$(get_disk_drivers $1)"
|
||||||
@@ -4221,6 +4230,8 @@ create_can_use_cloud_kernel_sh() {
|
|||||||
$(get_function get_disk_drivers)
|
$(get_function get_disk_drivers)
|
||||||
$(get_function can_use_cloud_kernel)
|
$(get_function can_use_cloud_kernel)
|
||||||
|
|
||||||
|
distro="$distro"
|
||||||
|
releasever="$releasever"
|
||||||
can_use_cloud_kernel "\$@"
|
can_use_cloud_kernel "\$@"
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@@ -4335,7 +4346,7 @@ EOF
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
# 判断云镜像 debain 能否用云内核
|
# 判断云镜像 debain 能否用云内核
|
||||||
if is_distro_like_debian; then
|
if is_distro_like_debian || [ "$distro" = opensuse ]; then
|
||||||
create_can_use_cloud_kernel_sh can_use_cloud_kernel.sh
|
create_can_use_cloud_kernel_sh can_use_cloud_kernel.sh
|
||||||
insert_into_file init before '^exec (/bin/busybox )?switch_root' <<EOF
|
insert_into_file init before '^exec (/bin/busybox )?switch_root' <<EOF
|
||||||
cp /can_use_cloud_kernel.sh \$sysroot/
|
cp /can_use_cloud_kernel.sh \$sysroot/
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ set -eE
|
|||||||
|
|
||||||
# 用于判断 reinstall.sh 和 trans.sh 是否兼容
|
# 用于判断 reinstall.sh 和 trans.sh 是否兼容
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
SCRIPT_VERSION=4BACD833-A585-23BA-6CBB-9AA4E08E0004
|
SCRIPT_VERSION=4BACD833-A585-23BA-6CBB-9AA4E08E0005
|
||||||
|
|
||||||
TRUE=0
|
TRUE=0
|
||||||
FALSE=1
|
FALSE=1
|
||||||
@@ -4098,7 +4098,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# opensuse
|
# opensuse
|
||||||
# 1. kernel-default-base 缺少 nvme gve mlx5 mana 驱动,换成 kernel-default
|
# 1. kernel-default-base 缺少 ena gve mlx mana 驱动,换成 kernel-default
|
||||||
# 2. 添加微码+固件
|
# 2. 添加微码+固件
|
||||||
# https://documentation.suse.com/smart/virtualization-cloud/html/minimal-vm/index.html
|
# https://documentation.suse.com/smart/virtualization-cloud/html/minimal-vm/index.html
|
||||||
if grep -q opensuse $os_dir/etc/os-release; then
|
if grep -q opensuse $os_dir/etc/os-release; then
|
||||||
@@ -4120,11 +4120,18 @@ EOF
|
|||||||
rm /net.cfg
|
rm /net.cfg
|
||||||
|
|
||||||
# 选择新内核
|
# 选择新内核
|
||||||
# 只有 leap 有 kernel-azure
|
if [ "$no_cloud_kernel" = 1 ]; then
|
||||||
if grep -iq leap $os_dir/etc/os-release && [ "$(get_cloud_vendor)" = azure ]; then
|
|
||||||
target_kernel='kernel-azure'
|
|
||||||
else
|
|
||||||
target_kernel='kernel-default'
|
target_kernel='kernel-default'
|
||||||
|
else
|
||||||
|
# 只有 leap 有 kernel-azure
|
||||||
|
# shellcheck disable=SC2046
|
||||||
|
if grep -iq leap $os_dir/etc/os-release && [ "$(get_cloud_vendor)" = azure ]; then
|
||||||
|
target_kernel='kernel-azure'
|
||||||
|
elif sh /can_use_cloud_kernel.sh "$xda" $(get_eths); then
|
||||||
|
target_kernel='kernel-default-base'
|
||||||
|
else
|
||||||
|
target_kernel='kernel-default'
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# rpm -qi 不支持通配符
|
# rpm -qi 不支持通配符
|
||||||
|
|||||||
Reference in New Issue
Block a user