Files
ProxmoxVE/install/homeassistant-core-install.sh
T

102 lines
2.2 KiB
Bash
Raw Normal View History

2023-03-22 20:48:20 -04:00
#!/usr/bin/env bash
# Copyright (c) 2021-2025 tteck
2023-03-22 20:48:20 -04:00
# Author: tteck (tteckster)
# License: MIT
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
2023-03-22 20:48:20 -04:00
2023-06-16 16:42:46 -04:00
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
2023-03-22 20:48:20 -04:00
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
2024-01-31 17:27:20 -05:00
msg_info "Installing Dependencies (Patience)"
$STD apt-get install -y \
2025-01-04 18:25:15 +01:00
curl \
git \
sudo \
mc \
2025-01-04 19:14:54 +01:00
gnupg \
ca-certificates \
bluez \
2025-01-04 19:05:46 +01:00
libtiff6 \
tzdata \
libffi-dev \
libssl-dev \
libjpeg-dev \
2025-01-04 18:41:00 +01: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 19:49:26 +01:00
libatlas-base-dev \
software-properties-common \
libmariadb-dev \
pkg-config
2023-06-20 10:02:58 -04:00
msg_ok "Installed Dependencies"
msg_info "Setup Python3"
$STD apt-get update
$STD rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
$STD apt-get remove --purge -y python3.12 python3.12-dev python3.12-venv
2025-01-04 19:49:26 +01:00
$STD apt-get install -y \
python3.13 \
python3-pip \
2025-01-04 19:49:26 +01:00
python3.13-dev \
python3.13-venv
ln -sf /usr/bin/python3.13 /usr/bin/python3
msg_ok "Setup Python3"
2024-10-02 22:34:56 -04:00
msg_info "Setting up Home Assistant-Core environment"
2023-03-22 20:48:20 -04:00
mkdir /srv/homeassistant
cd /srv/homeassistant
python3 -m venv .
2023-03-22 20:48:20 -04:00
source bin/activate
msg_ok "Created virtual environment"
2024-10-02 22:34:56 -04:00
msg_info "Installing Home Assistant-Core"
$STD python3 -m pip install webrtcvad wheel homeassistant mysqlclient psycopg2-binary isal
2023-03-22 20:48:20 -04:00
mkdir -p /root/.homeassistant
msg_ok "Installed Home Assistant-Core"
2023-03-22 20:48:20 -04:00
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
2024-10-03 06:16:12 -04:00
Environment="PATH=/srv/homeassistant/bin:/usr/local/bin:/usr/bin:/usr/local/bin/uv"
2024-10-02 22:34:56 -04:00
ExecStart=/srv/homeassistant/bin/python3 -m homeassistant --config /root/.homeassistant
2023-05-13 10:02:02 -04:00
Restart=always
2023-03-22 20:48:20 -04:00
RestartForceExitStatus=100
[Install]
WantedBy=multi-user.target
EOF
2024-05-08 01:22:57 -04:00
systemctl enable -q --now homeassistant
2023-03-22 20:48:20 -04:00
msg_ok "Created Service"
motd_ssh
2023-05-15 07:39:30 -04:00
customize
2023-03-22 20:48:20 -04:00
msg_info "Cleaning up"
2024-05-02 13:26:16 -04:00
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"