From cfb7985deba2eaf7cfcd7553b6a6f00ca8c66a72 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Fri, 2 Feb 2024 00:49:24 +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 | 28 +++++++++++++++++----------- README.md | 28 +++++++++++++++++----------- reinstall.sh | 29 +++++++++++++---------------- trans.sh | 25 +++++-------------------- ubuntu.yaml | 2 +- 5 files changed, 53 insertions(+), 59 deletions(-) diff --git a/README.en.md b/README.en.md index 6d419e6..c264780 100644 --- a/README.en.md +++ b/README.en.md @@ -117,25 +117,27 @@ bash reinstall.sh netboot.xyz ### Feature 5: Install Windows ISO +- Pay attention to the quotation marks around the parameters + ```bash bash reinstall.sh windows \ --iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso' \ --image-name 'Windows 10 Enterprise LTSC 2021' ``` -![windows installer](https://filestore.community.support.microsoft.com/api/images/67c13a8c-cee6-47cd-ae80-a55923875c83) +![Installing Windows](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7) Parameters: `--iso` Original image link -`--image-name` Specify the image to install, case-insensitive, should be enclosed in quotes on both sides, for example: +`--image-name` Specify the image to install, case-insensitive, for example: ```text -'Windows 7 Ultimate' -'Windows 10 Enterprise LTSC 2021' -'Windows 11 Pro' -'Windows Server 2022 SERVERDATACENTER' +Windows 7 Ultimate +Windows 10 Enterprise LTSC 2021 +Windows 11 Pro +Windows Server 2022 SERVERDATACENTER ``` Use `Dism++` File menu > Open Image File, select the iso to be installed to get the image name. @@ -143,9 +145,8 @@ Use `Dism++` File menu > Open Image File, select the iso to be installed to get ![image-name](https://github.com/bin456789/reinstall/assets/7548515/5aae0a9b-61e2-4f66-bb98-d470a6beaac2) 1. Supported systems: - - Windows Vista to Windows 11 - - Windows Server 2008 to Windows Server 2022 - - Windows Server variants, such as + - Windows Vista to 11 + - Windows Server 2008 to 2022, including the following variants - Windows Server Essentials - Windows Server Annual Channel - Hyper-V Server @@ -206,6 +207,8 @@ Please use . | Windows (iso) | administrator | 123@@@ | | Windows (dd) | Image username | Image password | +If encountering a password error during remote login to Windows, try using the username .\administrator. + ## If the script cannot be downloaded under Windows You can try the following methods: @@ -233,6 +236,9 @@ You can try the following methods: - Install mode: Static IP, IPv6, multiple NICs -## Promotion +## Thanks -[![DartNode](https://github.com/bin456789/reinstall/assets/7548515/7531e443-4069-4bf1-a40e-2e965f311e3f)](https://dartnode.com/) +Thanks to the following businesses for providing free servers. + +[![Oracle Cloud](https://github.com/bin456789/reinstall/assets/7548515/8b430ed4-8344-4f96-b4da-c2bda031cc90)](https://www.oracle.com/cloud/) +[![DartNode](https://github.com/bin456789/reinstall/assets/7548515/12e3df20-06b8-4825-8319-65351f06e1ad)](https://dartnode.com/) diff --git a/README.md b/README.md index bb44aaf..ea5399c 100644 --- a/README.md +++ b/README.md @@ -117,25 +117,27 @@ bash reinstall.sh netboot.xyz ### 功能 5: 安装 Windows ISO +- 注意参数两边的引号 + ```bash bash reinstall.sh windows \ --iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso' \ --image-name 'Windows 10 Enterprise LTSC 2021' ``` -![windows installer](https://filestore.community.support.microsoft.com/api/images/67c13a8c-cee6-47cd-ae80-a55923875c83) +![Installing Windows](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7) 参数: `--iso` 原版镜像链接 -`--image-name` 指定要安装的映像,不区分大小写,两边要有引号,例如: +`--image-name` 指定要安装的映像,不区分大小写,例如: ```text -'Windows 7 Ultimate' -'Windows 10 Enterprise LTSC 2021' -'Windows 11 Pro' -'Windows Server 2022 SERVERDATACENTER' +Windows 7 Ultimate +Windows 10 Enterprise LTSC 2021 +Windows 11 Pro +Windows Server 2022 SERVERDATACENTER ``` 使用 `Dism++` 文件菜单 > 打开映像文件,选择要安装的 iso,可以得到映像名称 @@ -143,9 +145,8 @@ bash reinstall.sh windows \ ![image-name](https://github.com/bin456789/reinstall/assets/7548515/5aae0a9b-61e2-4f66-bb98-d470a6beaac2) 1. 支持的系统: - - Windows Vista 到 Windows 11 - - Windows Server 2008 到 Windows Server 2022 - - Windows Server 变体,例如 + - Windows Vista 到 11 + - Windows Server 2008 到 2022,包括以下衍生版 - Windows Server Essentials - Windows Server Annual Channel - Hyper-V Server @@ -206,6 +207,8 @@ bash reinstall.sh windows \ | Windows (iso) | administrator | 123@@@ | | Windows (dd) | 镜像用户名 | 镜像密码 | +如果远程登录 Windows 提示密码错误,尝试用户名 `.\administrator` + ## 如果 Windows 下无法下载脚本 可尝试以下几种方法 @@ -233,6 +236,9 @@ bash reinstall.sh windows \ - 安装模式:静态 IP、IPv6、多网卡 -## 推广 +## 感谢 -[![DartNode](https://github.com/bin456789/reinstall/assets/7548515/7531e443-4069-4bf1-a40e-2e965f311e3f)](https://dartnode.com/) +感谢以下商家提供白嫖机器 + +[![Oracle Cloud](https://github.com/bin456789/reinstall/assets/7548515/8b430ed4-8344-4f96-b4da-c2bda031cc90)](https://www.oracle.com/cloud/) +[![DartNode](https://github.com/bin456789/reinstall/assets/7548515/12e3df20-06b8-4825-8319-65351f06e1ad)](https://dartnode.com/) diff --git a/reinstall.sh b/reinstall.sh index fc16cc4..ec39a59 100644 --- a/reinstall.sh +++ b/reinstall.sh @@ -838,13 +838,16 @@ is_efi() { is_secure_boot_enabled() { if is_efi; then if is_in_windows; then - reg query 'HKLM\SYSTEM\CurrentControlSet\Control\SecureBoot\State' /v UEFISecureBootEnabled | grep 0x1 && return 0 + reg query 'HKLM\SYSTEM\CurrentControlSet\Control\SecureBoot\State' /v UEFISecureBootEnabled | grep 0x1 else - # mokutil --sb-state - dmesg | grep -i 'Secure boot enabled' && return 0 + # localhost:~# mokutil --sb-state + # SecureBoot disabled + # Platform is in Setup Mode + dmesg | grep -i 'Secure boot enabled' fi + else + return 1 fi - return 1 } is_use_grub() { @@ -1133,16 +1136,12 @@ install_grub_linux_efi() { grub_efi=grubx64.efi fi - # fedora 的 efi 无法识别 opensuse tumbleweed 的 xfs - # opensuse tumbleweed aarch64 的 efi 无法识别 alpine 3.19 的内核 - if [ "$basearch" = aarch64 ]; then - efi_distro=fedora - else - efi_distro=opensuse - fi + # fedora 39 的 efi 无法识别 opensuse tumbleweed 的 xfs + efi_distro=opensuse # 不要用 download.opensuse.org 和 download.fedoraproject.org # 因为 ipv6 访问有时跳转到 ipv4 地址,造成 ipv6 only 机器无法下载 + # 日韩机器有时得到国内链接,且连不上 if [ "$efi_distro" = fedora ]; then fedora_ver=39 @@ -1160,11 +1159,9 @@ install_grub_linux_efi() { mirror=https://mirror.fcix.net/opensuse fi - file=tumbleweed/repo/oss/EFI/BOOT/grub.efi - if [ "$basearch" = aarch64 ]; then - file=ports/aarch64/$file - fi - curl -Lo /tmp/$grub_efi $mirror/$file + [ "$basearch" = x86_64 ] && ports='' || ports=/ports/$basearch + + curl -Lo /tmp/$grub_efi $mirror$ports/tumbleweed/repo/oss/EFI/BOOT/grub.efi fi add_efi_entry_in_linux /tmp/$grub_efi diff --git a/trans.sh b/trans.sh index 0e4caaa..84e4741 100644 --- a/trans.sh +++ b/trans.sh @@ -219,12 +219,8 @@ find_xda() { # busybox fdisk 不显示 mbr 分区表 id # fdisk 在 util-linux-misc 里面,占用大 # sfdisk 占用小 - if is_have_cmd sfdisk; then - need_del_sfdisk=false - else - apk add sfdisk - need_del_sfdisk=true - fi + + apk add sfdisk for disk in $(get_all_disks); do if sfdisk --disk-id "/dev/$disk" | sed 's/0x//' | grep -ix "$main_disk"; then @@ -237,9 +233,7 @@ find_xda() { error_and_exit "Could not find xda: $main_disk" fi - if $need_del_sfdisk; then - apk del sfdisk - fi + apk del sfdisk } get_all_disks() { @@ -2252,18 +2246,9 @@ download_netboot_xyz_efi() { } refind_main_disk() { - if is_have_cmd sfdisk; then - need_del_sfdisk=false - else - apk add sfdisk - need_del_sfdisk=true - fi - + apk add sfdisk main_disk="$(sfdisk --disk-id "/dev/$xda" | sed 's/0x//')" - - if $need_del_sfdisk; then - apk del sfdisk - fi + apk del sfdisk } install_redhat_ubuntu() { diff --git a/ubuntu.yaml b/ubuntu.yaml index 0f13565..2f331b4 100644 --- a/ubuntu.yaml +++ b/ubuntu.yaml @@ -57,7 +57,7 @@ autoinstall: # 下载合并分区脚本 cd /target - curl -O $confhome/resize.sh + curl -LO $confhome/resize.sh # 升级 cloud-init # curtin in-target --target=/target -- apt update