49 lines
1.9 KiB
Bash
49 lines
1.9 KiB
Bash
#!/bin/ash
|
|
#Install HomeAssistant
|
|
mkdir -p /opt/HomeAssistant/srv
|
|
mkdir -p /opt/HomeAssistant/data/custom_components/hacs
|
|
touch /opt/HomeAssistant/data/home-assistant.log
|
|
addgroup hass
|
|
adduser -h /opt/HomeAssistant/data -D -G hass -s /bin/sh hass
|
|
chown -R hass:hass /opt/HomeAssistant
|
|
sudo -u hass python3 -m venv /opt/HomeAssistant/srv
|
|
|
|
#Fix broken Pyton module (It will not install with pyton 3.12 on a Musl system)
|
|
wget https://codeload.github.com/rhasspy/webrtc-noise-gain/tar.gz/refs/tags/v1.2.3 -O /tmp/webrtc-noise-gain.tar.gz || exit 1
|
|
tar -C /tmp -xzf /tmp/webrtc-noise-gain.tar.gz
|
|
patch /tmp/webrtc-noise-gain-1.2.3/webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.h << EOF
|
|
--- <webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.h>
|
|
+++ <webrtc-audio-processing/webrtc-audio-processing-1/rtc_base/system/file_wrapper.h>
|
|
@@ -13,6 +13,7 @@
|
|
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
+#include <cstdint>
|
|
|
|
#include <string>
|
|
|
|
|
|
EOF
|
|
chown hass: -R /tmp/webrtc-noise-gain-1.2.3
|
|
sudo -u hass sh -c '. /opt/HomeAssistant/srv/bin/activate && pip install /tmp/webrtc-noise-gain-1.2.3'
|
|
rm -rf /tmp/webrtc-noise-gain.tar.gz /tmp/webrtc-noise-gain-1.2.3
|
|
##End of fix (Remove when pyton module updates)
|
|
|
|
sudo -u hass sh -c '. /opt/HomeAssistant/srv/bin/activate && pip install --upgrade pip && pip3 install wheel mutagen numpy mysqlclient && pip3 install homeassistant'
|
|
|
|
#Install Home Assistant Community Store
|
|
wget https://github.com/hacs/integration/releases/latest/download/hacs.zip -O /tmp/hacs.zip
|
|
sudo -u hass unzip -q /tmp/hacs.zip -d /opt/HomeAssistant/data/custom_components/hacs
|
|
|
|
#Update script
|
|
mv /opt/Setup/Scripts/UpdateHASS.sh /opt/UpdateHASS.sh
|
|
|
|
#CleanUp
|
|
rm -rf /opt/HomeAssistant/data/.cache/*
|
|
rm -rf /usr/lib/python3.11/__pycache__/*
|
|
|
|
#Setup HomeAssistant service
|
|
mv /opt/Setup/Configs/hass.service /etc/init.d/hass
|
|
chmod +x /etc/init.d/hass
|
|
rc-update add hass
|