From 4346f4b460e89fa1c8a381824570f2028d182619 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Tue, 15 Apr 2025 23:40:58 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E4=B8=8D=E9=87=8D=E8=A6=81=E7=9A=84?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 12 ++++++------ README.md | 12 ++++++------ reinstall.sh | 27 ++++++++++++++++++++------- trans.sh | 6 +++++- 4 files changed, 37 insertions(+), 20 deletions(-) diff --git a/README.en.md b/README.en.md index 5eb02bb..7bd68ca 100644 --- a/README.en.md +++ b/README.en.md @@ -39,7 +39,7 @@ The system requirements for the target system are as follows: | RHEL   AlmaLinux   Rocky   Oracle | 8, 9 | 512 MB \* | 5 GB | | OpenCloudOS | 8, 9, Stream 23 | 512 MB \* | 5 GB | | CentOS Stream | 9, 10 | 512 MB \* | 5 GB | -| Fedora | 40, 41 | 512 MB \* | 5 GB | +| Fedora | 41, 42 | 512 MB \* | 5 GB | | openEuler | 20.03 LTS - 24.03 LTS, 25.03 | 512 MB \* | 5 GB | | openSUSE | Leap 15.6, Tumbleweed (Rolling) | 512 MB \* | 5 GB | | NixOS | 24.11 | 512 MB | 5 GB | @@ -132,7 +132,7 @@ bash reinstall.sh anolis 7|8|23 oracle 8|9 almalinux 8|9 centos 9|10 - fedora 40|41 + fedora 41|42 nixos 24.11 debian 9|10|11|12 opensuse 15.6|tumbleweed @@ -163,9 +163,9 @@ bash reinstall.sh anolis 7|8|23 - `--hold 2` Prevent reboot after installation completes, allowing SSH login to modify system content; the system is mounted at `/os` (this feature is not supported on Debian/Kali). > [!TIP] -> When installing Debian/Kali, x86 architectures can monitor the installation progress through VNC in the background, while ARM architectures can use the serial console. +> When installing Debian/Kali, x86 architectures can monitor the installation progress through VNC from server provider, while ARM architectures can use the serial console. > -> When installing other systems, can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console). +> When installing other systems, can monitor the progress through various methods (SSH, HTTP 80 port, VNC from server provider, serial console). >
Even if errors occur during the installation process, you can still install to Alpine via SSH by running `/trans.sh alpine`
@@ -219,7 +219,7 @@ bash reinstall.sh dd --img "https://example.com/xxx.xz" - `--hold 2` Prevent reboot after the DD process finishes, allowing SSH login to modify system content. The Windows system will be mounted at `/os`, but Linux systems will **NOT** be automatically mounted. > [!TIP] -> Can monitor the progress through various methods (SSH, HTTP 80 port, VNC in the background, serial console). +> Can monitor the progress through various methods (SSH, HTTP 80 port, VNC from server provider, serial console). >
Even if errors occur during the installation process, you can still install to Alpine via SSH by running `/trans.sh alpine` ### Feature 3: Reboot to Alpine Live OS (RAM OS) @@ -400,7 +400,7 @@ bash reinstall.sh windows \ - AWS ([ENA Network Adapter][aws-ena], [NVME Storage Controller][aws-nvme]) - GCP ([gVNIC Network Adapter][gcp-gvnic], [GGA Display Adapter][gcp-gga]) - Azure ([MANA Network Adapter][azure-mana]) -- Intel ([VMD Storage Controller][intel-vmd], Network Adapter: [7][intel-nic-7-sha1], [8][intel-nic-8], [8.1][intel-nic-8.1], [10][intel-nic-10], [11][intel-nic-11], [2008 R2][intel-nic-7-sha1], [2012][intel-nic-2012], [2012 R2][intel-nic-2012-r2], [2016][intel-nic-2016], [2019][intel-nic-2019], [2022][intel-nic-2022], [2025][intel-nic-2025]) +- Intel ([VMD Storage Controller][intel-vmd], Network Adapter: [7][intel-nic-7-sha256], [8][intel-nic-8], [8.1][intel-nic-8.1], [10][intel-nic-10], [11][intel-nic-11], [2008 R2][intel-nic-7-sha1], [2012][intel-nic-2012], [2012 R2][intel-nic-2012-r2], [2016][intel-nic-2016], [2019][intel-nic-2019], [2022][intel-nic-2022], [2025][intel-nic-2025]) [virtio-virtio]: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/ [virtio-aliyun]: https://www.alibabacloud.com/help/ecs/user-guide/install-the-virtio-driver-1 diff --git a/README.md b/README.md index c9e84c8..7a0c0e4 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ | RHEL   AlmaLinux   Rocky   Oracle | 8, 9 | 512 MB \* | 5 GB | | OpenCloudOS | 8, 9, Stream 23 | 512 MB \* | 5 GB | | CentOS Stream | 9, 10 | 512 MB \* | 5 GB | -| Fedora | 40, 41 | 512 MB \* | 5 GB | +| Fedora | 41, 42 | 512 MB \* | 5 GB | | openEuler | 20.03 LTS - 24.03 LTS, 25.03 | 512 MB \* | 5 GB | | openSUSE | Leap 15.6, Tumbleweed (滚动) | 512 MB \* | 5 GB | | NixOS | 24.11 | 512 MB | 5 GB | @@ -132,7 +132,7 @@ bash reinstall.sh anolis 7|8|23 oracle 8|9 almalinux 8|9 centos 9|10 - fedora 40|41 + fedora 41|42 nixos 24.11 debian 9|10|11|12 opensuse 15.6|tumbleweed @@ -163,9 +163,9 @@ bash reinstall.sh anolis 7|8|23 - `--hold 2` 安装结束后不重启,此时可以 SSH 登录修改系统内容,系统挂载在 `/os` (此功能不支持 Debian/Kali) > [!TIP] -> 安装 Debian/Kali 时,x86 可通过后台 VNC 查看安装进度,ARM 可通过串行控制台查看安装进度。 +> 安装 Debian/Kali 时,x86 可通过商家后台 VNC 查看安装进度,ARM 可通过串行控制台查看安装进度。 > -> 安装其它系统时,可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。 +> 安装其它系统时,可通过多种方式(SSH、HTTP 80 端口、商家后台 VNC、串行控制台)查看安装进度。 >
即使安装过程出错,也能通过 SSH 运行 `/trans.sh alpine` 安装到 Alpine。
@@ -219,7 +219,7 @@ bash reinstall.sh dd --img "https://example.com/xxx.xz" - `--hold 2` DD 结束后不重启,此时可以 SSH 登录修改系统内容,Windows 系统会挂载在 `/os`,Linux 系统**不会**自动挂载 > [!TIP] -> 可通过多种方式(SSH、HTTP 80 端口、后台 VNC、串行控制台)查看安装进度。 +> 可通过多种方式(SSH、HTTP 80 端口、商家后台 VNC、串行控制台)查看安装进度。 >
即使安装过程出错,也能通过 SSH 运行 `/trans.sh alpine` 安装到 Alpine。 ### 功能 3: 重启到 Alpine Live OS(内存系统) @@ -400,7 +400,7 @@ bash reinstall.sh windows \ - AWS ([ENA 网卡][aws-ena], [NVME 存储控制器][aws-nvme]) - GCP ([gVNIC 网卡][gcp-gvnic], [GGA 显卡][gcp-gga]) - Azure ([MANA 网卡][azure-mana]) -- Intel ([VMD 存储控制器][intel-vmd], 网卡: [7][intel-nic-7-sha1], [8][intel-nic-8], [8.1][intel-nic-8.1], [10][intel-nic-10], [11][intel-nic-11], [2008 R2][intel-nic-7-sha1], [2012][intel-nic-2012], [2012 R2][intel-nic-2012-r2], [2016][intel-nic-2016], [2019][intel-nic-2019], [2022][intel-nic-2022], [2025][intel-nic-2025]) +- Intel ([VMD 存储控制器][intel-vmd], 网卡: [7][intel-nic-7-sha256], [8][intel-nic-8], [8.1][intel-nic-8.1], [10][intel-nic-10], [11][intel-nic-11], [2008 R2][intel-nic-7-sha256], [2012][intel-nic-2012], [2012 R2][intel-nic-2012-r2], [2016][intel-nic-2016], [2019][intel-nic-2019], [2022][intel-nic-2022], [2025][intel-nic-2025]) [virtio-virtio]: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/ [virtio-aliyun]: https://www.alibabacloud.com/help/ecs/user-guide/install-the-virtio-driver-1 diff --git a/reinstall.sh b/reinstall.sh index 1b51a9f..ef8dca8 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -52,7 +52,7 @@ Usage: $reinstall_____ anolis 7|8|23 oracle 8|9 almalinux 8|9 centos 9|10 - fedora 40|41 + fedora 41|42 nixos 24.11 debian 9|10|11|12 opensuse 15.6|tumbleweed @@ -200,13 +200,25 @@ get_os_part() { awk '($2=="/") { print $1 }' /proc/mounts } +umount_all() { + # windows defender 打开时,cygwin 运行 mount 很慢,但 cat /proc/mounts 很快 + if mount_lists=$(mount | grep -w "on $1" | awk '{print $3}' | grep .); then + # alpine 没有 -R + if umount --help 2>&1 | grep -wq -- '-R'; then + umount -R "$1" + else + echo "$mount_lists" | tac | xargs -n1 umount + fi + fi +} + cp_to_btrfs_root() { mount_dir=$tmp/reinstall-btrfs-root if ! grep -q $mount_dir /proc/mounts; then mkdir -p $mount_dir mount "$(get_os_part)" $mount_dir -t btrfs -o subvol=/ fi - cp -rf "$@" $tmp/reinstall-btrfs-root + cp -rf "$@" "$mount_dir" } is_host_has_ipv4_and_ipv6() { @@ -1584,8 +1596,8 @@ Continue with DD? rocky) ci_image=$ci_mirror/Rocky-$releasever-GenericCloud-Base.latest.$basearch.qcow2 ;; fedora) # 不加 / 会跳转到 https://dl.fedoraproject.org,纯 ipv6 无法访问 - # curl -L -6 https://d2lzkl7pfhq30w.cloudfront.net/pub/fedora/linux/releases/41/Cloud/x86_64/images - # curl -L -6 https://d2lzkl7pfhq30w.cloudfront.net/pub/fedora/linux/releases/41/Cloud/x86_64/images/ + # curl -L -6 https://d2lzkl7pfhq30w.cloudfront.net/pub/fedora/linux/releases/42/Cloud/x86_64/images + # curl -L -6 https://d2lzkl7pfhq30w.cloudfront.net/pub/fedora/linux/releases/42/Cloud/x86_64/images/ filename=$(curl -L $ci_mirror/ | grep -oP "Fedora-Cloud-Base-Generic.*?.qcow2" | sort -uV | tail -1 | grep .) ci_image=$ci_mirror/$filename @@ -1775,7 +1787,7 @@ verify_os_name() { 'rocky 8|9' \ 'redhat 8|9' \ 'oracle 8|9' \ - 'fedora 40|41' \ + 'fedora 41|42' \ 'nixos 24.11' \ 'debian 9|10|11|12' \ 'opensuse 15.6|16.0|tumbleweed' \ @@ -2979,8 +2991,9 @@ mkdir_clear() { return fi - # alpine 没有 -R - # { umount $dir || umount -R $dir || true; } 2>/dev/null + # 再次运行时,有可能 mount 了 btrfs root,因此先要 umount_all + # 但目前不需要 mount ,因此用不到 + # umount_all $dir rm -rf $dir mkdir -p $dir } diff --git a/trans.sh b/trans.sh index 3c40319..2ee9847 100644 --- a/trans.sh +++ b/trans.sh @@ -2030,6 +2030,8 @@ EOF cat -n net.cfg # 正常应该是 -D gentoo,但 alpine 的 cloud-init 包缺少 gentoo 配置 cloud-init devel net-convert -p net.cfg -k yaml -d out -D alpine -O networkd + + # 注意名字是 10-cloud-init-eth*.network,fix-eth-name.sh 会此文件名查找配置文件 cp out/etc/systemd/network/10-cloud-init-eth*.network $os_dir/etc/systemd/network/ # 删除网卡名匹配 @@ -2359,7 +2361,7 @@ create_part() { # 向下取整 MiB # gpt 最后 33 个扇区是备份分区表,不可用 - # parted 会忽略最后不足 1MiB 的部分 + # parted 结束位置填 100% 时也会忽略最后不足 1MiB 的部分,我们模仿它 max_can_use_m=$((total_sector_count_except_backup_gpt * sector_size / 1024 / 1024)) echo "expect_m: $expect_m" @@ -6726,6 +6728,8 @@ elif [ "$1" = "alpine" ]; then distro=alpine # 后面的步骤很多都会用到这个,例如分区布局 cloud_image=0 +elif [ -n "$1" ]; then + error_and_exit "unknown option $1" fi # 无参数运行部分