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