feat: Display progress via web (#61)

This commit is contained in:
Kroese 2024-01-20 17:03:59 +01:00 committed by GitHub
parent 6566d249fc
commit accd1799d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 18 deletions

View file

@ -1,11 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -Eeuo pipefail set -Eeuo pipefail
echo " Starting Windows for Docker v$(</run/version)..." APP="Windows"
echo " For support visit https://github.com/dockur/windows"
echo
export BOOT_MODE=windows export BOOT_MODE=windows
SUPPORT="https://github.com/dockur/windows"
cd /run cd /run
@ -20,11 +18,7 @@ cd /run
trap - ERR trap - ERR
if [[ "${DISPLAY,,}" == "web" ]]; then info "Booting $APP using $VERS..."
nginx -e stderr
fi
echo && info "Booting Windows using $VERS..."
[[ "$DEBUG" == [Yy1]* ]] && set -x [[ "$DEBUG" == [Yy1]* ]] && set -x
exec qemu-system-x86_64 ${ARGS:+ $ARGS} exec qemu-system-x86_64 ${ARGS:+ $ARGS}

View file

@ -46,7 +46,7 @@ else
EXTERNAL="N" EXTERNAL="N"
fi fi
MSG="Please wait while Windows is being started..." MSG="Windows is being started, please wait..."
BASE="custom.iso" BASE="custom.iso"
if [ ! -f "$STORAGE/$BASE" ]; then if [ ! -f "$STORAGE/$BASE" ]; then
@ -55,7 +55,7 @@ if [ ! -f "$STORAGE/$BASE" ]; then
BASE="$VERSION.iso" BASE="$VERSION.iso"
if [ ! -f "$STORAGE/$BASE" ]; then if [ ! -f "$STORAGE/$BASE" ]; then
MSG="Please wait while Windows is being downloaded..." MSG="Windows is being downloaded, please wait..."
fi fi
else else
@ -65,14 +65,13 @@ if [ ! -f "$STORAGE/$BASE" ]; then
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g') BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')
if [ ! -f "$STORAGE/$BASE" ]; then if [ ! -f "$STORAGE/$BASE" ]; then
MSG="Please wait while '$BASE' is being downloaded..." MSG="Image '$BASE' is being downloaded, please wait..."
fi fi
fi fi
fi fi
# Display wait message html "$MSG"
/run/server.sh "Windows" "$MSG" &
[ -f "$STORAGE/$BASE" ] && return 0 [ -f "$STORAGE/$BASE" ] && return 0
@ -120,7 +119,8 @@ if ((SIZE<10000000)); then
echo && error "Invalid ISO file: Size is smaller than 10 MB" && exit 62 echo && error "Invalid ISO file: Size is smaller than 10 MB" && exit 62
fi fi
echo && info "Extracting downloaded ISO image..." MSG="Extracting downloaded ISO image..."
echo && info "$MSG" && html "$MSG"
DIR="$TMP/unpack" DIR="$TMP/unpack"
rm -rf "$DIR" rm -rf "$DIR"
@ -162,7 +162,8 @@ if [[ "$MANUAL" != [Yy1]* ]]; then
else else
info "Detecting Windows version from ISO image..." MSG="Detecting Windows version from ISO image..."
info "$MSG" && html "$MSG"
LOC="$DIR/sources/install.wim" LOC="$DIR/sources/install.wim"
[ ! -f "$LOC" ] && LOC="$DIR/sources/install.esd" [ ! -f "$LOC" ] && LOC="$DIR/sources/install.esd"
@ -218,7 +219,8 @@ if [ -f "$ASSET" ]; then
if [ -f "$LOC" ]; then if [ -f "$LOC" ]; then
info "Adding XML file for automatic installation..." MSG="Adding XML file for automatic installation..."
info "$MSG" && html "$MSG"
RESULT=$(wimlib-imagex info -xml "$LOC" | tr -d '\000') RESULT=$(wimlib-imagex info -xml "$LOC" | tr -d '\000')
@ -265,7 +267,8 @@ LABEL="${LABEL::30}"
ISO="$TMP/$LABEL.tmp" ISO="$TMP/$LABEL.tmp"
rm -f "$ISO" rm -f "$ISO"
info "Generating new ISO image for installation..." MSG="Generating new ISO image for installation..."
info "$MSG" && html "$MSG"
genisoimage -b "$ETFS" -no-emul-boot -c "$CAT" -iso-level 4 -J -l -D -N -joliet-long -relaxed-filenames -quiet -V "$LABEL" -udf \ 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" -boot-info-table -eltorito-alt-boot -eltorito-boot "$EFISYS" -no-emul-boot -o "$ISO" -allow-limited-size "$DIR"
@ -273,5 +276,7 @@ genisoimage -b "$ETFS" -no-emul-boot -c "$CAT" -iso-level 4 -J -l -D -N -joliet-
mv "$ISO" "$STORAGE/$BASE" mv "$ISO" "$STORAGE/$BASE"
rm -rf "$TMP" rm -rf "$TMP"
html "Successfully prepared image for installation..."
echo echo
return 0 return 0