|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
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="7.6"
|
|
|
|
@ -60,10 +61,7 @@ function default_settings() {
|
|
|
|
|
RAM_SIZE="4096"
|
|
|
|
|
echo -e "${DGN}Using Bridge ${BGN}vmbr0${CL}"
|
|
|
|
|
BRG="vmbr0"
|
|
|
|
|
echo -e "${DGN}Using Static IP Address ${BGN}DHCP${CL}"
|
|
|
|
|
NET=dhcp
|
|
|
|
|
echo -e "${DGN}Using Gateway Address ${BGN}NONE${CL}"
|
|
|
|
|
GATE=""
|
|
|
|
|
echo -e "${DGN}Using MAC Address ${BGN}$MAC${CL}"
|
|
|
|
|
echo -e "${DGN}Using VLAN Tag ${BGN}NONE${CL}"
|
|
|
|
|
VLAN=""
|
|
|
|
|
echo -e "${DGN}Start VM when completed ${BGN}yes${CL}"
|
|
|
|
@ -149,41 +147,6 @@ header_info
|
|
|
|
|
echo -e " ${CM}${CL} \n"
|
|
|
|
|
sleep 1
|
|
|
|
|
clear
|
|
|
|
|
header_info
|
|
|
|
|
echo -e "${RD}Using Advanced Settings${CL}"
|
|
|
|
|
echo -e "${DGN}Using Version ${BGN}$BRANCH${CL}"
|
|
|
|
|
echo -e "${DGN}Using VM ID ${BGN}$VMID${CL}"
|
|
|
|
|
echo -e "${DGN}Using VM Name ${BGN}$VM_NAME${CL}"
|
|
|
|
|
echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}"
|
|
|
|
|
echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}"
|
|
|
|
|
echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}"
|
|
|
|
|
echo -e "${YW}Enter a Static IP Address, or Press [ENTER] for Default: DHCP "
|
|
|
|
|
read NET
|
|
|
|
|
if [ -z $NET ]; then NET="dhcp"; fi;
|
|
|
|
|
echo -en "${DGN}Set Static IP Address To ${BL}$NET${CL}"
|
|
|
|
|
echo -e " ${CM}${CL} \n"
|
|
|
|
|
sleep 1
|
|
|
|
|
clear
|
|
|
|
|
header_info
|
|
|
|
|
echo -e "${RD}Using Advanced Settings${CL}"
|
|
|
|
|
echo -e "${DGN}Using Version ${BGN}$BRANCH${CL}"
|
|
|
|
|
echo -e "${DGN}Using VM ID ${BGN}$VMID${CL}"
|
|
|
|
|
echo -e "${DGN}Using VM Name ${BGN}$VM_NAME${CL}"
|
|
|
|
|
echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}"
|
|
|
|
|
echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}"
|
|
|
|
|
echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}"
|
|
|
|
|
echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}"
|
|
|
|
|
echo -e "${YW}Enter a Gateway IP, or Press [ENTER] for Default: NONE "
|
|
|
|
|
read GATE1
|
|
|
|
|
if [ -z $GATE1 ]; then GATE1="NONE" GATE="";
|
|
|
|
|
echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}"
|
|
|
|
|
else
|
|
|
|
|
GATE=",gw=$GATE1"
|
|
|
|
|
echo -en "${DGN}Set Gateway IP To ${BL}$GATE1${CL}"
|
|
|
|
|
fi;
|
|
|
|
|
echo -e " ${CM}${CL} \n"
|
|
|
|
|
sleep 1
|
|
|
|
|
clear
|
|
|
|
|
header_info
|
|
|
|
|
echo -e "${RD}Using Advanced Settings${CL}"
|
|
|
|
|
echo -e "${DGN}Using Version ${BGN}$BRANCH${CL}"
|
|
|
|
@ -192,8 +155,7 @@ header_info
|
|
|
|
|
echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}"
|
|
|
|
|
echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB RAM${CL}"
|
|
|
|
|
echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}"
|
|
|
|
|
echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}"
|
|
|
|
|
echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}"
|
|
|
|
|
echo -e "${DGN}Using MAC Address ${BGN}$MAC${CL}"
|
|
|
|
|
echo -e "${YW}Enter a VLAN Tag, or Press [ENTER] for Default: NONE "
|
|
|
|
|
read VLAN1
|
|
|
|
|
if [ -z $VLAN1 ]; then VLAN1="NONE" VLAN="";
|
|
|
|
@ -213,8 +175,7 @@ header_info
|
|
|
|
|
echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}"
|
|
|
|
|
echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB${CL}"
|
|
|
|
|
echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}"
|
|
|
|
|
echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}"
|
|
|
|
|
echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}"
|
|
|
|
|
echo -e "${DGN}Using MAC Address ${BGN}$MAC${CL}"
|
|
|
|
|
echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}"
|
|
|
|
|
echo -e "${YW}Start VM when completed, or Press [ENTER] for Default: yes "
|
|
|
|
|
read START_VM
|
|
|
|
@ -233,8 +194,7 @@ header_info
|
|
|
|
|
echo -e "${DGN}Using ${BGN}${CORE_COUNT}${CL}${DGN}vCPU${CL}"
|
|
|
|
|
echo -e "${DGN}Using ${BGN}${RAM_SIZE}${CL}${DGN}MiB${CL}"
|
|
|
|
|
echo -e "${DGN}Using Bridge ${BGN}${BRG}${CL}"
|
|
|
|
|
echo -e "${DGN}Using Static IP Address ${BGN}$NET${CL}"
|
|
|
|
|
echo -e "${DGN}Using Gateway IP Address ${BGN}$GATE1${CL}"
|
|
|
|
|
echo -e "${DGN}Using MAC Address ${BGN}$MAC${CL}"
|
|
|
|
|
echo -e "${DGN}Using VLAN Tag ${BGN}$VLAN1${CL}"
|
|
|
|
|
echo -e "${DGN}Start VM when completed ${BGN}$START_VM${CL}"
|
|
|
|
|
|
|
|
|
@ -353,7 +313,7 @@ done
|
|
|
|
|
msg_ok "Extracted Disk Image"
|
|
|
|
|
|
|
|
|
|
msg_info "Creating HAOS VM"
|
|
|
|
|
qm create $VMID -agent 1 -bios ovmf -cores $CORE_COUNT -memory $RAM_SIZE -name $VM_NAME -net0 virtio,bridge=$BRG$VLAN -ipconfig0 ip=$NET$GATE \
|
|
|
|
|
qm create $VMID -agent 1 -bios ovmf -cores $CORE_COUNT -memory $RAM_SIZE -name $VM_NAME -net0 virtio,bridge=$BRG,macaddr=$MAC$VLAN \
|
|
|
|
|
-onboot 1 -ostype l26 -scsihw virtio-scsi-pci
|
|
|
|
|
pvesm alloc $STORAGE $VMID $DISK0 128 1>&/dev/null
|
|
|
|
|
qm importdisk $VMID ${FILE%.*} $STORAGE ${IMPORT_OPT:-} 1>&/dev/null
|
|
|
|
|