Skip to content

Commit

Permalink
windows: 不再写死 boot.wim 的引导卷索引
Browse files Browse the repository at this point in the history
用于兼容某些精简版系统
  • Loading branch information
bin456789 committed Oct 3, 2024
1 parent 6a5ab5b commit 4d260fb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 19 deletions.
17 changes: 9 additions & 8 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ certutil -urlcache -f -split https://jihulab.com/bin456789/reinstall/-/raw/main/
- On virtual machines, the appropriate official slimmed-down kernel will be automatically installed.
- To install Red Hat, you need to provide the `qcow2` image link obtained from <https://access.redhat.com/downloads/content/rhel>.
- Username `root`, password `123@@@`. It may take a few minutes for the password to take effect on the first boot.
- When switching to key-based authentication, you also need to modify the files inside `/etc/ssh/sshd_config.d/`

```bash
bash reinstall.sh centos 9
Expand Down Expand Up @@ -218,14 +219,16 @@ bash reinstall.sh netboot.xyz
- If remote login fails, try using the username `.\administrator`.
- The machine with a static IP will automatically configure the IP. It may take a few minutes to take effect on the first boot.

![Installing Windows](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7)

#### Method 1: Allow the script to automatically find the ISO

- The script will search for ISO files from <https://massgrave.dev/genuine-installation-media.html>. The ISOs provided on this site are all official versions.
- Only supports automatic detection of standard Windows and Windows Server versions.

```bash
bash reinstall.sh windows \
--image-name 'Windows 10 Enterprise LTSC 2021' \
--image-name 'Windows 11 Enterprise LTSC 2024' \
--lang zh-cn
```

Expand Down Expand Up @@ -282,8 +285,8 @@ zh-tw

```bash
bash reinstall.sh windows \
--image-name 'Windows 10 Enterprise LTSC 2021' \
--iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso'
--image-name 'Windows 11 Enterprise LTSC 2024' \
--iso 'https://drive.massgrave.dev/zh-cn_windows_11_enterprise_ltsc_2024_x64_dvd_cff9cd2d.iso'
```

> [!IMPORTANT]
Expand All @@ -308,20 +311,18 @@ bash reinstall.sh windows \

</details>

![Installing Windows](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7)

#### Parameters Description

`--image-name` Specify the image to install, case-insensitive, Commonly used images include:

```text
Windows 7 Ultimate
Windows 10 Enterprise LTSC 2021
Windows 11 Pro
Windows Server 2022 SERVERDATACENTER
Windows 11 Enterprise LTSC 2024
Windows Server 2025 SERVERDATACENTER
```

Open [DISM++](https://github.com/Chuyu-Team/Dism-Multi-language/releases) File menu > Open Image File, select the iso to be installed to get the image name.
Open [DISM++](https://github.com/Chuyu-Team/Dism-Multi-language/releases) File menu > Open Image File, select the iso to be installed to get the image name (full system name), and all available image names are installable.

![image-name](https://github.com/bin456789/reinstall/assets/7548515/5aae0a9b-61e2-4f66-bb98-d470a6beaac2)

Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ certutil -urlcache -f -split https://jihulab.com/bin456789/reinstall/-/raw/main/
- 在虚拟机上,会自动安装合适的官方精简内核
- 安装 Red Hat 需填写 <https://access.redhat.com/downloads/content/rhel> 得到的 `qcow2` 镜像链接
- 用户名 `root` 密码 `123@@@`,可能首次开机几分钟后密码才生效
- 改为密钥登录时,还要修改 `/etc/ssh/sshd_config.d/` 里面的文件

```bash
bash reinstall.sh centos 9
Expand Down Expand Up @@ -218,14 +219,16 @@ bash reinstall.sh netboot.xyz
- 如果远程登录失败,尝试使用用户名 `.\administrator`
- 静态机器会自动配置好 IP,可能首次开机几分钟后才生效

![Windows 安装中](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7)

#### 方法 1: 让脚本自动查找 ISO

- 脚本会从 <https://massgrave.dev/genuine-installation-media.html> 查找 iso,该网站提供的 iso 都是官方原版
- 仅支持自动查找常规 Windows 和 Windows Server 版本

