mirror of https://github.com/tteck/Proxmox.git
Update ha_container.sh
This commit is contained in:
parent
2ccec15dba
commit
f9d95abdd2
|
@ -72,7 +72,7 @@ function load_module() {
|
||||||
TEMP_DIR=$(mktemp -d)
|
TEMP_DIR=$(mktemp -d)
|
||||||
pushd $TEMP_DIR >/dev/null
|
pushd $TEMP_DIR >/dev/null
|
||||||
|
|
||||||
wget -qL https://raw.githubusercontent.com/tteck/Proxmox/main/ha_setup.sh
|
wget -qL https://raw.githubusercontent.com/tteck/Proxmox/wip/ha_setup.sh
|
||||||
|
|
||||||
load_module overlay
|
load_module overlay
|
||||||
|
|
||||||
|
@ -132,17 +132,23 @@ echo -e "${CHECKMARK} \e[1;92m Creating LXC Container... \e[0m"
|
||||||
DISK_SIZE=8G
|
DISK_SIZE=8G
|
||||||
pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null
|
pvesm alloc $STORAGE $CTID $DISK $DISK_SIZE --format ${DISK_FORMAT:-raw} >/dev/null
|
||||||
if [ "$STORAGE_TYPE" == "zfspool" ]; then
|
if [ "$STORAGE_TYPE" == "zfspool" ]; then
|
||||||
|
wget -qL -O fuse-overlayfs https://github.com/containers/fuse-overlayfs/releases/download/v1.8/fuse-overlayfs-x86_64
|
||||||
warn "Some containers may not work properly due to ZFS not supporting 'fallocate'."
|
warn "Some containers may not work properly due to ZFS not supporting 'fallocate'."
|
||||||
else
|
else
|
||||||
mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null
|
mkfs.ext4 $(pvesm path $ROOTFS) &>/dev/null
|
||||||
fi
|
fi
|
||||||
ARCH=$(dpkg --print-architecture)
|
ARCH=$(dpkg --print-architecture)
|
||||||
HOSTNAME=homeassistant
|
HOSTNAME=homeassistant
|
||||||
TEMPLATE_STRING="local:vztmpl/${TEMPLATE}"
|
TEMPLATE_STRING="local:vztmpl/${TEMPLATE}"
|
||||||
|
if [ "$STORAGE_TYPE" == "zfspool" ]; then
|
||||||
|
pct create $CTID $TEMPLATE_STRING -arch $ARCH -features fuse=1,keyctl=1,mknod=1,nesting=1 \
|
||||||
|
-hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 2 -memory 2048 \
|
||||||
|
-ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null
|
||||||
|
else
|
||||||
pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \
|
pct create $CTID $TEMPLATE_STRING -arch $ARCH -features nesting=1 \
|
||||||
-hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 2 -memory 2048 \
|
-hostname $HOSTNAME -net0 name=eth0,bridge=vmbr0,ip=dhcp -onboot 1 -cores 2 -memory 2048 \
|
||||||
-ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null
|
-ostype $OSTYPE -rootfs $ROOTFS,size=$DISK_SIZE -storage $STORAGE >/dev/null
|
||||||
|
fi
|
||||||
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
|
||||||
cat <<EOF >> $LXC_CONFIG
|
cat <<EOF >> $LXC_CONFIG
|
||||||
lxc.cgroup2.devices.allow: a
|
lxc.cgroup2.devices.allow: a
|
||||||
|
@ -155,9 +161,12 @@ pct unmount $CTID && unset MOUNT
|
||||||
|
|
||||||
echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m"
|
echo -e "${CHECKMARK} \e[1;92m Starting LXC Container... \e[0m"
|
||||||
pct start $CTID
|
pct start $CTID
|
||||||
|
if [ "$STORAGE_TYPE" == "zfspool" ]; then
|
||||||
|
pct push $CTID fuse-overlayfs /usr/local/bin/fuse-overlayfs -perms 755
|
||||||
|
info "Using fuse-overlayfs."
|
||||||
|
fi
|
||||||
pct push $CTID ha_setup.sh /ha_setup.sh -perms 755
|
pct push $CTID ha_setup.sh /ha_setup.sh -perms 755
|
||||||
pct exec $CTID /ha_setup.sh
|
pct exec $CTID /ha_setup.sh
|
||||||
|
|
||||||
IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}')
|
IP=$(pct exec $CTID ip a s dev eth0 | sed -n '/inet / s/\// /p' | awk '{print $2}')
|
||||||
info "Successfully Created Home Assistant Container LXC to $CTID."
|
info "Successfully Created Home Assistant Container LXC to $CTID."
|
||||||
msg "
|
msg "
|
||||||
|
|
Loading…
Reference in New Issue