mirror of
https://github.com/dockur/windows.git
synced 2025-10-27 03:15:49 +00:00
fix: Verify system files
This commit is contained in:
parent
0ee39f93bb
commit
6386cd82fd
1 changed files with 76 additions and 57 deletions
133
src/install.sh
133
src/install.sh
|
|
@ -122,6 +122,7 @@ rm -rf "$DIR"
|
||||||
7z x "$ISO" -o"$DIR"
|
7z x "$ISO" -o"$DIR"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
XML=""
|
||||||
FB="falling back to manual installation!"
|
FB="falling back to manual installation!"
|
||||||
|
|
||||||
if [[ "$EXTERNAL" != [Yy1]* ]]; then
|
if [[ "$EXTERNAL" != [Yy1]* ]]; then
|
||||||
|
|
@ -130,82 +131,100 @@ if [[ "$EXTERNAL" != [Yy1]* ]]; then
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
info "Detecting Windows version from ISO image..."
|
if [[ "$MANUAL" != [Yy1]* ]]; then
|
||||||
|
|
||||||
XML=""
|
info "Detecting Windows version from ISO image..."
|
||||||
DETECTED=""
|
|
||||||
LOC="$DIR/sources/install.wim"
|
|
||||||
[ ! -f "$LOC" ] && LOC="$DIR/sources/install.esd"
|
|
||||||
|
|
||||||
if [ -f "$LOC" ]; then
|
LOC="$DIR/sources/install.wim"
|
||||||
|
[ ! -f "$LOC" ] && LOC="$DIR/sources/install.esd"
|
||||||
TAG="DISPLAYNAME"
|
|
||||||
RESULT=$(wimlib-imagex info -xml "$LOC" | tr -d '\000')
|
|
||||||
NAME=$(sed -n "/$TAG/{s/.*<$TAG>\(.*\)<\/$TAG>.*/\1/;p}" <<< "$RESULT")
|
|
||||||
|
|
||||||
[[ "$NAME" == "Windows 11"* ]] && DETECTED="win11x64"
|
|
||||||
[[ "$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', $FB"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
error "Warning: failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
|
|
||||||
fi
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$MANUAL" != [Yy1]* ]]; then
|
|
||||||
if [ -f "/run/assets/$XML" ]; then
|
|
||||||
|
|
||||||
LOC="$DIR/sources/boot.wim"
|
|
||||||
[ ! -f "$LOC" ] && LOC="$DIR/sources/boot.esd"
|
|
||||||
|
|
||||||
if [ -f "$LOC" ]; then
|
if [ -f "$LOC" ]; then
|
||||||
|
|
||||||
wimlib-imagex update "$LOC" 2 --command "add /run/assets/$XML /autounattend.xml"
|
DETECTED=""
|
||||||
|
TAG="DISPLAYNAME"
|
||||||
|
RESULT=$(wimlib-imagex info -xml "$LOC" | tr -d '\000')
|
||||||
|
NAME=$(sed -n "/$TAG/{s/.*<$TAG>\(.*\)<\/$TAG>.*/\1/;p}" <<< "$RESULT")
|
||||||
|
|
||||||
|
[[ "$NAME" == "Windows 11"* ]] && DETECTED="win11x64"
|
||||||
|
[[ "$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 autounattend.xml file."
|
||||||
|
|
||||||
|
else
|
||||||
|
error "Warning: failed to detect Windows version from '$NAME', $FB"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
error "Warning: failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
|
error "Warning: failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
|
||||||
fi
|
fi
|
||||||
else
|
echo
|
||||||
[ -n "$XML" ] && error "Warning: XML file '$XML' does not exist, $FB"
|
|
||||||
fi
|
fi
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CAT="BOOT.CAT"
|
ASSET="/run/assets/$XML"
|
||||||
|
|
||||||
|
if [ -f "$ASSET" ]; then
|
||||||
|
|
||||||
|
LOC="$DIR/sources/boot.wim"
|
||||||
|
[ ! -f "$LOC" ] && LOC="$DIR/sources/boot.esd"
|
||||||
|
|
||||||
|
if [ -f "$LOC" ]; then
|
||||||
|
|
||||||
|
wimlib-imagex update "$LOC" 2 --command "add $ASSET /autounattend.xml"
|
||||||
|
|
||||||
|
else
|
||||||
|
error "Warning: failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
|
||||||
|
fi
|
||||||
|
|
||||||
|
LOC="$DIR/autounattend.xml"
|
||||||
|
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
|
||||||
|
LOC="$DIR/Autounattend.xml"
|
||||||
|
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
|
||||||
|
LOC="$DIR/AutoUnattend.xml"
|
||||||
|
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
|
||||||
|
LOC="$DIR/autounattend.XML"
|
||||||
|
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
|
||||||
|
LOC="$DIR/Autounattend.XML"
|
||||||
|
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
|
||||||
|
LOC="$DIR/AutoUnattend.XML"
|
||||||
|
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
|
||||||
|
LOC="$DIR/AUTOUNATTEND.xml"
|
||||||
|
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
|
||||||
|
LOC="$DIR/AUTOUNATTEND.XML"
|
||||||
|
[ -f "$LOC" ] && mv -f "$ASSET" "$LOC"
|
||||||
|
|
||||||
|
echo
|
||||||
|
|
||||||
|
else
|
||||||
|
[ -n "$XML" ] && error "Warning: XML file '$XML' does not exist, $FB" && echo
|
||||||
|
fi
|
||||||
|
|
||||||
ETFS="boot/etfsboot.com"
|
ETFS="boot/etfsboot.com"
|
||||||
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
|
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
|
||||||
|
|
||||||
if [ -f "$DIR/$CAT" ]; then
|
if [ -f "$DIR/$ETFS" ]; then
|
||||||
if [ -f "$DIR/$ETFS" ]; then
|
if [ -f "$DIR/$EFISYS" ]; then
|
||||||
if [ -f "$DIR/$EFISYS" ]; then
|
|
||||||
|
|
||||||
LABEL="${BASE%.*}"
|
CAT="BOOT.CAT"
|
||||||
LABEL="${LABEL::32}"
|
LABEL="${BASE%.*}"
|
||||||
ISO="$TMP/$LABEL.tmp"
|
LABEL="${LABEL::32}"
|
||||||
rm -f "$ISO"
|
ISO="$TMP/$LABEL.tmp"
|
||||||
|
rm -f "$ISO"
|
||||||
|
|
||||||
|
genisoimage -b "$ETFS" -no-emul-boot -c "$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"
|
||||||
|
|
||||||
genisoimage -b "$ETFS" -no-emul-boot -c "$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 '"$(basename "$EFISYS")"' in ISO image, $FB"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
error "Failed to locate file '"$(basename "$ETFS")"' in ISO image, $FB"
|
error "Failed to locate file '"$(basename "$EFISYS")"' in ISO image, $FB"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
error "Failed to locate file '"$(basename "$CAT")"' in ISO image, $FB"
|
error "Failed to locate file '"$(basename "$ETFS")"' in ISO image, $FB"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv "$ISO" "$STORAGE/$BASE"
|
mv "$ISO" "$STORAGE/$BASE"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue