mirror of
https://github.com/dockur/windows.git
synced 2025-10-27 03:15:49 +00:00
feat: Support ESD files
This commit is contained in:
parent
a2c50bd5c3
commit
bd8deccd7d
1 changed files with 44 additions and 23 deletions
|
|
@ -132,8 +132,13 @@ else
|
|||
|
||||
XML=""
|
||||
DETECTED=""
|
||||
LOC="$DIR/sources/install.wim"
|
||||
[ ! -f "$LOC" ] && LOC="$DIR/sources/install.esd"
|
||||
|
||||
if [ -f "$LOC" ]; then
|
||||
|
||||
TAG="DISPLAYNAME"
|
||||
RESULT=$(wimlib-imagex info -xml "$DIR/sources/install.wim" | tr -d '\000')
|
||||
RESULT=$(wimlib-imagex info -xml "$LOC" | tr -d '\000')
|
||||
NAME=$(sed -n "/$TAG/{s/.*<$TAG>\(.*\)<\/$TAG>.*/\1/;p}" <<< "$RESULT")
|
||||
|
||||
[[ "$NAME" == "Windows 11"* ]] && DETECTED="win11x64"
|
||||
|
|
@ -149,24 +154,31 @@ else
|
|||
echo "Detected image of type '$DETECTED', will apply unattended.xml file."
|
||||
|
||||
else
|
||||
|
||||
echo "Warning: failed to detect Windows version from '$NAME', falling back to manual installation!"
|
||||
|
||||
error "Warning: failed to detect Windows version from '$NAME', falling back to manual installation!"
|
||||
fi
|
||||
else
|
||||
error "Warning: failed to locate 'install.wim' or 'install.esd' in ISO image, falling back to manual installation!"
|
||||
fi
|
||||
|
||||
echo
|
||||
fi
|
||||
|
||||
if [[ "$MANUAL" != [Yy1]* ]]; then
|
||||
if [ -f "/run/assets/$XML" ]; then
|
||||
|
||||
wimlib-imagex update "$DIR/sources/boot.wim" 2 \
|
||||
--command "add /run/assets/$XML /autounattend.xml"
|
||||
echo
|
||||
LOC="$DIR/sources/boot.wim"
|
||||
[ ! -f "$LOC" ] && LOC="$DIR/sources/boot.esd"
|
||||
|
||||
if [ -f "$LOC" ]; then
|
||||
|
||||
wimlib-imagex update "$LOC" 2 --command "add /run/assets/$XML /autounattend.xml"
|
||||
|
||||
else
|
||||
[ -n "$XML" ] && info "Warning: XML file '$XML' does not exist, falling back to manual installation!" && echo
|
||||
error "Warning: failed to locate 'boot.wim' or 'boot.esd' in ISO image, falling back to manual installation!"
|
||||
fi
|
||||
else
|
||||
[ -n "$XML" ] && error "Warning: XML file '$XML' does not exist, falling back to manual installation!"
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
|
||||
LABEL="${BASE%.*}"
|
||||
|
|
@ -175,9 +187,18 @@ LABEL="${LABEL::32}"
|
|||
ISO="$TMP/$LABEL.tmp"
|
||||
rm -f "$ISO"
|
||||
|
||||
genisoimage -b boot/etfsboot.com -no-emul-boot -c BOOT.CAT -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames \
|
||||
-v -V "$LABEL" -udf -boot-info-table -eltorito-alt-boot -eltorito-boot efi/microsoft/boot/efisys_noprompt.bin \
|
||||
-no-emul-boot -o "$ISO" -allow-limited-size "$DIR"
|
||||
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
|
||||
[ -f "$DIR/$EFISYS" ] && EFISYS="efi/microsoft/boot/efisys.bin"
|
||||
|
||||
if [ -f "$DIR/$EFISYS" ]; then
|
||||
|
||||
genisoimage -b boot/etfsboot.com -no-emul-boot -c BOOT.CAT -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -v -V "$LABEL" \
|
||||
-udf -boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -o "$ISO" -allow-limited-size "$DIR"
|
||||
else
|
||||
|
||||
error "Failed to locate file 'efisys.bin' in ISO image!" && exit 64
|
||||
|
||||
fi
|
||||
|
||||
mv "$ISO" "$STORAGE/$BASE"
|
||||
rm -rf "$TMP"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue