diff --git a/README.en.md b/README.en.md index 1193a51..eb7a11b 100644 --- a/README.en.md +++ b/README.en.md @@ -17,7 +17,7 @@ Reinstall server with one-click [中文](README.md) - Specifically tailored for low-spec machines, addressing insufficient memory that prevents network installation. - Automatically detect dynamic and static IPv4 / IPv6, eliminating the need to fill in IP / subnet mask / gateway. - Support ARM, BIOS, EFI boot, with original system supporting LVM, BTRFS. -- No third-party custom packages included, all resources obtained in real-time from source sites. +- No homemade packages included, all resources obtained in real-time from source sites. - Includes many comments. ## System Requirements diff --git a/README.md b/README.md index a3e845d..79921a8 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ - 专门适配低配小鸡,解决内存过少导致无法进行网络安装 - 自动判断动静态 IPv4 / IPv6,无需填写 IP / 掩码 / 网关 - 支持 ARM,支持 BIOS、EFI 引导,原系统支持 LVM、BTRFS -- 不含第三方自制包,所有资源均实时从源站点获得 +- 不含自制包,所有资源均实时从源站点获得 - 有很多注释 ## 配置要求 diff --git a/reinstall.sh b/reinstall.sh index b70e153..6e0325f 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -104,13 +104,14 @@ curl() { } is_in_china() { - if [ -z $_is_in_china ]; then + if [ -z "$_loc" ]; then # 部分地区 www.cloudflare.com 被墙 - curl -L http://dash.cloudflare.com/cdn-cgi/trace | - grep -qx 'loc=CN' && _is_in_china=true || - _is_in_china=false + _loc=$(curl -L http://dash.cloudflare.com/cdn-cgi/trace | grep '^loc=' | cut -d= -f2) + if [ -z "$_loc" ]; then + error_and_exit "Can not get location." + fi fi - $_is_in_china + [ "$_loc" = CN ] } is_in_windows() { @@ -1893,6 +1894,8 @@ add_efi_entry_in_windows() { get_maybe_efi_dirs_in_linux() { # arch云镜像efi分区挂载在/efi,且使用 autofs,挂载后会有两个 /efi 条目 + # openEuler 云镜像 boot 分区是 vfat 格式,但 vfat 可以当 efi 分区用 + # TODO: 最好通过 lsblk/blkid 检查是否为 efi 分区类型 mount | awk '$5=="vfat" || $5=="autofs" {print $3}' | grep -E '/boot|/efi' | sort -u } diff --git a/trans.sh b/trans.sh index 66a1999..77499ad 100644 --- a/trans.sh +++ b/trans.sh @@ -757,7 +757,7 @@ EOF { echo if [ -n "$enpx" ] && [ "$enpx" != "$ethx" ]; then - echo rename $enpx=$ethx >>$conf_file + echo rename $enpx=$ethx fi echo $mode $ethx } >>$conf_file @@ -2234,15 +2234,15 @@ get_ci_installer_part_size() { # https://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img 500m # https://gentoo.osuosl.org/experimental/amd64/openstack/gentoo-openstack-amd64-systemd-latest.qcow2 800m - # openeuler 20.03 3g - if [ "$distro" = openeuler ]; then - echo 3GiB + if get_http_file_size_to size_bytes $img >&2 && [ -n "$size_bytes" ]; then + # 额外 +100M 文件系统保留大小 和 qcow2 写入空间 + size_bytes_mb=$((size_bytes / 1024 / 1024 + 100)) + # 最少 1g ,因为可能要用作临时 swap + echo "$((size_bytes_mb / 1024 + 1))GiB" else - if get_http_file_size_to size_bytes $img >&2 && [ -n "$size_bytes" ]; then - # 额外 +100M 文件系统保留大小 和 qcow2 写入空间 - size_bytes_mb=$((size_bytes / 1024 / 1024 + 100)) - # 最少 1g ,因为可能要用作临时 swap - echo "$((size_bytes_mb / 1024 + 1))GiB" + # openeuler 20.03 3g + if [ "$distro" = openeuler ] && [ "$releasever" = 20.03 ]; then + echo 3GiB else # 如果没获取到文件大小 echo 2GiB @@ -2338,13 +2338,7 @@ install_qcow_by_copy() { # alma 9 boot 分区的类型不是规定的 uuid # openeuler boot 分区是 fat 格式 boot_part=$(lsblk /dev/nbd0p* --sort SIZE -no NAME,FSTYPE | grep -E 'ext4|xfs|fat' | awk '{print $1}' | - grep -vx "$os_part" | { - if [ -n "$efi_part" ]; then - grep -vx "$efi_part" - else - cat - fi - } | tail -1 | awk '{print $1}') + grep -vx "$os_part" | grep -vx "$efi_part" | tail -1 | awk '{print $1}') if $is_lvm_image; then os_part="mapper/$os_part" @@ -3240,9 +3234,7 @@ install_windows() { if is_virt_contains kvm && ! is_virt_contains aws; then - # 要区分 win10 / win11 驱动,虽然他们的 NT 版本号都是 10.0 - # 但他们可能用不同的编译器编译 - # 未来 inf 也有可能不同 + # 要区分 win10 / win11 驱动,虽然他们的 NT 版本号都是 10.0,但驱动文件有区别 # https://github.com/virtio-win/kvm-guest-drivers-windows/commit/9af43da9e16e2d4bf4ea4663cdc4f29275fff48f # vista >>> 2k8 # 10 >>> w10 @@ -3250,7 +3242,6 @@ install_windows() { virtio_sys=$( case "$(echo "$product_ver" | to_lower)" in 'vista') echo 2k8 ;; # 没有 vista 文件夹 - '2025') echo 2k22 ;; # 暂时没有 *) case "$product_type" in WinNT) echo "w$product_ver" ;;