Update haos-vm-v4.sh

This commit is contained in:
tteckster 2022-08-29 19:34:29 -04:00 committed by GitHub
parent 40897f22c5
commit b21ce7b82e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,7 @@ CL=`echo "\033[m"`
BFR="\\r\\033[K" BFR="\\r\\033[K"
HOLD="-" HOLD="-"
CM="${GN}${CL}" CM="${GN}${CL}"
CROSS="${RD}${CL}"
set -o errexit set -o errexit
set -o errtrace set -o errtrace
set -o nounset set -o nounset
@ -48,11 +49,11 @@ function cleanup() {
TEMP_DIR=$(mktemp -d) TEMP_DIR=$(mktemp -d)
pushd $TEMP_DIR >/dev/null pushd $TEMP_DIR >/dev/null
if [ `pveversion | grep "pve-manager/7" | wc -l` -ne 1 ]; then if [ `pveversion | grep "pve-manager/7" | wc -l` -ne 1 ]; then
echo "⚠ This version of Proxmox Virtual Environment is not supported" echo "⚠ This version of Proxmox Virtual Environment is not supported"
echo "Requires PVE Version: 7.XX" echo "Requires PVE Version: 7.XX"
echo "Exiting..." echo "Exiting..."
sleep 3 sleep 3
exit exit
fi fi
if (whiptail --title "HOME ASSISTANT OS VM" --yesno "This will create a New Home Assistant OS VM. Proceed?" 10 58); then if (whiptail --title "HOME ASSISTANT OS VM" --yesno "This will create a New Home Assistant OS VM. Proceed?" 10 58); then
echo "User selected Yes" echo "User selected Yes"
@ -79,26 +80,31 @@ function msg_ok() {
local msg="$1" local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}" echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
} }
function msg_error() {
local msg="$1"
echo -e "${BFR} ${CROSS} ${RD}${msg}${CL}"
}
function default_settings() { function default_settings() {
echo -e "${DGN}Using HAOS Version: ${BGN}${STABLE}${CL}" echo -e "${DGN}Using HAOS Version: ${BGN}${STABLE}${CL}"
BRANCH=${STABLE} BRANCH=${STABLE}
echo -e "${DGN}Using Virtual Machine ID: ${BGN}$NEXTID${CL}" echo -e "${DGN}Using Virtual Machine ID: ${BGN}$NEXTID${CL}"
VMID=$NEXTID VMID=$NEXTID
echo -e "${DGN}Using Hostname: ${BGN}haos${STABLE}${CL}" echo -e "${DGN}Using Hostname: ${BGN}haos${STABLE}${CL}"
HN=haos${STABLE} HN=haos${STABLE}
echo -e "${DGN}Allocated Cores: ${BGN}2${CL}" echo -e "${DGN}Allocated Cores: ${BGN}2${CL}"
CORE_COUNT="2" CORE_COUNT="2"
echo -e "${DGN}Allocated RAM: ${BGN}4096${CL}" echo -e "${DGN}Allocated RAM: ${BGN}4096${CL}"
RAM_SIZE="4096" RAM_SIZE="4096"
echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}" echo -e "${DGN}Using Bridge: ${BGN}vmbr0${CL}"
BRG="vmbr0" BRG="vmbr0"
echo -e "${DGN}Using MAC Address: ${BGN}$GEN_MAC${CL}" echo -e "${DGN}Using MAC Address: ${BGN}$GEN_MAC${CL}"
MAC=$GEN_MAC MAC=$GEN_MAC
echo -e "${DGN}Using VLAN: ${BGN}Default${CL}" echo -e "${DGN}Using VLAN: ${BGN}Default${CL}"
VLAN="" VLAN=""
echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}" echo -e "${DGN}Start VM when completed: ${BGN}yes${CL}"
START_VM="yes" START_VM="yes"
echo -e "${BL}Creating a HAOS VM using the above default settings${CL}" echo -e "${BL}Creating a HAOS VM using the above default settings${CL}"
} }
function advanced_settings() { function advanced_settings() {
BRANCH=$(whiptail --title "HAOS VERSION" --radiolist "Choose Version" 10 58 3 \ BRANCH=$(whiptail --title "HAOS VERSION" --radiolist "Choose Version" 10 58 3 \
@ -210,9 +216,8 @@ STORAGE_MENU+=( "$TAG" "$ITEM" "OFF" )
done < <(pvesm status -content images | awk 'NR>1') done < <(pvesm status -content images | awk 'NR>1')
VALID=$(pvesm status -content images | awk 'NR>1') VALID=$(pvesm status -content images | awk 'NR>1')
if [ -z "$VALID" ]; then if [ -z "$VALID" ]; then
echo -e "\n${RD}⚠ Unable to detect a valid storage location.${CL}" msg_error "Unable to detect a valid storage location."
echo -e "Exiting..." exit
exit
elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then elif [ $((${#STORAGE_MENU[@]}/3)) -eq 1 ]; then
STORAGE=${STORAGE_MENU[0]} STORAGE=${STORAGE_MENU[0]}
else else