mirror of
https://github.com/dockur/windows.git
synced 2024-11-25 01:34:45 +01:00
fix: Download ISO via Mido
This commit is contained in:
parent
169b364c79
commit
ca2c8b9f69
@ -1,50 +1,22 @@
|
|||||||
#!/usr/bin/env bash
|
!/usr/bin/env bash
|
||||||
set -Eeuo pipefail
|
set -Eeuo pipefail
|
||||||
|
|
||||||
# Check if running with interactive TTY or redirected to docker log
|
: "${VERSION:="win11x64"}"
|
||||||
if [ -t 1 ]; then
|
|
||||||
PROGRESS="--progress=bar:noscroll"
|
|
||||||
else
|
|
||||||
PROGRESS="--progress=dot:giga"
|
|
||||||
fi
|
|
||||||
|
|
||||||
info "Downloading installer..."
|
BASE="$VERSION.iso"
|
||||||
|
[ -f "$STORAGE/$BASE" ] && return 0
|
||||||
|
|
||||||
URL="https://raw.githubusercontent.com/ElliotKillick/Mido/main/Mido.sh"
|
URL="https://raw.githubusercontent.com/ElliotKillick/Mido/main/Mido.sh"
|
||||||
{ wget "$URL" -O /run/Mido.sh -q --no-check-certificate; rc=$?; } || :
|
{ wget "$URL" -O "$STORAGE/Mido.sh" -q --no-check-certificate; rc=$?; } || :
|
||||||
|
|
||||||
(( rc != 0 )) && error "Failed to download $URL, reason: $rc" && exit 65
|
(( rc != 0 )) && error "Failed to download $URL, reason: $rc" && exit 65
|
||||||
|
|
||||||
chmod +x /run/Mido.sh
|
chmod +x "$STORAGE/Mido.sh"
|
||||||
bash /run/Mido.sh
|
rm -f "$STORAGE/$BASE"
|
||||||
|
|
||||||
exit 99
|
bash "$STORAGE/Mido.sh" "$VERSION"
|
||||||
|
|
||||||
BASE="boot.img"
|
[ ! -f "$STORAGE/$BASE" ] && error "Failed to download $VERSION.iso!" && exit 66
|
||||||
[ -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"
|
DEST="$STORAGE/drivers.img"
|
||||||
|
|
||||||
@ -59,6 +31,4 @@ if [ ! -f "$DEST" ]; then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv -f "$TMP" "$STORAGE/$BASE"
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user