mirror of
https://github.com/dockur/windows.git
synced 2024-11-21 15:53:19 +01:00
feat: Add installer (#5)
This commit is contained in:
parent
dc23c79b4f
commit
169b364c79
@ -23,4 +23,4 @@ ENV DISK_SIZE "64G"
|
|||||||
ARG VERSION_ARG "0.0"
|
ARG VERSION_ARG "0.0"
|
||||||
RUN echo "$VERSION_ARG" > /run/version
|
RUN echo "$VERSION_ARG" > /run/version
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/tini", "-s", "/run/init.sh"]
|
ENTRYPOINT ["/usr/bin/tini", "-s", "/run/entry.sh"]
|
||||||
|
@ -4,6 +4,9 @@ set -Eeuo pipefail
|
|||||||
echo "❯ Starting Windows for Docker v$(</run/version)..."
|
echo "❯ Starting Windows for Docker v$(</run/version)..."
|
||||||
echo "❯ For support visit https://github.com/dockur/windows"
|
echo "❯ For support visit https://github.com/dockur/windows"
|
||||||
|
|
||||||
|
export DISPLAY=web
|
||||||
|
export BOOT_MODE=windows
|
||||||
|
|
||||||
cd /run
|
cd /run
|
||||||
|
|
||||||
. reset.sh # Initialize system
|
. reset.sh # Initialize system
|
||||||
@ -21,7 +24,7 @@ if [[ "${DISPLAY,,}" == "web" ]]; then
|
|||||||
websockify -D --web /usr/share/novnc/ 8006 localhost:5900 2>/dev/null
|
websockify -D --web /usr/share/novnc/ 8006 localhost:5900 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Booting image using $VERS..."
|
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}
|
64
src/install.sh
Normal file
64
src/install.sh
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
# Check if running with interactive TTY or redirected to docker log
|
||||||
|
if [ -t 1 ]; then
|
||||||
|
PROGRESS="--progress=bar:noscroll"
|
||||||
|
else
|
||||||
|
PROGRESS="--progress=dot:giga"
|
||||||
|
fi
|
||||||
|
|
||||||
|
info "Downloading installer..."
|
||||||
|
|
||||||
|
URL="https://raw.githubusercontent.com/ElliotKillick/Mido/main/Mido.sh"
|
||||||
|
{ wget "$URL" -O /run/Mido.sh -q --no-check-certificate; rc=$?; } || :
|
||||||
|
|
||||||
|
(( rc != 0 )) && error "Failed to download $URL, reason: $rc" && exit 65
|
||||||
|
|
||||||
|
chmod +x /run/Mido.sh
|
||||||
|
bash /run/Mido.sh
|
||||||
|
|
||||||
|
exit 99
|
||||||
|
|
||||||
|
BASE="boot.img"
|
||||||
|
[ -f "$STORAGE/$BASE" ] && return 0
|
||||||
|
|
||||||
|
if [ -z "$BOOT" ]; then
|
||||||
|
error "No boot disk specified, set BOOT= to the URL of an ISO file." && exit 64
|
||||||
|
fi
|
||||||
|
|
||||||
|
BASE=$(basename "$BOOT")
|
||||||
|
[ -f "$STORAGE/$BASE" ] && return 0
|
||||||
|
|
||||||
|
TMP="$STORAGE/${BASE%.*}.tmp"
|
||||||
|
rm -f "$TMP"
|
||||||
|
|
||||||
|
info "Downloading $BASE as boot image..."
|
||||||
|
|
||||||
|
{ wget "$BOOT" -O "$TMP" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || :
|
||||||
|
|
||||||
|
(( rc != 0 )) && error "Failed to download $BOOT, reason: $rc" && exit 60
|
||||||
|
[ ! -f "$TMP" ] && error "Failed to download $BOOT" && exit 61
|
||||||
|
|
||||||
|
SIZE=$(stat -c%s "$TMP")
|
||||||
|
|
||||||
|
if ((SIZE<100000)); then
|
||||||
|
error "Invalid ISO file: Size is smaller than 100 KB" && exit 62
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEST="$STORAGE/drivers.img"
|
||||||
|
|
||||||
|
if [ ! -f "$DEST" ]; then
|
||||||
|
|
||||||
|
info "Downloading VirtIO drivers for Windows..."
|
||||||
|
DRIVERS="https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso"
|
||||||
|
|
||||||
|
{ wget "$DRIVERS" -O "$DEST" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || :
|
||||||
|
|
||||||
|
(( rc != 0 )) && info "Failed to download $DRIVERS, reason: $rc" && rm -f "$DEST"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
mv -f "$TMP" "$STORAGE/$BASE"
|
||||||
|
|
||||||
|
return 0
|
Loading…
Reference in New Issue
Block a user