Skip to content

Commit

Permalink
feat: Display progress via web (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Jan 20, 2024
1 parent 6566d24 commit accd179
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
12 changes: 3 additions & 9 deletions src/entry.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env bash
set -Eeuo pipefail

echo "❯ Starting Windows for Docker v$(</run/version)..."
echo "❯ For support visit https://github.com/dockur/windows"
echo

APP="Windows"
export BOOT_MODE=windows
SUPPORT="https://github.com/dockur/windows"

cd /run

Expand All @@ -20,11 +18,7 @@ cd /run

trap - ERR

if [[ "${DISPLAY,,}" == "web" ]]; then
nginx -e stderr
fi

echo && info "Booting Windows using $VERS..."
info "Booting $APP using $VERS..."

[[ "$DEBUG" == [Yy1]* ]] && set -x
exec qemu-system-x86_64 ${ARGS:+ $ARGS}
23 changes: 14 additions & 9 deletions src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ else
EXTERNAL="N"
fi

MSG="Please wait while Windows is being started..."
MSG="Windows is being started, please wait..."

BASE="custom.iso"
if [ ! -f "$STORAGE/$BASE" ]; then
Expand All @@ -55,7 +55,7 @@ if [ ! -f "$STORAGE/$BASE" ]; then

BASE="$VERSION.iso"
if [ ! -f "$STORAGE/$BASE" ]; then
MSG="Please wait while Windows is being downloaded..."
MSG="Windows is being downloaded, please wait..."
fi

else
Expand All @@ -65,14 +65,13 @@ if [ ! -f "$STORAGE/$BASE" ]; then
BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g')

if [ ! -f "$STORAGE/$BASE" ]; then
MSG="Please wait while '$BASE' is being downloaded..."
MSG="Image '$BASE' is being downloaded, please wait..."
fi

fi
fi

# Display wait message
/run/server.sh "Windows" "$MSG" &
html "$MSG"

[ -f "$STORAGE/$BASE" ] && return 0

Expand Down Expand Up @@ -120,7 +119,8 @@ if ((SIZE<10000000)); then
echo && error "Invalid ISO file: Size is smaller than 10 MB" && exit 62
fi

echo && info "Extracting downloaded ISO image..."
MSG="Extracting downloaded ISO image..."
echo && info "$MSG" && html "$MSG"

DIR="$TMP/unpack"
rm -rf "$DIR"
Expand Down Expand Up @@ -162,7 +162,8 @@ if [[ "$MANUAL" != [Yy1]* ]]; then

else

info "Detecting Windows version from ISO image..."
MSG="Detecting Windows version from ISO image..."
info "$MSG" && html "$MSG"

LOC="$DIR/sources/install.wim"
[ ! -f "$LOC" ] && LOC="$DIR/sources/install.esd"
Expand Down Expand Up @@ -218,7 +219,8 @@ if [ -f "$ASSET" ]; 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')

Expand Down Expand Up @@ -265,13 +267,16 @@ LABEL="${LABEL::30}"
ISO="$TMP/$LABEL.tmp"
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 \
-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"

html "Successfully prepared image for installation..."

echo
return 0

0 comments on commit accd179

Please sign in to comment.