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
|
|
@ -122,6 +122,7 @@ rm -rf "$DIR"
|
|||
7z x "$ISO" -o"$DIR"
|
||||
echo
|
||||
|
||||
XML=""
|
||||
FB="falling back to manual installation!"
|
||||
|
||||
if [[ "$EXTERNAL" != [Yy1]* ]]; then
|
||||
|
|
@ -130,15 +131,16 @@ if [[ "$EXTERNAL" != [Yy1]* ]]; then
|
|||
|
||||
else
|
||||
|
||||
if [[ "$MANUAL" != [Yy1]* ]]; then
|
||||
|
||||
info "Detecting Windows version from ISO image..."
|
||||
|
||||
XML=""
|
||||
DETECTED=""
|
||||
LOC="$DIR/sources/install.wim"
|
||||
[ ! -f "$LOC" ] && LOC="$DIR/sources/install.esd"
|
||||
|
||||
if [ -f "$LOC" ]; then
|
||||
|
||||
DETECTED=""
|
||||
TAG="DISPLAYNAME"
|
||||
RESULT=$(wimlib-imagex info -xml "$LOC" | tr -d '\000')
|
||||
NAME=$(sed -n "/$TAG/{s/.*<$TAG>\(.*\)<\/$TAG>.*/\1/;p}" <<< "$RESULT")
|
||||
|
|
@ -153,7 +155,7 @@ else
|
|||
if [ -n "$DETECTED" ]; then
|
||||
|
||||
XML="$DETECTED.xml"
|
||||
echo "Detected image of type '$DETECTED', will apply unattended.xml file."
|
||||
echo "Detected image of type '$DETECTED', will apply autounattend.xml file."
|
||||
|
||||
else
|
||||
error "Warning: failed to detect Windows version from '$NAME', $FB"
|
||||
|
|
@ -162,35 +164,54 @@ else
|
|||
error "Warning: failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$MANUAL" != [Yy1]* ]]; then
|
||||
if [ -f "/run/assets/$XML" ]; then
|
||||
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 /run/assets/$XML /autounattend.xml"
|
||||
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
|
||||
else
|
||||
[ -n "$XML" ] && error "Warning: XML file '$XML' does not exist, $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
|
||||
|
||||
CAT="BOOT.CAT"
|
||||
ETFS="boot/etfsboot.com"
|
||||
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
|
||||
|
||||
CAT="BOOT.CAT"
|
||||
LABEL="${BASE%.*}"
|
||||
LABEL="${LABEL::32}"
|
||||
ISO="$TMP/$LABEL.tmp"
|
||||
|
|
@ -198,14 +219,12 @@ if [ -f "$DIR/$CAT" ]; then
|
|||
|
||||
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
|
||||
error "Failed to locate file '"$(basename "$ETFS")"' in ISO image, $FB"
|
||||
fi
|
||||
else
|
||||
error "Failed to locate file '"$(basename "$CAT")"' in ISO image, $FB"
|
||||
error "Failed to locate file '"$(basename "$ETFS")"' in ISO image, $FB"
|
||||
fi
|
||||
|
||||
mv "$ISO" "$STORAGE/$BASE"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue