From a2cc998c600affe56f1e7834ba508add05747288 Mon Sep 17 00:00:00 2001 From: Kroese Date: Fri, 19 Jan 2024 15:18:56 +0100 Subject: [PATCH] feat: Show warnings (#58) --- src/install.sh | 63 ++++++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/src/install.sh b/src/install.sh index 06f0761..d4f76ec 100644 --- a/src/install.sh +++ b/src/install.sh @@ -128,8 +128,20 @@ rm -rf "$DIR" 7z x "$ISO" -o"$DIR" > /dev/null echo -XML="" 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 @@ -141,6 +153,8 @@ if [ -z "$MANUAL" ]; then fi +XML="" + if [[ "$MANUAL" != [Yy1]* ]]; then if [[ "$EXTERNAL" != [Yy1]* ]]; then @@ -179,17 +193,17 @@ if [[ "$MANUAL" != [Yy1]* ]]; then else if [ -z "$NAME" ]; then - error "Warning: failed to detect Windows version from image, $FB" + warn "failed to detect Windows version from image, $FB" else if [[ "${NAME,,}" == "windows 7" ]]; then - error "Warning: detected Windows 7 image, $FB" + warn "detected Windows 7 image, $FB" 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 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 echo fi @@ -217,7 +231,7 @@ if [ -f "$ASSET" ]; then wimlib-imagex update "$LOC" "$INDEX" --command "add $ASSET /autounattend.xml" > /dev/null 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 LOC="$DIR/autounattend.xml" @@ -240,33 +254,22 @@ if [ -f "$ASSET" ]; then echo else - [ -n "$XML" ] && error "Warning: XML file '$XML' does not exist, $FB" && echo -fi - -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" + if [ -n "$XML" ]; then + warn "XML file '$XML' does not exist, $FB" && echo fi -else - error "Failed to locate file 'etfsboot.com' in ISO image, $FB" 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" rm -rf "$TMP"