ProxmoxVE/install/homeassistant-core-install.sh

101 lines
2.1 KiB
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
# Copyright (c) 2021-2025 tteck
# Author: tteck (tteckster)
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies (Patience)"
$STD apt-get install -y \
2025-01-04 17:25:15 +00:00
curl \
git \
sudo \
mc \
2025-01-04 18:14:54 +00:00
gnupg \
ca-certificates \
bluez \
2025-01-04 18:05:46 +00:00
libtiff6 \
tzdata \
libffi-dev \
libssl-dev \
libjpeg-dev \
2025-01-04 17:41:00 +00:00
zlib1g-dev \
autoconf \
build-essential \
libopenjp2-7 \
libturbojpeg0-dev \
ffmpeg \
liblapack3 \
liblapack-dev \
dbus-broker \
libpcap-dev \
libavdevice-dev \
libavformat-dev \
libavcodec-dev \
libavutil-dev \
libavfilter-dev \
libmariadb-dev-compat \
2025-01-04 18:49:26 +00:00
libatlas-base-dev \
software-properties-common
msg_ok "Installed Dependencies"
msg_info "Setup Python3"
2025-01-04 19:00:57 +00:00
$STD add-apt-repository -y ppa:deadsnakes/ppa
$STD apt-get update
2025-01-04 18:49:26 +00:00
$STD apt-get install -y \
python3.13-* \
python3-pip \
2025-01-04 18:49:26 +00:00
python3.13-dev \
python3.13-venv
2025-01-04 17:39:43 +00:00
msg_ok "Setup Python3"
msg_info "Installing UV"
$STD pip install uv
msg_ok "Installed UV"
msg_info "Setting up Home Assistant-Core environment"
mkdir /srv/homeassistant
cd /srv/homeassistant
uv venv . &>/dev/null
source bin/activate
msg_ok "Created virtual environment with UV"
msg_info "Installing Home Assistant-Core and packages"
$STD uv pip install webrtcvad wheel homeassistant mysqlclient psycopg2-binary isal
mkdir -p /root/.homeassistant
msg_ok "Installed Home Assistant-Core and required packages"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/homeassistant.service
[Unit]
Description=Home Assistant
After=network-online.target
[Service]
Type=simple
WorkingDirectory=/root/.homeassistant
Environment="PATH=/srv/homeassistant/bin:/usr/local/bin:/usr/bin:/usr/local/bin/uv"
ExecStart=/srv/homeassistant/bin/python3 -m homeassistant --config /root/.homeassistant
Restart=always
RestartForceExitStatus=100
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now homeassistant
msg_ok "Created Service"
motd_ssh
2023-05-15 11:39:30 +00:00
customize
msg_info "Cleaning up"
2024-05-02 17:26:16 +00:00
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"