This commit is contained in:
patriciocl 2021-09-13 15:42:20 +02:00 committed by GitHub
commit 2ad1fe151b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 6 deletions

View File

@ -1,9 +1,20 @@
# New Proxmox VM with Home Assistant
# Support Promox 7
- remove susbcription and add non-susbcription
- add zip support
# Telegram channel
- https://t.me/proxmoxha
forked from whiskerz007/proxmox_hassos_install
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://raw.githubusercontent.com/patriciocl/proxmox_hassos_install/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.

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash
# Setup script environment
set -o errexit #Exit immediately if a pipeline returns a non-zero status
set -o errtrace #Trap ERR from shell functions, command substitutions, and commands from subshell
@ -10,6 +12,15 @@ alias die='EXIT=$? LINE=$LINENO error_exit'
trap die ERR
trap cleanup EXIT
#remove susbcription
rm -rf /etc/apt/sources.list.d/pve-enterprise.list
#add pve-no
echo "deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
apt-get update
apt-get install -y zip unzip parted util-linux
function error_exit() {
trap - ERR
local DEFAULT='Unknown failure occured.'
@ -113,16 +124,22 @@ msg "Extracting disk image..."
case $FILE in
*"gz") gunzip -f $FILE;;
*"xz") xz -d $FILE;;
*"zip") unzip -q $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}')
if [ "$STORAGE_TYPE" = "dir" ]; then
DISK_EXT=".qcow2"
DISK_REF="$VMID/"
IMPORT_OPT="-format qcow2"
fi
msg "Extracting disk image..."
case $STORAGE_TYPE in
nfs|dir)
DISK_EXT=".qcow2"
DISK_REF="$VMID/"
IMPORT_OPT="-format qcow2"
;;
*) echo "next"
;;
esac
for i in {0,1}; do
disk="DISK$i"
eval DISK${i}=vm-${VMID}-disk-${i}${DISK_EXT:-}