windows/src/install.sh

41 lines
917 B
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 17:05:42 +00:00
: "${VERSION:="win10x64"}"
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 17:05:42 +00:00
SCRIPT="$STORAGE/mido.sh"
2024-01-14 14:19:58 +00:00
2024-01-14 17:05:42 +00:00
rm -f "$SCRIPT"
cp /run/mido.sh "$SCRIPT"
chmod +x "$SCRIPT"
2024-01-14 14:19:58 +00:00
2024-01-14 17:05:42 +00:00
bash "$SCRIPT" "$VERSION"
rm -f "$SCRIPT"
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