feat: Show warnings (#58)

This commit is contained in:
Kroese 2024-01-19 15:18:56 +01:00 committed by GitHub
parent 6e24a2ae51
commit a2cc998c60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 33 additions and 30 deletions

View File

@ -128,8 +128,20 @@ rm -rf "$DIR"
7z x "$ISO" -o"$DIR" > /dev/null 7z x "$ISO" -o"$DIR" > /dev/null
echo echo
XML=""
FB="falling back to manual installation!" FB="falling back to manual installation!"
ETFS="boot/etfsboot.com"
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
if [ ! -f "$DIR/$ETFS" ] || [ ! -f "$DIR/$EFISYS" ]; then
if [ ! -f "$DIR/$ETFS" ]; then
warn "failed to locate file 'etfsboot.com' in ISO image, $FB"
else
warn "failed to locate file 'efisys_noprompt.bin' in ISO image, $FB"
fi
mv "$ISO" "$STORAGE/$BASE"
rm -rf "$TMP"
echo && return 0
fi
if [ -z "$MANUAL" ]; then if [ -z "$MANUAL" ]; then
@ -141,6 +153,8 @@ if [ -z "$MANUAL" ]; then
fi fi
XML=""
if [[ "$MANUAL" != [Yy1]* ]]; then if [[ "$MANUAL" != [Yy1]* ]]; then
if [[ "$EXTERNAL" != [Yy1]* ]]; then if [[ "$EXTERNAL" != [Yy1]* ]]; then
@ -179,17 +193,17 @@ if [[ "$MANUAL" != [Yy1]* ]]; then
else else
if [ -z "$NAME" ]; then if [ -z "$NAME" ]; then
error "Warning: failed to detect Windows version from image, $FB" warn "failed to detect Windows version from image, $FB"
else else
if [[ "${NAME,,}" == "windows 7" ]]; then if [[ "${NAME,,}" == "windows 7" ]]; then
error "Warning: detected Windows 7 image, $FB" warn "detected Windows 7 image, $FB"
else else
error "Warning: failed to detect Windows version from string '$NAME', $FB" warn "failed to detect Windows version from string '$NAME', $FB"
fi fi
fi fi
fi fi
else else
error "Warning: failed to locate 'install.wim' or 'install.esd' in ISO image, $FB" warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB"
fi fi
echo echo
fi fi
@ -217,7 +231,7 @@ if [ -f "$ASSET" ]; then
wimlib-imagex update "$LOC" "$INDEX" --command "add $ASSET /autounattend.xml" > /dev/null wimlib-imagex update "$LOC" "$INDEX" --command "add $ASSET /autounattend.xml" > /dev/null
else else
error "Warning: failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB" warn "failed to locate 'boot.wim' or 'boot.esd' in ISO image, $FB"
fi fi
LOC="$DIR/autounattend.xml" LOC="$DIR/autounattend.xml"
@ -240,33 +254,22 @@ if [ -f "$ASSET" ]; then
echo echo
else else
[ -n "$XML" ] && error "Warning: XML file '$XML' does not exist, $FB" && echo if [ -n "$XML" ]; then
fi warn "XML file '$XML' does not exist, $FB" && echo
ETFS="boot/etfsboot.com"
EFISYS="efi/microsoft/boot/efisys_noprompt.bin"
if [ -f "$DIR/$ETFS" ]; then
if [ -f "$DIR/$EFISYS" ]; then
CAT="BOOT.CAT"
LABEL="${BASE%.*}"
LABEL="${LABEL::32}"
ISO="$TMP/$LABEL.tmp"
rm -f "$ISO"
info "Generating new ISO image for installation..."
genisoimage -b "$ETFS" -no-emul-boot -c "$CAT" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -quiet -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_noprompt.bin' in ISO image, $FB"
fi fi
else
error "Failed to locate file 'etfsboot.com' in ISO image, $FB"
fi fi
CAT="BOOT.CAT"
LABEL="${BASE%.*}"
LABEL="${LABEL::30}"
ISO="$TMP/$LABEL.tmp"
rm -f "$ISO"
info "Generating new ISO image for installation..."
genisoimage -b "$ETFS" -no-emul-boot -c "$CAT" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -quiet -V "$LABEL" -udf \
-boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -o "$ISO" -allow-limited-size "$DIR"
mv "$ISO" "$STORAGE/$BASE" mv "$ISO" "$STORAGE/$BASE"
rm -rf "$TMP" rm -rf "$TMP"