session1/ now holds the whole live lab (content, platforms, docs, answer key, README); session2/ keeps the design for the second workshop. The root README indexes both and states that session2 modifies session1 rather than duplicating it. build-bundle.sh builds from session1 and still produces a flat archive, so the documented paths inside a deployment (platforms/<p>/lab.sh) are unchanged. .gitignore follows the move.
52 lines
1.6 KiB
Bash
52 lines
1.6 KiB
Bash
# shellcheck shell=bash
|
|
# cmd_isos — fetch the Windows media into LAB_ISO_CACHE.
|
|
# Read-only content, so an NTFS/FUSE cache directory is fine here.
|
|
|
|
# name|url|minimum size in MB
|
|
ISO_ITEMS=(
|
|
"SERVER_EVAL_x64FRE_en-us.iso|https://go.microsoft.com/fwlink/?linkid=2195280|2000"
|
|
"virtio-win.iso|https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso|200"
|
|
)
|
|
|
|
cmd_isos() {
|
|
have_cmd curl || die "curl is required"
|
|
mkdir -p "$LAB_ISO_CACHE" || die "cannot create $LAB_ISO_CACHE"
|
|
|
|
local item name url min_mb target tmp size_mb
|
|
for item in "${ISO_ITEMS[@]}"; do
|
|
IFS='|' read -r name url min_mb <<< "$item"
|
|
target="$LAB_ISO_CACHE/$name"
|
|
tmp="$target.part"
|
|
|
|
if [[ -f $target ]]; then
|
|
size_mb=$(( $(stat -c %s "$target") / 1024 / 1024 ))
|
|
if (( size_mb >= min_mb )); then
|
|
ok "$name present (${size_mb} MB)"
|
|
continue
|
|
fi
|
|
warn "$name is only ${size_mb} MB, re-downloading"
|
|
rm -f "$target"
|
|
fi
|
|
|
|
step "download $name"
|
|
info " from $url"
|
|
|
|
local curl_opts=(-L --fail --retry 3 --retry-delay 5 -C - -o "$tmp")
|
|
if [[ -t 1 ]]; then
|
|
curl "${curl_opts[@]}" --progress-bar "$url" || { rm -f "$tmp"; die "download failed: $name"; }
|
|
else
|
|
curl "${curl_opts[@]}" -sS "$url" || { rm -f "$tmp"; die "download failed: $name"; }
|
|
fi
|
|
|
|
mv -f "$tmp" "$target"
|
|
size_mb=$(( $(stat -c %s "$target") / 1024 / 1024 ))
|
|
if (( size_mb < min_mb )); then
|
|
die "$name looks truncated: ${size_mb} MB (expected >= ${min_mb} MB)"
|
|
fi
|
|
ok "$name ready (${size_mb} MB)"
|
|
done
|
|
|
|
printf '\n'
|
|
ok "ISO cache complete: ${LAB_ISO_CACHE}"
|
|
}
|