Compare commits
5 Commits
patch-slow
...
master
Author | SHA1 | Date | |
---|---|---|---|
842367d125 | |||
9913787436 | |||
|
f6816052bb | ||
|
b49feaa906 | ||
|
00352c8c4e |
@ -3,7 +3,7 @@
|
||||
This script will create a new Proxmox VM with the latest version of Home Assistant. To create a new VM, run the following in a SSH session or the console from Proxmox interface
|
||||
|
||||
```
|
||||
bash -c "$(wget -qLO - https://github.com/whiskerz007/proxmox_hassos_install/raw/master/install.sh)"
|
||||
bash -c "$(wget -qLO - https://git.sfs.ddnss.org/Erik/proxmox_hassos_install/raw/branch/master/install.sh)"
|
||||
```
|
||||
|
||||
After script completes, click on the new VM (_the script will tell you the ID_), click on the `Hardware` tab for the VM and change the `Memory` and `Processors` settings to what you desire. The `Hard Disk` can be expanded by clicking on it, then click on the `Resize disk` button above (_Note: additional steps must be taken for storage to take effect in the VM after the first boot_). The network MAC address can be changed by selecting `Network Device` and clicking `Edit` above. Once all changes have been made, click `Start` above.
|
||||
|
39
install.sh
39
install.sh
@ -81,24 +81,21 @@ info "Container ID is $VMID."
|
||||
|
||||
# Get latest Home Assistant disk image archive URL
|
||||
msg "Getting URL for latest Home Assistant disk image..."
|
||||
RELEASE_EXT=vmdk.gz
|
||||
RELEASE_TYPE=vmdk
|
||||
URL=$(cat<<EOF | python3
|
||||
import requests
|
||||
url = 'https://api.github.com/repos/home-assistant/operating-system/releases'
|
||||
url = "https://api.github.com/repos/home-assistant/operating-system/releases"
|
||||
r = requests.get(url).json()
|
||||
if 'message' in r:
|
||||
if "message" in r:
|
||||
exit()
|
||||
for release in r:
|
||||
if release['prerelease']:
|
||||
if release["prerelease"]:
|
||||
continue
|
||||
for asset in release['assets']:
|
||||
if asset['name'].endswith('$RELEASE_EXT'):
|
||||
global image_url
|
||||
image_url = asset['browser_download_url']
|
||||
break
|
||||
if 'image_url' in globals():
|
||||
for asset in release["assets"]:
|
||||
if asset["name"].find("$RELEASE_TYPE") != -1:
|
||||
image_url = asset["browser_download_url"]
|
||||
print(image_url)
|
||||
break
|
||||
exit()
|
||||
EOF
|
||||
)
|
||||
if [ -z "$URL" ]; then
|
||||
@ -113,7 +110,12 @@ FILE=$(basename $URL)
|
||||
|
||||
# Extract Home Assistant disk image
|
||||
msg "Extracting disk image..."
|
||||
gunzip -f $FILE
|
||||
case $FILE in
|
||||
*"gz") gunzip -f $FILE;;
|
||||
*"xz") xz -d $FILE;;
|
||||
*"zip") unzip $FILE;;
|
||||
*) die "Unable to handle file extension '${FILE##*.}'.";;
|
||||
esac
|
||||
|
||||
# Create variables for container disk
|
||||
STORAGE_TYPE=$(pvesm status -storage $STORAGE | awk 'NR>1 {print $2}')
|
||||
@ -130,15 +132,16 @@ done
|
||||
|
||||
# Create VM
|
||||
msg "Creating VM..."
|
||||
VM_NAME=$(sed -e "s/\_//g" -e "s/.${RELEASE_EXT}//" <<< $FILE)
|
||||
VM_NAME=$(sed -e "s/\_//g" -e "s/.${RELEASE_TYPE}.*$//" <<< $FILE)
|
||||
qm create $VMID -agent 1 -bios ovmf -name $VM_NAME -net0 virtio,bridge=vmbr0 \
|
||||
-onboot 1 -ostype l26 -scsihw virtio-scsi-pci
|
||||
EFI_SIZE=128K
|
||||
truncate -s $EFI_SIZE efi
|
||||
qm importdisk $VMID efi $STORAGE ${IMPORT_OPT:-} 1>&/dev/null
|
||||
qm importdisk $VMID ${FILE%".gz"} $STORAGE ${IMPORT_OPT:-} 1>&/dev/null
|
||||
qm set $VMID -bootdisk sata0 -efidisk0 ${DISK0_REF},size=$EFI_SIZE \
|
||||
pvesm alloc $STORAGE $VMID $DISK0 128 1>&/dev/null
|
||||
qm importdisk $VMID ${FILE%.*} $STORAGE ${IMPORT_OPT:-} 1>&/dev/null
|
||||
qm set $VMID \
|
||||
-efidisk0 ${DISK0_REF},size=128K \
|
||||
-sata0 ${DISK1_REF},size=6G > /dev/null
|
||||
qm set $VMID \
|
||||
-boot order=sata0 > /dev/null
|
||||
|
||||
# Add serial port and enable console output
|
||||
set +o errtrace
|
||||
|
Loading…
Reference in New Issue
Block a user