windows: 支持 install.esd

fixes: #196
This commit is contained in:
bin456789 2024-11-07 22:56:51 +08:00
parent 5e9cc84a9e
commit 7ab1c45427
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -4059,10 +4059,11 @@ install_windows() {
if [ -e /iso/sources/install.esd ]; then if [ -e /iso/sources/install.esd ]; then
iso_install_wim=/iso/sources/install.esd iso_install_wim=/iso/sources/install.esd
install_wim=/os/installer/sources/install.esd
else else
iso_install_wim=/iso/sources/install.wim iso_install_wim=/iso/sources/install.wim
fi
install_wim=/os/installer/sources/install.wim install_wim=/os/installer/sources/install.wim
fi
# 匹配映像版本 # 匹配映像版本
# 需要整行匹配,因为要区分 Windows 10 Pro 和 Windows 10 Pro for Workstations # 需要整行匹配,因为要区分 Windows 10 Pro 和 Windows 10 Pro for Workstations
@ -4171,6 +4172,7 @@ install_windows() {
rsync -rv \ rsync -rv \
--exclude=/sources/boot.wim \ --exclude=/sources/boot.wim \
--exclude=/sources/install.wim \ --exclude=/sources/install.wim \
--exclude=/sources/install.esd \
/iso/* /os/installer/ /iso/* /os/installer/
else else
( (
@ -4178,19 +4180,21 @@ install_windows() {
find . -type f \ find . -type f \
-not -name boot.wim \ -not -name boot.wim \
-not -name install.wim \ -not -name install.wim \
-not -name install.esd \
-exec cp -r --parents {} /os/installer/ \; -exec cp -r --parents {} /os/installer/ \;
) )
fi fi
# 优化 install.wim # 优化 install.wim
# 优点1: 可以节省 200M~600M 空间,用来创建虚拟内存 # 优点: 可以节省 200M~600M 空间,用来创建虚拟内存
# (意义不大,因为已经删除了 boot.wim 用来创建虚拟内存) # (意义不大,因为已经删除了 boot.wim 用来创建虚拟内存vista 除外)
# 优点2: 可以将 esd 转为 wim但要提前预留更多空间
# 缺点: 如果 install.wim 只有一个镜像,则只能缩小 10M+ # 缺点: 如果 install.wim 只有一个镜像,则只能缩小 10M+
if false; then if true; then
time wimexport --threads "$(get_build_threads 512)" "$iso_install_wim" "$image_name" "$install_wim" time wimexport --threads "$(get_build_threads 512)" "$iso_install_wim" "$image_name" "$install_wim"
info "install.wim size"
echo "Original: $(get_filesize_mb "$iso_install_wim")" echo "Original: $(get_filesize_mb "$iso_install_wim")"
echo "Optimized: $(get_filesize_mb "$install_wim")" echo "Optimized: $(get_filesize_mb "$install_wim")"
echo
else else
cp "$iso_install_wim" "$install_wim" cp "$iso_install_wim" "$install_wim"
fi fi
@ -4763,10 +4767,11 @@ install_windows() {
images=all images=all
fi fi
wimexport --boot /os/boot.wim "$images" $boot_dir/sources/boot.wim wimexport --boot /os/boot.wim "$images" $boot_dir/sources/boot.wim
echo "boot.wim size:" info "boot.wim size"
echo "Original: $(get_filesize_mb /iso/sources/boot.wim)" echo "Original: $(get_filesize_mb /iso/sources/boot.wim)"
echo "Added Drivers: $(get_filesize_mb /os/boot.wim)" echo "Added Drivers: $(get_filesize_mb /os/boot.wim)"
echo "Optimized: $(get_filesize_mb "$boot_dir/sources/boot.wim")" echo "Optimized: $(get_filesize_mb "$boot_dir/sources/boot.wim")"
echo
# vista 安装时需要 boot.wim原因见上面 # vista 安装时需要 boot.wim原因见上面
if [ "$nt_ver" = 6.0 ] && if [ "$nt_ver" = 6.0 ] &&
@ -4777,8 +4782,7 @@ install_windows() {
# windows 7 没有 invoke-webrequest # windows 7 没有 invoke-webrequest
# installer分区盘符不一定是D盘 # installer分区盘符不一定是D盘
# 所以复制 resize.bat 到 install.wim # 所以复制 resize.bat 到 install.wim
# TODO: 由于esd文件无法修改要将resize.bat放到boot.wim if true; then
if [[ "$install_wim" = '*.wim' ]]; then
info "mount install.wim" info "mount install.wim"
wimmountrw $install_wim "$image_name" /wim/ wimmountrw $install_wim "$image_name" /wim/
if false; then if false; then