Update install.sh

This commit is contained in:
Kroese 2024-01-22 16:00:53 +01:00 committed by GitHub
parent d0853d65cf
commit ca27b1a70b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -45,6 +45,7 @@ else
EXTERNAL="N" EXTERNAL="N"
fi fi
TMP="$STORAGE/tmp"
MSG="Windows is being started, please wait..." MSG="Windows is being started, please wait..."
if [[ "$EXTERNAL" != [Yy1]* ]]; then if [[ "$EXTERNAL" != [Yy1]* ]]; then
@ -72,15 +73,19 @@ fi
html "$MSG" html "$MSG"
CUSTOM="custom.iso" CUSTOM="custom.iso"
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.img"
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="Custom.iso" [ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="Custom.iso"
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="Custom.img"
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.ISO" [ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.ISO"
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.IMG"
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="CUSTOM.ISO" [ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="CUSTOM.ISO"
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.img"
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="Custom.img"
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.IMG"
[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="CUSTOM.IMG" [ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="CUSTOM.IMG"
TMP="$STORAGE/tmp" if [ -f "$STORAGE/$CUSTOM" ]; then
BASE="$CUSTOM"
else
CUSTOM=""
fi
if [ -f "$STORAGE/$BASE" ]; then if [ -f "$STORAGE/$BASE" ]; then
@ -94,21 +99,21 @@ if [ -f "$STORAGE/$BASE" ]; then
fi fi
CUSTOM="$BASE" CUSTOM="$BASE"
info "Custom ISO file $BASE needs to be prepared..." info "Custom ISO file '$BASE' needs to be prepared..."
fi fi
mkdir -p "$TMP" mkdir -p "$TMP"
ISO="$TMP/$BASE"
rm -f "$ISO"
if [ ! -f "$STORAGE/$CUSTOM" ]; then if [ ! -f "$STORAGE/$CUSTOM" ]; then
CUSTOM="" CUSTOM=""
ISO="$TMP/$BASE"
else else
ISO="$STORAGE/$CUSTOM" ISO="$STORAGE/$CUSTOM"
fi fi
rm -f "$TMP/$BASE"
if [ ! -f "$ISO" ]; then if [ ! -f "$ISO" ]; then
if [[ "$EXTERNAL" != [Yy1]* ]]; then if [[ "$EXTERNAL" != [Yy1]* ]]; then
@ -134,6 +139,7 @@ if [ ! -f "$ISO" ]; then
fi fi
[ ! -f "$ISO" ] && error "Failed to download $VERSION" && exit 61 [ ! -f "$ISO" ] && error "Failed to download $VERSION" && exit 61
fi fi
SIZE=$(stat -c%s "$ISO") SIZE=$(stat -c%s "$ISO")
@ -184,6 +190,8 @@ fi
[ -z "$CUSTOM" ] && rm -f "$ISO" [ -z "$CUSTOM" ] && rm -f "$ISO"
XML=""
if [ -z "$MANUAL" ]; then if [ -z "$MANUAL" ]; then
MANUAL="N" MANUAL="N"
@ -191,8 +199,6 @@ if [ -z "$MANUAL" ]; then
fi fi
XML=""
if [[ "$MANUAL" != [Yy1]* ]]; then if [[ "$MANUAL" != [Yy1]* ]]; then
if [[ "$EXTERNAL" != [Yy1]* ]]; then if [[ "$EXTERNAL" != [Yy1]* ]]; then
@ -243,6 +249,7 @@ if [[ "$MANUAL" != [Yy1]* ]]; then
if [ -f "/run/assets/$XML" ]; then if [ -f "/run/assets/$XML" ]; then
echo "Detected image of type '$DETECTED', which supports automatic installation." echo "Detected image of type '$DETECTED', which supports automatic installation."
else else
XML=""
warn "detected image of type '$DETECTED', but no matching XML file exists, $FB." warn "detected image of type '$DETECTED', but no matching XML file exists, $FB."
fi fi
@ -267,6 +274,23 @@ ASSET="/run/assets/$XML"
if [ -f "$ASSET" ]; then if [ -f "$ASSET" ]; then
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"
LOC="$DIR/sources/boot.wim" LOC="$DIR/sources/boot.wim"
[ ! -f "$LOC" ] && LOC="$DIR/sources/boot.esd" [ ! -f "$LOC" ] && LOC="$DIR/sources/boot.esd"
@ -286,26 +310,11 @@ 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
ASSET=""
warn "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"
[ -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"
fi fi
CAT="BOOT.CAT" CAT="BOOT.CAT"
@ -337,7 +346,6 @@ if [ -f "$STORAGE/$BASE" ]; then
fi fi
mv "$OUT" "$STORAGE/$BASE" mv "$OUT" "$STORAGE/$BASE"
echo "$BASE" > "$STORAGE/windows.ver" echo "$BASE" > "$STORAGE/windows.ver"
if [ -f "$ASSET" ]; then if [ -f "$ASSET" ]; then