```bash
bash reinstall.sh windows \
--image-name 'Windows 10 Enterprise LTSC 2021' \
--image-name 'Windows 11 Enterprise LTSC 2024' \
--lang zh-cn
```

Expand Down Expand Up @@ -282,8 +285,8 @@ zh-tw

```bash
bash reinstall.sh windows \
--image-name 'Windows 10 Enterprise LTSC 2021' \
--iso 'https://drive.massgrave.dev/en-us_windows_10_enterprise_ltsc_2021_x64_dvd_d289cf96.iso'
--image-name 'Windows 11 Enterprise LTSC 2024' \
--iso 'https://drive.massgrave.dev/zh-cn_windows_11_enterprise_ltsc_2024_x64_dvd_cff9cd2d.iso'
```

> [!IMPORTANT]
Expand All @@ -308,20 +311,18 @@ bash reinstall.sh windows \

</details>

![Installing Windows](https://github.com/bin456789/reinstall/assets/7548515/07c1aea2-1ce3-4967-904f-aaf9d6eec3f7)

#### 参数说明

`--image-name` 指定要安装的映像,不区分大小写,常用映像有:

```text
Windows 7 Ultimate
Windows 10 Enterprise LTSC 2021
Windows 11 Pro
Windows Server 2022 SERVERDATACENTER
Windows 11 Enterprise LTSC 2024
Windows Server 2025 SERVERDATACENTER
```

打开 [DISM++](https://github.com/Chuyu-Team/Dism-Multi-language/releases) 文件菜单 > 打开映像文件,选择要安装的 iso,可以得到映像名称
打开 [DISM++](https://github.com/Chuyu-Team/Dism-Multi-language/releases) 文件菜单 > 打开映像文件,选择要安装的 iso,可以得到映像名称(系统全名),所有映像名称都可安装

![image-name](https://github.com/bin456789/reinstall/assets/7548515/5aae0a9b-61e2-4f66-bb98-d470a6beaac2)

Expand Down
16 changes: 14 additions & 2 deletions reinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,11 @@ get_windows_iso_links() {
case "$edition" in
home | 'home single language') echo consumer ;;
pro | education | enterprise | 'pro education' | 'pro for workstations') echo business ;;
# iot
'iot enterprise') echo 'iot enterprise' ;;
# iot ltsc
'iot enterprise ltsc 2019' | 'iot enterprise ltsc 2021') echo "$edition" ;;
# ltsc
'enterprise 2015 ltsb' | 'enterprise 2016 ltsb' | 'enterprise ltsc 2019') echo "$edition" ;;
'enterprise ltsc 2021')
# arm64 的 enterprise ltsc 2021 要下载 iot enterprise ltsc 2021 iso
Expand All @@ -663,16 +667,24 @@ get_windows_iso_links() {
x86 | x64) echo 'enterprise ltsc 2021' ;;
esac
;;
'iot enterprise ltsc 2019' | 'iot enterprise ltsc 2021') echo "$edition" ;;
esac
;;
11)
case "$edition" in
home | 'home single language') echo consumer ;;
pro | education | enterprise | 'pro education' | 'pro for workstations') echo business ;;
# iot
'iot enterprise' | 'iot enterprise subscription') echo 'iot enterprise' ;;
'enterprise ltsc 2024') echo 'enterprise ltsc 2024' ;;
# iot ltsc
'iot enterprise ltsc 2024' | 'iot enterprise ltsc 2024 subscription') echo 'iot enterprise ltsc 2024' ;;
# ltsc
'enterprise ltsc 2024')
# arm64 的 enterprise ltsc 2024 要下载 iot enterprise ltsc 2024 iso
case "$arch_win" in
arm64) echo 'iot enterprise ltsc 2024' ;;
x64) echo 'enterprise ltsc 2024' ;;
esac
;;
esac
;;
esac
Expand Down
3 changes: 2 additions & 1 deletion trans.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4074,7 +4074,8 @@ install_windows() {
# 挂载 boot.wim
info "mount boot.wim"
mkdir -p /wim
wimmountrw /os/boot.wim 2 /wim/
boot_index=$(get_selected_image_prop 'Boot Index')
wimmountrw /os/boot.wim "$boot_index" /wim/

cp_drivers() {
src=$1
Expand Down

0 comments on commit 4d260fb

Please sign in to comment.