1
0
mirror of https://github.com/tteck/Proxmox.git synced 2024-12-25 10:42:53 +02:00

Update haos_vm.sh

works with PVE6
This commit is contained in:
tteckster 2022-07-30 00:54:02 -04:00 committed by GitHub
parent a4d6fee95f
commit fe47b3d90f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,10 @@
#!/usr/bin/env bash
echo -e "Loading..."
PVE=$(pveversion | grep "pve-manager/7" | wc -l)
GEN_MAC=$(echo '00 60 2f'$(od -An -N3 -t xC /dev/urandom) | sed -e 's/ /:/g' | tr '[:lower:]' '[:upper:]')
NEXTID=$(pvesh get /cluster/nextid)
RELEASE=$(curl -sX GET "https://api.github.com/repos/home-assistant/operating-system/releases" | awk '/tag_name/{print $4;exit}' FS='[""]')
STABLE="8.2"
STABLE=$(curl -s https://raw.githubusercontent.com/home-assistant/version/master/stable.json | grep "ova" | awk '{print substr($2, 2, length($2)-3) }')
YW=`echo "\033[33m"`
BL=`echo "\033[36m"`
RD=`echo "\033[01;31m"`
@ -50,6 +51,12 @@ function cleanup() {
TEMP_DIR=$(mktemp -d)
pushd $TEMP_DIR >/dev/null
if [[ "$PVE" == "1" ]]; then
echo -e "${YW}This script is for Proxmox Virtual Environment 6${CL}"
echo -e "Continuing..."
sleep 5
fi
while true; do
clear
read -p "This will create a New Home Assistant OS VM. Proceed(y/n)?" yn
@ -260,7 +267,7 @@ fi
}
function start_script() {
echo -e "${YW}Type Advanced, or Press [ENTER] for Default Settings "
echo -e "${YW}Type Advanced (Latest ${RELEASE}), or Press [ENTER] for Default Settings (Stable ${STABLE}) "
read SETTINGS
if [ -z $SETTINGS ]; then default_settings;
else
@ -312,15 +319,6 @@ case $STORAGE_TYPE in
DISK_EXT=".qcow2"
DISK_REF="$VMID/"
DISK_IMPORT="-format qcow2"
;;
btrfs)
DISK_EXT=".raw"
DISK_REF="$VMID/"
DISK_FORMAT="subvol"
DISK_IMPORT="-format raw"
;;
esac
for i in {0,1}; do
disk="DISK$i"
@ -341,7 +339,6 @@ qm set $VMID \
-boot order=scsi0 >/dev/null
qm set $VMID -description "# Home Assistant OS
### https://github.com/tteck/Proxmox" >/dev/null
msg_ok "Created HAOS VM ${CL}${BL}${VM_NAME}"
if [ "$START_VM" == "yes" ]; then