forked from cloud-hypervisor/rust-hypervisor-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch_disk_images.sh
executable file
·52 lines (45 loc) · 1.87 KB
/
fetch_disk_images.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
set -xeuf
IMAGES_DIR="./resources/images"
mkdir -p "$IMAGES_DIR"
fetch_image() {
OS_IMAGE_NAME="$1"
OS_IMAGE_URL="$2"
OS_IMAGE="$IMAGES_DIR/$OS_IMAGE_NAME"
if [ ! -f "$OS_IMAGE" ]; then
pushd $IMAGES_DIR
wget --quiet $OS_IMAGE_URL
popd
fi
}
convert_image() {
OS_IMAGE_NAME="$1"
OS_RAW_IMAGE_NAME="$2"
OS_IMAGE="$IMAGES_DIR/$OS_IMAGE_NAME"
OS_RAW_IMAGE="$IMAGES_DIR/$OS_RAW_IMAGE_NAME"
if [ ! -f "$OS_RAW_IMAGE" ]; then
qemu-img convert -p -f qcow2 -O raw $OS_IMAGE $OS_RAW_IMAGE
fi
}
CLEAR_OS_IMAGE_NAME="clear-31311-cloudguest.img"
CLEAR_OS_URL_BASE="https://cloud-hypervisor.azureedge.net/"
CLEAR_OS_IMAGE_URL="$CLEAR_OS_URL_BASE/$CLEAR_OS_IMAGE_NAME"
fetch_image "$CLEAR_OS_IMAGE_NAME" "$CLEAR_OS_IMAGE_URL"
BIONIC_OS_IMAGE_NAME="bionic-server-cloudimg-amd64.img"
BIONIC_OS_RAW_IMAGE_NAME="bionic-server-cloudimg-amd64-raw.img"
BIONIC_OS_IMAGE_BASE="https://cloud-images.ubuntu.com/bionic/current"
BIONIC_OS_IMAGE_URL="$BIONIC_OS_IMAGE_BASE/$BIONIC_OS_IMAGE_NAME"
fetch_image "$BIONIC_OS_IMAGE_NAME" "$BIONIC_OS_IMAGE_URL"
convert_image "$BIONIC_OS_IMAGE_NAME" "$BIONIC_OS_RAW_IMAGE_NAME"
FOCAL_OS_IMAGE_NAME="focal-server-cloudimg-amd64.img"
FOCAL_OS_RAW_IMAGE_NAME="focal-server-cloudimg-amd64-raw.img"
FOCAL_OS_IMAGE_BASE="https://cloud-images.ubuntu.com/focal/current"
FOCAL_OS_IMAGE_URL="$FOCAL_OS_IMAGE_BASE/$FOCAL_OS_IMAGE_NAME"
fetch_image "$FOCAL_OS_IMAGE_NAME" "$FOCAL_OS_IMAGE_URL"
convert_image "$FOCAL_OS_IMAGE_NAME" "$FOCAL_OS_RAW_IMAGE_NAME"
HIRSUTE_OS_IMAGE_NAME="hirsute-server-cloudimg-amd64.img"
HIRSUTE_OS_RAW_IMAGE_NAME="hirsute-server-cloudimg-amd64-raw.img"
HIRSUTE_OS_IMAGE_BASE="https://cloud-images.ubuntu.com/hirsute/current"
HIRSUTE_OS_IMAGE_URL="$HIRSUTE_OS_IMAGE_BASE/$HIRSUTE_OS_IMAGE_NAME"
fetch_image "$HIRSUTE_OS_IMAGE_NAME" "$HIRSUTE_OS_IMAGE_URL"
convert_image "$HIRSUTE_OS_IMAGE_NAME" "$HIRSUTE_OS_RAW_IMAGE_NAME"