Skip to content

Instantly share code, notes, and snippets.

@Mearman
Last active October 10, 2021 07:49
Show Gist options
  • Select an option

  • Save Mearman/2660075bd95afde886536d6a7cf60c9b to your computer and use it in GitHub Desktop.

Select an option

Save Mearman/2660075bd95afde886536d6a7cf60c9b to your computer and use it in GitHub Desktop.
HAss OS Image download and decompress
#!/bin/bash
set -x
# find the latest version here: https://github.com/home-assistant/operating-system/releases
VERSION="6.5"
# ----------
IMAGE_NAME="haos_ova-$VERSION"
IMAGE_FILE="$IMAGE_NAME.qcow2"
COMPRESSED_IMAGE="$IMAGE_FILE.xz"
DESTIONATION="/mnt/user/domains/$IMAGE_NAME"
# ----------
mkdir "/mnt/user/domains/$IMAGE_NAME"
cd "/mnt/user/domains/$IMAGE_NAME"
if [ -f "$DESTIONATION/$COMPRESSED_IMAGE" ]; then
echo "$COMPRESSED_IMAGE already exists"
echo "not downloading again"
else
echo "$COMPRESSED_IMAGE does not exist. Downloading"
wget "https://github.com/home-assistant/operating-system/releases/download/$VERSION/$COMPRESSED_IMAGE" -O "$DESTIONATION/$COMPRESSED_IMAGE"
fi
unxz -v "$DESTIONATION/$COMPRESSED_IMAGE"
qemu-img resize "$DESTIONATION/$IMAGE_FILE" 32G
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment