windows_in_docker/src/install.sh

42 lines
1.1 KiB
Bash
Raw Normal View History

2024-01-14 15:39:24 +00:00
#!/usr/bin/env bash
2024-01-14 14:19:58 +00:00
set -Eeuo pipefail
2024-01-14 15:35:58 +00:00
: "${VERSION:="win11x64"}"
2024-01-14 14:19:58 +00:00
2024-01-14 15:35:58 +00:00
BASE="$VERSION.iso"
[ -f "$STORAGE/$BASE" ] && return 0
2024-01-14 14:19:58 +00:00
2024-01-14 16:25:33 +00:00
# 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
2024-01-14 14:19:58 +00:00
URL="https://raw.githubusercontent.com/ElliotKillick/Mido/main/Mido.sh"
2024-01-14 15:35:58 +00:00
{ wget "$URL" -O "$STORAGE/Mido.sh" -q --no-check-certificate; rc=$?; } || :
2024-01-14 14:19:58 +00:00
(( rc != 0 )) && error "Failed to download $URL, reason: $rc" && exit 65
2024-01-14 15:35:58 +00:00
chmod +x "$STORAGE/Mido.sh"
rm -f "$STORAGE/$BASE"
2024-01-14 14:19:58 +00:00
2024-01-14 15:35:58 +00:00
bash "$STORAGE/Mido.sh" "$VERSION"
2024-01-14 14:19:58 +00:00
2024-01-14 15:35:58 +00:00
[ ! -f "$STORAGE/$BASE" ] && error "Failed to download $VERSION.iso!" && exit 66
2024-01-14 14:19:58 +00:00
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
return 0