diff --git a/README.en.md b/README.en.md
index e6c9503..535dd68 100644
--- a/README.en.md
+++ b/README.en.md
@@ -31,25 +31,25 @@ The original system can be any system listed in the table.
The system requirements for the target system are as follows:
-| Target System | Version | Memory | Disk |
-| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | ---------------------- |
-|
Alpine | 3.18, 3.19, 3.20, 3.21 | 256 MB | 1 GB |
-|
Debian | 9, 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ |
-|
Kali | Rolling | 256 MB | 1 ~ 1.5 GB ^ |
-|
Ubuntu | 16.04 - 24.04, 24.10 | 512 MB \* | 2 GB |
-|
Anolis | 7, 8, 23 | 512 MB \* | 5 GB |
-|
RHEL
AlmaLinux
Rocky
Oracle | 8, 9 | 512 MB \* | 5 GB |
-|
OpenCloudOS | 8, 9, Stream 23 | 512 MB \* | 5 GB |
-|
CentOS | 9, 10 | 512 MB \* | 5 GB |
-|
Fedora | 40, 41 | 512 MB \* | 5 GB |
-|
openEuler | 20.03 - 24.03, 24.09 | 512 MB \* | 5 GB |
-|
openSUSE | 15.6, Tumbleweed (Rolling) | 512 MB \* | 5 GB |
-|
NixOS | 24.11 | 512 MB | 5 GB |
-|
Arch | Rolling | 512 MB | 5 GB |
-|
Gentoo | Rolling | 512 MB | 5 GB |
-|
Windows (DD) | Any | 512 MB | Depending on the image |
-|
Windows (ISO) | Vista, 7, 8.x (Server 2008 - 2012 R2) | 512 MB | 25 GB |
-|
Windows (ISO) | 10, 11 (Server 2016 - 2025) | 1 GB | 25 GB |
+| Target System | Version | Memory | Disk |
+| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- | --------- | -----------------|
+|
Alpine | 3.18, 3.19, 3.20, 3.21 | 256 MB | 1 GB |
+|
Debian | 9, 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ |
+|
Kali | Rolling | 256 MB | 1 ~ 1.5 GB ^ |
+|
Ubuntu | 16.04 LTS - 24.04 LTS, 24.10 | 512 MB \* | 2 GB |
+|
Anolis | 7, 8, 23 | 512 MB \* | 5 GB |
+|
RHEL
AlmaLinux
Rocky
Oracle | 8, 9 | 512 MB \* | 5 GB |
+|
OpenCloudOS | 8, 9, Stream 23 | 512 MB \* | 5 GB |
+|
CentOS | 9, 10 | 512 MB \* | 5 GB |
+|
Fedora | 40, 41 | 512 MB \* | 5 GB |
+|
openEuler | 20.03 LTS - 24.03 LTS, 24.09 | 512 MB \* | 5 GB |
+|
openSUSE | 15.6, Tumbleweed (Rolling) | 512 MB \* | 5 GB |
+|
NixOS | 24.11 | 512 MB | 5 GB |
+|
Arch | Rolling | 512 MB | 5 GB |
+|
Gentoo | Rolling | 512 MB | 5 GB |
+|
Windows (DD) | Any | 512 MB | Depends on image |
+|
Windows (ISO) | Vista, 7, 8.x (Server 2008 - 2012 R2) | 512 MB | 25 GB |
+|
Windows (ISO) | 10, 11 (Server 2016 - 2025) | 1 GB | 25 GB |
\* Indicates installation using cloud images, not traditional network installation.
@@ -259,8 +259,7 @@ bash reinstall.sh netboot.xyz
> [!CAUTION]
> The ISO repository currently prohibits direct link downloads, so this method is no longer effective.
-- Typically, Windows releases new official ISOs every month, which integrate the latest system patches, avoiding the need to download a bunch of updates right after installation.
-- The script will search for ISOs from , a site that collects monthly released ISOs, ensuring that the ISOs found by the script are the official latest versions.
+- The script will search for ISOs from , a site that collects official ISOs.
- Systems marked with \* do not support automatic ISO searching.
```bash
@@ -323,39 +322,56 @@ zh-tw
```bash
bash reinstall.sh windows \
--image-name 'Windows 11 Enterprise LTSC 2024' \
- --iso 'https://drive.massgrave.dev/zh-cn_windows_11_enterprise_ltsc_2024_x64_dvd_cff9cd2d.iso'
+ --iso 'https://go.microsoft.com/fwlink/?linkid=2289029'
```
The following website provides ISO links.
-- (Recommended, iso sourced from official channels, updated monthly, includes the latest patches)
-- (Need to open it with a non-Windows User-Agent)
--
--
-- (Preview)
-- (Preview)
--
--
--
--
--
--
--
--
+- General
+ -
+ -
+ - (Need to open it with a non-Windows User-Agent)
+ -
+ -
+- Evaluation
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+- Insider Preview
+ -
+ -
#### Optional parameters
- `--password PASSWORD` Set Password
-- `--allow-ping` Allow ping responses
+- `--allow-ping` Configures the Windows firewall to allow ping requests
- `--rdp-port PORT` Change RDP port
- `--ssh-port PORT` Change SSH port (for log observation during installation)
- `--web-port PORT` Change Web port (for log observation during installation)
+- `--add-driver-dir DIR` Adds an additional driver folder, specifying the folder where the .inf file is located.
+ - The driver must be downloaded locally first.
+ - This parameter can be set multiple times to add different driver folders.
+ - The script will copy the entire folder, so no other files should be placed inside the folder.
- `--hold 2` Allow SSH connections for modifying the disk content before rebooting into the official Windows installation program, with the disk mounted at `/os`.
+#### The script will automatic download and install the following drivers as needed, without the need for manual addition
+
+- Virtio ([Virtio](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/), [Alibaba Cloud](https://www.alibabacloud.com/help/ecs/user-guide/update-red-hat-virtio-drivers-of-windows-instances))
+- XEN ([XEN](https://xenproject.org/resources/downloads/), [Citrix](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Upgrading_PV_drivers.html#win2008-citrix-upgrade), [AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/xen-drivers-overview.html))
+- AWS ([ENA Network Adapter](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ena-driver-releases-windows.html), [NVMe Storage Controller](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-driver-version-history.html))
+- GCP ([gVNIC Network Adapter](https://cloud.google.com/compute/docs/networking/using-gvnic), [GGA Display Adapter](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display))
+- Azure ([MANA Network Adapter](https://learn.microsoft.com/azure/virtual-network/accelerated-networking-mana-windows))
+- Intel ([VMD Storage Controller](https://www.intel.com/content/www/us/en/download/720755/intel-rapid-storage-technology-driver-installation-software-with-intel-optane-memory-11th-up-to-13th-gen-platforms.html))
+
#### How to Specify the Image Name `--image-name`
Typically, an ISO will contain multiple system versions, such as Home Edition and Professional Edition. The image name `--image-name` is used to specify the version to be installed, and it is case-insensitive when entered.
@@ -377,15 +393,6 @@ Open File menu > Open Image File, select the iso to be installed to get the imag

-#### The script will install the following drivers as needed
-
-- Virtio ([Virtio](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/), [Alibaba Cloud](https://www.alibabacloud.com/help/ecs/user-guide/update-red-hat-virtio-drivers-of-windows-instances))
-- XEN ([XEN](https://xenproject.org/resources/downloads/), [Citrix](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Upgrading_PV_drivers.html#win2008-citrix-upgrade), [AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/xen-drivers-overview.html))
-- AWS ([ENA Network Adapter](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ena-driver-releases-windows.html), [NVMe Storage Controller](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-driver-version-history.html))
-- GCP ([gVNIC Network Adapter](https://cloud.google.com/compute/docs/networking/using-gvnic), [GGA Display Adapter](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display))
-- Azure ([MANA Network Adapter](https://learn.microsoft.com/azure/virtual-network/accelerated-networking-mana-windows))
-- Intel ([VMD Storage Controller](https://www.intel.com/content/www/us/en/download/720755/intel-rapid-storage-technology-driver-installation-software-with-intel-optane-memory-11th-up-to-13th-gen-platforms.html))
-
> [!WARNING]
> Vista (Server 2008) and 32-bit systems may lack drivers.
diff --git a/README.md b/README.md
index fe48523..d99a331 100644
--- a/README.md
+++ b/README.md
@@ -36,13 +36,13 @@
|
Alpine | 3.18, 3.19, 3.20, 3.21 | 256 MB | 1 GB |
|
Debian | 9, 10, 11, 12 | 256 MB | 1 ~ 1.5 GB ^ |
|
Kali | 滚动 | 256 MB | 1 ~ 1.5 GB ^ |
-|
Ubuntu | 16.04 - 24.04, 24.10 | 512 MB \* | 2 GB |
+|
Ubuntu | 16.04 LTS - 24.04 LTS, 24.10 | 512 MB \* | 2 GB |
|
Anolis | 7, 8, 23 | 512 MB \* | 5 GB |
|
RHEL
AlmaLinux
Rocky
Oracle | 8, 9 | 512 MB \* | 5 GB |
|
OpenCloudOS | 8, 9, Stream 23 | 512 MB \* | 5 GB |
|
CentOS | 9, 10 | 512 MB \* | 5 GB |
|
Fedora | 40, 41 | 512 MB \* | 5 GB |
-|
openEuler | 20.03 - 24.03, 24.09 | 512 MB \* | 5 GB |
+|
openEuler | 20.03 LTS - 24.03 LTS, 24.09 | 512 MB \* | 5 GB |
|
openSUSE | 15.6, Tumbleweed (滚动) | 512 MB \* | 5 GB |
|
NixOS | 24.11 | 512 MB | 5 GB |
|
Arch | 滚动 | 512 MB | 5 GB |
@@ -259,8 +259,7 @@ bash reinstall.sh netboot.xyz
> [!CAUTION]
> 目前该 ISO 仓库禁止了直链下载,因此该方法已失效
-- 通常情况下 Windows 每个月都会发布新的官方 ISO,集成了最新的系统补丁,避免了刚安装好系统就要下载一堆补丁
-- 脚本会从 查找 ISO,该网站收录了每月发布的 ISO,因此脚本查找到的 ISO 都是官方最新版
+- 脚本会从 查找 ISO,该网站专门提供官方 ISO 下载
- 上面带 \* 的系统不支持自动查找 ISO
```bash
@@ -323,39 +322,56 @@ zh-tw
```bash
bash reinstall.sh windows \
--image-name 'Windows 11 Enterprise LTSC 2024' \
- --iso 'https://drive.massgrave.dev/zh-cn_windows_11_enterprise_ltsc_2024_x64_dvd_cff9cd2d.iso'
+ --iso 'https://go.microsoft.com/fwlink/?linkid=2289029'
```
以下网站可找到 ISO 链接
-- (推荐,iso 来自官方,每月更新,包含最新补丁)
-- (需用非 Windows User-Agent 打开)
--
--
-- (预览版)
-- (预览版)
--
--
--
--
--
--
--
--
+- 正式版
+ -
+ -
+ - (需用非 Windows User-Agent 打开)
+ -
+ -
+- 评估版
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+ -
+- Insider 预览版
+ -
+ -
#### 可选参数
- `--password PASSWORD` 设置密码
-- `--allow-ping` 允许被 Ping
+- `--allow-ping` 设置 Windows 防火墙允许被 Ping
- `--rdp-port PORT` 更改 RDP 端口
- `--ssh-port PORT` 修改 SSH 端口(安装期间观察日志用)
- `--web-port PORT` 修改 Web 端口(安装期间观察日志用)
+- `--add-driver-dir DIR` 添加额外驱动文件夹,填写 .inf 所在的文件夹
+ - 需先下载驱动到本地
+ - 可多次设置该参数以添加不同的驱动文件夹
+ - 脚本将复制整个文件夹,因此文件夹内不要放置其他文件
- `--hold 2` 在进入 Windows 官方安装程序之前,可以 SSH 登录修改硬盘内容,硬盘挂载在 `/os`
+#### 脚本会自动按需下载安装以下驱动,无需手动添加
+
+- Virtio ([Virtio](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/)、[阿里云](https://www.alibabacloud.com/help/ecs/user-guide/update-red-hat-virtio-drivers-of-windows-instances))
+- XEN ([XEN](https://xenproject.org/resources/downloads/)、[Citrix](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Upgrading_PV_drivers.html#win2008-citrix-upgrade)、[AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/xen-drivers-overview.html))
+- AWS ([ENA 网卡](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ena-driver-releases-windows.html)、[NVME 存储控制器](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-driver-version-history.html))
+- GCP ([gVNIC 网卡](https://cloud.google.com/compute/docs/networking/using-gvnic)、[GGA 显卡](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display))
+- Azure ([MANA 网卡](https://learn.microsoft.com/azure/virtual-network/accelerated-networking-mana-windows))
+- Intel ([VMD 存储控制器](https://www.intel.com/content/www/us/en/download/720755/intel-rapid-storage-technology-driver-installation-software-with-intel-optane-memory-11th-up-to-13th-gen-platforms.html))
+
#### 如何填写映像名称 `--image-name`
通常一个 ISO 会包含多个系统版本,例如家庭版、专业版。映像名称 `--image-name` 就是用来指定要安装的版本,填写时不区分大小写
@@ -377,15 +393,6 @@ Windows Server 2025 SERVERDATACENTER

-#### 脚本会按需安装以下驱动
-
-- Virtio ([Virtio](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/)、[阿里云](https://www.alibabacloud.com/help/ecs/user-guide/update-red-hat-virtio-drivers-of-windows-instances))
-- XEN ([XEN](https://xenproject.org/resources/downloads/)、[Citrix](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Upgrading_PV_drivers.html#win2008-citrix-upgrade)、[AWS](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/xen-drivers-overview.html))
-- AWS ([ENA 网卡](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ena-driver-releases-windows.html)、[NVME 存储控制器](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-driver-version-history.html))
-- GCP ([gVNIC 网卡](https://cloud.google.com/compute/docs/networking/using-gvnic)、[GGA 显卡](https://cloud.google.com/compute/docs/instances/enable-instance-virtual-display))
-- Azure ([MANA 网卡](https://learn.microsoft.com/azure/virtual-network/accelerated-networking-mana-windows))
-- Intel ([VMD 存储控制器](https://www.intel.com/content/www/us/en/download/720755/intel-rapid-storage-technology-driver-installation-software-with-intel-optane-memory-11th-up-to-13th-gen-platforms.html))
-
> [!WARNING]
> Vista (Server 2008) 和 32 位系统可能会缺少驱动
diff --git a/reinstall.sh b/reinstall.sh
index 219bc17..008cd17 100644
--- a/reinstall.sh
+++ b/reinstall.sh
@@ -3330,8 +3330,13 @@ EOF
chmod a+x \$sysroot/etc/local.d/trans.start
ln -s /etc/init.d/local \$sysroot/etc/runlevels/default/
- # 配置文件夹
- cp -r /configs \$sysroot/configs
+ # 配置 + 自定义驱动
+ for dir in /configs /custom_drivers; do
+ if [ -d \$dir ]; then
+ cp -r \$dir \$sysroot/
+ rm -rf \$dir
+ fi
+ done
EOF
# 判断云镜像 debain 能否用云内核
@@ -3389,6 +3394,19 @@ This script is outdated, please download reinstall.sh again.
mod_initrd_$nextos_distro
fi
+ # 添加自定义 windows 驱动
+ if [ "$distro" = windows ]; then
+ mkdir -p $initrd_dir/custom_drivers
+ i=0
+ while IFS= read -r dir; do
+ if [ -d "$dir" ]; then
+ ((i += 1))
+ info "add custom driver: $dir"
+ cp -r "$dir" "$initrd_dir/custom_drivers/$i"
+ fi
+ done < <(echo "$custom_driver_dirs")
+ fi
+
# alpine live 不精简 initrd
# 因为不知道用户想干什么,可能会用到精简的文件
if is_virt && ! is_alpine_live; then
@@ -3406,6 +3424,8 @@ This script is outdated, please download reinstall.sh again.
}
remove_useless_initrd_files() {
+ info "slim initrd"
+
# 显示精简前的大小
du -sh .
@@ -3510,6 +3530,7 @@ fi
long_opts=
for o in ci installer debug minimal allow-ping force-cn \
+ add-driver-dir: \
hold: sleep: \
iso: \
image-name: \
@@ -3602,6 +3623,28 @@ while true; do
web_port=$2
shift 2
;;
+ --add-driver-dir)
+ # 指定 dir 而不是指定 inf
+ # 防止用户将 inf 放在 / 而复制整个 /
+
+ # 路径转换
+ if is_in_windows; then
+ # 输入的路径是 / 开头也没问题
+ dir="$(cygpath -u "$2")"
+ else
+ dir=$2
+ fi
+
+ # 防止重复添加
+ if ! grep -Fqx "$dir" <<<"$custom_driver_dirs"; then
+ # shellcheck disable=SC2010
+ { [ -d "$dir" ] && ls "$dir" | grep -Eiq '\.inf$'; } || error_and_exit "Invalid Driver Directory: $2"
+ # 一行一个驱动文件夹
+ custom_driver_dirs+="$dir
+"
+ fi
+ shift 2
+ ;;
--force-old-windows-setup)
force_old_windows_setup=$2
shift 2
diff --git a/trans.sh b/trans.sh
index 5ff0508..d369de3 100644
--- a/trans.sh
+++ b/trans.sh
@@ -4851,8 +4851,7 @@ install_windows() {
info "Add drivers"
drv=/os/drivers
- mkdir -p "$drv" # 驱动下载临时文件夹
- mkdir -p "/wim/drivers" # boot.wim 驱动文件夹
+ mkdir -p "$drv" # 驱动下载临时文件夹
# 这里有坑
# $(get_cloud_vendor) 调用了 cache_dmi_and_virt
@@ -4912,6 +4911,9 @@ install_windows() {
add_driver_gcp
;;
esac
+
+ # 自定义驱动
+ add_driver_custom
}
# aws nitro
@@ -5273,6 +5275,23 @@ install_windows() {
cp_drivers $drv/vmd
}
+ # 脚本自动检测驱动可能有问题
+ # 假设是 win7 时代的网卡,官网没有 win10 驱动,系统也不自带
+ # 但实际上 win10 可以用 win7 的驱动
+ # 这种情况即使脚本自动下载 win10 的驱动包,也不会包含这个驱动
+ # 应该下载 win7 的驱动
+ # 因此只能交给用户自己添加驱动
+
+ add_driver_custom() {
+ for dir in /custom_drivers/*; do
+ if [ -d "$dir" ]; then
+ info "Add custom drivers: $dir"
+ cp_drivers custom "$dir"
+ # 复制后不删除,因为脚本可能再次运行
+ fi
+ done
+ }
+
# 修改应答文件
download $confhome/windows.xml /tmp/autounattend.xml
locale=$(get_selected_image_prop 'Default Language')
@@ -5327,6 +5346,14 @@ install_windows() {
wimmountrw /os/boot.wim "$boot_index" /wim/
cp_drivers() {
+ if [ "$1" = custom ]; then
+ shift
+ dst="/wim/custom_drivers/$(basename "$1")"
+ else
+ dst=/wim/drivers
+ fi
+ mkdir -p "$dst"
+
src=$1
shift
@@ -5335,7 +5362,7 @@ install_windows() {
-not -iname "*.pdb" \
-not -iname "dpinst.exe" \
"$@" \
- -exec cp -rfv {} /wim/drivers \;
+ -exec cp -rfv {} "$dst" \;
}
# 添加驱动
diff --git a/windows-setup.bat b/windows-setup.bat
index 7478476..e02c201 100644
--- a/windows-setup.bat
+++ b/windows-setup.bat
@@ -23,10 +23,15 @@ call powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 2>nul
rem 安装 SCSI 驱动
for %%F in ("X:\drivers\*.inf") do (
- rem 不要查找 Class=SCSIAdapter 因为有些驱动等号两边有空格
- find /i "SCSIAdapter" "%%~F" >nul
- if not errorlevel 1 (
- drvload "%%~F"
+ call :drvload_if_scsi "%%~F"
+)
+
+rem 安装自定义 SCSI 驱动
+rem 可以用 forfiles /p X:\custom_drivers /m *.inf /c "cmd /c echo @path"
+rem 不可以用 for %%F in ("X:\custom_drivers\*\*.inf")
+if exist X:\custom_drivers\ (
+ for /f "delims=" %%F in ('dir /s /b "X:\custom_drivers\*.inf"') do (
+ call :drvload_if_scsi "%%~F"
)
)
@@ -154,6 +159,7 @@ set EnableUnattended=1
rem 运行 ramdisk X:\setup.exe 的话
rem vista 会找不到安装源
rem server 23h2 会无法运行
+rem 使用 /installfrom 可以解决?
if "%ForceOldSetup%"=="1" (
set setup=Y:\sources\setup.exe
) else (
@@ -214,3 +220,11 @@ exit /b
:createPageFileOnZ
wpeutil CreatePageFile /path=Z:\pagefile.sys /size=512
exit /b
+
+:drvload_if_scsi
+rem 不要查找 Class=SCSIAdapter 因为有些驱动等号两边有空格
+find /i "SCSIAdapter" "%~1" >nul
+if not errorlevel 1 (
+ drvload "%~1"
+)
+exit /b
diff --git a/windows.xml b/windows.xml
index 6ea0e84..cfc2754 100644
--- a/windows.xml
+++ b/windows.xml
@@ -49,9 +49,14 @@
+
+
X:\drivers
+
+ X:\custom_drivers
+