mirror of
https://github.com/dockur/windows.git
synced 2025-10-27 11:25: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,41 +132,53 @@ else
|
||||||
|
|
||||||
XML=""
|
XML=""
|
||||||
DETECTED=""
|
DETECTED=""
|
||||||
TAG="DISPLAYNAME"
|
LOC="$DIR/sources/install.wim"
|
||||||
RESULT=$(wimlib-imagex info -xml "$DIR/sources/install.wim" | tr -d '\000')
|
[ ! -f "$LOC" ] && LOC="$DIR/sources/install.esd"
|
||||||
NAME=$(sed -n "/$TAG/{s/.*<$TAG>\(.*\)<\/$TAG>.*/\1/;p}" <<< "$RESULT")
|
|
||||||
|
|
||||||
[[ "$NAME" == "Windows 11"* ]] && DETECTED="win11x64"
|
if [ -f "$LOC" ]; then
|
||||||
[[ "$NAME" == "Windows 10"* ]] && DETECTED="win10x64"
|
|
||||||
[[ "$NAME" == "Windows 8"* ]] && DETECTED="win81x64"
|
|
||||||
[[ "$NAME" == "Windows Server 2022"* ]] && DETECTED="win2022-eval"
|
|
||||||
[[ "$NAME" == "Windows Server 2019"* ]] && DETECTED="win2019-eval"
|
|
||||||
[[ "$NAME" == "Windows Server 2016"* ]] && DETECTED="win2016-eval"
|
|
||||||
|
|
||||||
if [ -n "$DETECTED" ]; then
|
TAG="DISPLAYNAME"
|
||||||
|
RESULT=$(wimlib-imagex info -xml "$LOC" | tr -d '\000')
|
||||||
|
NAME=$(sed -n "/$TAG/{s/.*<$TAG>\(.*\)<\/$TAG>.*/\1/;p}" <<< "$RESULT")
|
||||||
|
|
||||||
XML="$DETECTED.xml"
|
[[ "$NAME" == "Windows 11"* ]] && DETECTED="win11x64"
|
||||||
echo "Detected image of type '$DETECTED', will apply unattended.xml file."
|
[[ "$NAME" == "Windows 10"* ]] && DETECTED="win10x64"
|
||||||
|
[[ "$NAME" == "Windows 8"* ]] && DETECTED="win81x64"
|
||||||
|
[[ "$NAME" == "Windows Server 2022"* ]] && DETECTED="win2022-eval"
|
||||||
|
[[ "$NAME" == "Windows Server 2019"* ]] && DETECTED="win2019-eval"
|
||||||
|
[[ "$NAME" == "Windows Server 2016"* ]] && DETECTED="win2016-eval"
|
||||||
|
|
||||||
|
if [ -n "$DETECTED" ]; then
|
||||||
|
|
||||||
|
XML="$DETECTED.xml"
|
||||||
|
echo "Detected image of type '$DETECTED', will apply unattended.xml file."
|
||||||
|
|
||||||
|
else
|
||||||
|
error "Warning: failed to detect Windows version from '$NAME', falling back to manual installation!"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
|
error "Warning: failed to locate 'install.wim' or 'install.esd' in ISO image, falling back to manual installation!"
|
||||||
echo "Warning: failed to detect Windows version from '$NAME', falling back to manual installation!"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$MANUAL" != [Yy1]* ]]; then
|
if [[ "$MANUAL" != [Yy1]* ]]; then
|
||||||
if [ -f "/run/assets/$XML" ]; then
|
if [ -f "/run/assets/$XML" ]; then
|
||||||
|
|
||||||
wimlib-imagex update "$DIR/sources/boot.wim" 2 \
|
LOC="$DIR/sources/boot.wim"
|
||||||
--command "add /run/assets/$XML /autounattend.xml"
|
[ ! -f "$LOC" ] && LOC="$DIR/sources/boot.esd"
|
||||||
echo
|
|
||||||
|
|
||||||
|
if [ -f "$LOC" ]; then
|
||||||
|
|
||||||
|
wimlib-imagex update "$LOC" 2 --command "add /run/assets/$XML /autounattend.xml"
|
||||||
|
|
||||||
|
else
|
||||||
|
error "Warning: failed to locate 'boot.wim' or 'boot.esd' in ISO image, falling back to manual installation!"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
[ -n "$XML" ] && info "Warning: XML file '$XML' does not exist, falling back to manual installation!" && echo
|
[ -n "$XML" ] && error "Warning: XML file '$XML' does not exist, falling back to manual installation!"
|
||||||
fi
|
fi
|
||||||
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LABEL="${BASE%.*}"
|
LABEL="${BASE%.*}"
|
||||||
|
|
@ -175,9 +187,18 @@ LABEL="${LABEL::32}"
|
||||||
ISO="$TMP/$LABEL.tmp"
|
ISO="$TMP/$LABEL.tmp"
|
||||||
rm -f "$ISO"
|
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 \
|
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
|
||||||
-v -V "$LABEL" -udf -boot-info-table -eltorito-alt-boot -eltorito-boot efi/microsoft/boot/efisys_noprompt.bin \
|
[ -f "$DIR/$EFISYS" ] && EFISYS="efi/microsoft/boot/efisys.bin"
|
||||||
-no-emul-boot -o "$ISO" -allow-limited-size "$DIR"
|
|
||||||
|
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"
|
mv "$ISO" "$STORAGE/$BASE"
|
||||||
rm -rf "$TMP"
|
rm -rf "$TMP"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue